From cf3eb26e6f0a49e79d86bfc6f1c4f34122bd17b8 Mon Sep 17 00:00:00 2001 From: bank Date: Mon, 12 May 2014 17:43:14 +0400 Subject: [PATCH 01/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class CodeBlock --- Engine/source/console/astNodes.cpp | 6 +- Engine/source/console/codeBlock.cpp | 378 +++++++++++------------ Engine/source/console/codeBlock.h | 34 +- Engine/source/console/compiledEval.cpp | 156 +++++----- Engine/source/console/simObject.cpp | 4 +- Engine/source/console/telnetDebugger.cpp | 26 +- 6 files changed, 302 insertions(+), 302 deletions(-) diff --git a/Engine/source/console/astNodes.cpp b/Engine/source/console/astNodes.cpp index 11cc44f90..d077f8b89 100644 --- a/Engine/source/console/astNodes.cpp +++ b/Engine/source/console/astNodes.cpp @@ -82,10 +82,10 @@ void StmtNode::addBreakLine(U32 ip) U32 line = CodeBlock::smBreakLineCount * 2; CodeBlock::smBreakLineCount++; - if(getBreakCodeBlock()->lineBreakPairs) + if(getBreakCodeBlock()->mLineBreakPairs) { - getBreakCodeBlock()->lineBreakPairs[line] = dbgLineNumber; - getBreakCodeBlock()->lineBreakPairs[line+1] = ip; + getBreakCodeBlock()->mLineBreakPairs[line] = dbgLineNumber; + getBreakCodeBlock()->mLineBreakPairs[line+1] = ip; } } diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index fc3e3544f..2716f3a9b 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -42,21 +42,21 @@ ConsoleParser *CodeBlock::smCurrentParser = NULL; CodeBlock::CodeBlock() { - globalStrings = NULL; - functionStrings = NULL; - functionStringsMaxLen = 0; - globalStringsMaxLen = 0; - globalFloats = NULL; - functionFloats = NULL; - lineBreakPairs = NULL; - breakList = NULL; - breakListSize = 0; + mGlobalStrings = NULL; + mFunctionStrings = NULL; + mFunctionStringsMaxLen = 0; + mGlobalStringsMaxLen = 0; + mGlobalFloats = NULL; + mFunctionFloats = NULL; + mLineBreakPairs = NULL; + mBreakList = NULL; + mBreakListSize = 0; - refCount = 0; - code = NULL; - name = NULL; - fullPath = NULL; - modPath = NULL; + mRefCount = 0; + mCode = NULL; + mName = NULL; + mFullPath = NULL; + mModPath = NULL; } CodeBlock::~CodeBlock() @@ -64,18 +64,18 @@ CodeBlock::~CodeBlock() // Make sure we aren't lingering in the current code block... AssertFatal(smCurrentCodeBlock != this, "CodeBlock::~CodeBlock - Caught lingering in smCurrentCodeBlock!") - if(name) + if(mName) removeFromCodeList(); - delete[] const_cast(globalStrings); - delete[] const_cast(functionStrings); + delete[] const_cast(mGlobalStrings); + delete[] const_cast(mFunctionStrings); - functionStringsMaxLen = 0; - globalStringsMaxLen = 0; + mFunctionStringsMaxLen = 0; + mGlobalStringsMaxLen = 0; - delete[] globalFloats; - delete[] functionFloats; - delete[] code; - delete[] breakList; + delete[] mGlobalFloats; + delete[] mFunctionFloats; + delete[] mCode; + delete[] mBreakList; } //------------------------------------------------------------------------- @@ -83,7 +83,7 @@ CodeBlock::~CodeBlock() StringTableEntry CodeBlock::getCurrentCodeBlockName() { if (CodeBlock::getCurrentBlock()) - return CodeBlock::getCurrentBlock()->name; + return CodeBlock::getCurrentBlock()->mName; else return NULL; } @@ -91,7 +91,7 @@ StringTableEntry CodeBlock::getCurrentCodeBlockName() StringTableEntry CodeBlock::getCurrentCodeBlockFullPath() { if (CodeBlock::getCurrentBlock()) - return CodeBlock::getCurrentBlock()->fullPath; + return CodeBlock::getCurrentBlock()->mFullPath; else return NULL; } @@ -99,15 +99,15 @@ StringTableEntry CodeBlock::getCurrentCodeBlockFullPath() StringTableEntry CodeBlock::getCurrentCodeBlockModName() { if (CodeBlock::getCurrentBlock()) - return CodeBlock::getCurrentBlock()->modPath; + return CodeBlock::getCurrentBlock()->mModPath; else return NULL; } CodeBlock *CodeBlock::find(StringTableEntry name) { - for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile) - if(walk->name == name) + for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->mNextFile) + if(walk->mName == name) return walk; return NULL; } @@ -117,39 +117,39 @@ CodeBlock *CodeBlock::find(StringTableEntry name) void CodeBlock::addToCodeList() { // remove any code blocks with my name - for(CodeBlock **walk = &smCodeBlockList; *walk;walk = &((*walk)->nextFile)) + for(CodeBlock **walk = &smCodeBlockList; *walk;walk = &((*walk)->mNextFile)) { - if((*walk)->name == name) + if((*walk)->mName == mName) { - *walk = (*walk)->nextFile; + *walk = (*walk)->mNextFile; break; } } - nextFile = smCodeBlockList; + mNextFile = smCodeBlockList; smCodeBlockList = this; } void CodeBlock::clearAllBreaks() { - if(!lineBreakPairs) + if(!mLineBreakPairs) return; - for(U32 i = 0; i < lineBreakPairCount; i++) + for(U32 i = 0; i < mLineBreakPairCount; i++) { - U32 *p = lineBreakPairs + i * 2; - code[p[1]] = p[0] & 0xFF; + U32 *p = mLineBreakPairs + i * 2; + mCode[p[1]] = p[0] & 0xFF; } } void CodeBlock::clearBreakpoint(U32 lineNumber) { - if(!lineBreakPairs) + if(!mLineBreakPairs) return; - for(U32 i = 0; i < lineBreakPairCount; i++) + for(U32 i = 0; i < mLineBreakPairCount; i++) { - U32 *p = lineBreakPairs + i * 2; + U32 *p = mLineBreakPairs + i * 2; if((p[0] >> 8) == lineNumber) { - code[p[1]] = p[0] & 0xFF; + mCode[p[1]] = p[0] & 0xFF; return; } } @@ -157,26 +157,26 @@ void CodeBlock::clearBreakpoint(U32 lineNumber) void CodeBlock::setAllBreaks() { - if(!lineBreakPairs) + if(!mLineBreakPairs) return; - for(U32 i = 0; i < lineBreakPairCount; i++) + for(U32 i = 0; i < mLineBreakPairCount; i++) { - U32 *p = lineBreakPairs + i * 2; - code[p[1]] = OP_BREAK; + U32 *p = mLineBreakPairs + i * 2; + mCode[p[1]] = OP_BREAK; } } bool CodeBlock::setBreakpoint(U32 lineNumber) { - if(!lineBreakPairs) + if(!mLineBreakPairs) return false; - for(U32 i = 0; i < lineBreakPairCount; i++) + for(U32 i = 0; i < mLineBreakPairCount; i++) { - U32 *p = lineBreakPairs + i * 2; + U32 *p = mLineBreakPairs + i * 2; if((p[0] >> 8) == lineNumber) { - code[p[1]] = OP_BREAK; + mCode[p[1]] = OP_BREAK; return true; } } @@ -186,12 +186,12 @@ bool CodeBlock::setBreakpoint(U32 lineNumber) U32 CodeBlock::findFirstBreakLine(U32 lineNumber) { - if(!lineBreakPairs) + if(!mLineBreakPairs) return 0; - for(U32 i = 0; i < lineBreakPairCount; i++) + for(U32 i = 0; i < mLineBreakPairCount; i++) { - U32 *p = lineBreakPairs + i * 2; + U32 *p = mLineBreakPairs + i * 2; U32 line = (p[0] >> 8); if( lineNumber <= line ) @@ -210,11 +210,11 @@ struct LinePair void CodeBlock::findBreakLine(U32 ip, U32 &line, U32 &instruction) { U32 min = 0; - U32 max = lineBreakPairCount - 1; - LinePair *p = (LinePair *) lineBreakPairs; + U32 max = mLineBreakPairCount - 1; + LinePair *p = (LinePair *) mLineBreakPairs; U32 found; - if(!lineBreakPairCount || p[min].ip > ip || p[max].ip < ip) + if(!mLineBreakPairCount || p[min].ip > ip || p[max].ip < ip) { line = 0; instruction = OP_INVALID; @@ -255,17 +255,17 @@ const char *CodeBlock::getFileLine(U32 ip) U32 line, inst; findBreakLine(ip, line, inst); - dSprintf(nameBuffer, sizeof(nameBuffer), "%s (%d)", name ? name : "", line); + dSprintf(nameBuffer, sizeof(nameBuffer), "%s (%d)", mName ? mName : "", line); return nameBuffer; } void CodeBlock::removeFromCodeList() { - for(CodeBlock **walk = &smCodeBlockList; *walk; walk = &((*walk)->nextFile)) + for(CodeBlock **walk = &smCodeBlockList; *walk; walk = &((*walk)->mNextFile)) { if(*walk == this) { - *walk = nextFile; + *walk = mNextFile; // clear out all breakpoints clearAllBreaks(); @@ -286,9 +286,9 @@ void CodeBlock::calcBreakList() S32 line = -1; U32 seqCount = 0; U32 i; - for(i = 0; i < lineBreakPairCount; i++) + for(i = 0; i < mLineBreakPairCount; i++) { - U32 lineNumber = lineBreakPairs[i * 2]; + U32 lineNumber = mLineBreakPairs[i * 2]; if(lineNumber == U32(line + 1)) seqCount++; else @@ -303,23 +303,23 @@ void CodeBlock::calcBreakList() if(seqCount) size++; - breakList = new U32[size]; - breakListSize = size; + mBreakList = new U32[size]; + mBreakListSize = size; line = -1; seqCount = 0; size = 0; - for(i = 0; i < lineBreakPairCount; i++) + for(i = 0; i < mLineBreakPairCount; i++) { - U32 lineNumber = lineBreakPairs[i * 2]; + U32 lineNumber = mLineBreakPairs[i * 2]; if(lineNumber == U32(line + 1)) seqCount++; else { if(seqCount) - breakList[size++] = seqCount; - breakList[size++] = lineNumber - getMax(0, line) - 1; + mBreakList[size++] = seqCount; + mBreakList[size++] = lineNumber - getMax(0, line) - 1; seqCount = 1; } @@ -327,12 +327,12 @@ void CodeBlock::calcBreakList() } if(seqCount) - breakList[size++] = seqCount; + mBreakList[size++] = seqCount; - for(i = 0; i < lineBreakPairCount; i++) + for(i = 0; i < mLineBreakPairCount; i++) { - U32 *p = lineBreakPairs + i * 2; - p[0] = (p[0] << 8) | code[p[1]]; + U32 *p = mLineBreakPairs + i * 2; + p[0] = (p[0] << 8) | mCode[p[1]]; } // Let the telnet debugger know that this code @@ -347,27 +347,27 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) const StringTableEntry exePath = Platform::getMainDotCsDir(); const StringTableEntry cwd = Platform::getCurrentDirectory(); - name = fileName; + mName = fileName; if(fileName) { - fullPath = NULL; + mFullPath = NULL; if(Platform::isFullPath(fileName)) - fullPath = fileName; + mFullPath = fileName; if(dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) - name = StringTable->insert(fileName + dStrlen(exePath) + 1, true); + mName = StringTable->insert(fileName + dStrlen(exePath) + 1, true); else if(dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) - name = StringTable->insert(fileName + dStrlen(cwd) + 1, true); + mName = StringTable->insert(fileName + dStrlen(cwd) + 1, true); - if(fullPath == NULL) + if(mFullPath == NULL) { char buf[1024]; - fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true); + mFullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true); } - modPath = Con::getModNameFromPath(fileName); + mModPath = Con::getModNameFromPath(fileName); } // @@ -377,53 +377,53 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) st.read(&size); if(size) { - globalStrings = new char[size]; - globalStringsMaxLen = size; - st.read(size, globalStrings); + mGlobalStrings = new char[size]; + mGlobalStringsMaxLen = size; + st.read(size, mGlobalStrings); } globalSize = size; st.read(&size); if(size) { - functionStrings = new char[size]; - functionStringsMaxLen = size; - st.read(size, functionStrings); + mFunctionStrings = new char[size]; + mFunctionStringsMaxLen = size; + st.read(size, mFunctionStrings); } st.read(&size); if(size) { - globalFloats = new F64[size]; + mGlobalFloats = new F64[size]; for(U32 i = 0; i < size; i++) - st.read(&globalFloats[i]); + st.read(&mGlobalFloats[i]); } st.read(&size); if(size) { - functionFloats = new F64[size]; + mFunctionFloats = new F64[size]; for(U32 i = 0; i < size; i++) - st.read(&functionFloats[i]); + st.read(&mFunctionFloats[i]); } U32 codeSize; st.read(&codeSize); - st.read(&lineBreakPairCount); + st.read(&mLineBreakPairCount); - U32 totSize = codeSize + lineBreakPairCount * 2; - code = new U32[totSize]; + U32 totSize = codeSize + mLineBreakPairCount * 2; + mCode = new U32[totSize]; for(i = 0; i < codeSize; i++) { U8 b; st.read(&b); if(b == 0xFF) - st.read(&code[i]); + st.read(&mCode[i]); else - code[i] = b; + mCode[i] = b; } for(i = codeSize; i < totSize; i++) - st.read(&code[i]); + st.read(&mCode[i]); - lineBreakPairs = code + codeSize; + mLineBreakPairs = mCode + codeSize; // StringTable-ize our identifiers. U32 identCount; @@ -434,7 +434,7 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) st.read(&offset); StringTableEntry ste; if(offset < globalSize) - ste = StringTable->insert(globalStrings + offset); + ste = StringTable->insert(mGlobalStrings + offset); else ste = StringTable->insert(""); U32 count; @@ -443,11 +443,11 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) { U32 ip; st.read(&ip); - code[ip] = *((U32 *) &ste); + mCode[ip] = *((U32 *) &ste); } } - if(lineBreakPairCount) + if(mLineBreakPairCount) calcBreakList(); return true; @@ -501,13 +501,13 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con setBreakCodeBlock(this); if(gStatementList) - codeSize = precompileBlock(gStatementList, 0) + 1; + mCodeSize = precompileBlock(gStatementList, 0) + 1; else - codeSize = 1; + mCodeSize = 1; - lineBreakPairCount = smBreakLineCount; - code = new U32[codeSize + smBreakLineCount * 2]; - lineBreakPairs = code + codeSize; + mLineBreakPairCount = smBreakLineCount; + mCode = new U32[mCodeSize + smBreakLineCount * 2]; + mLineBreakPairs = mCode + mCodeSize; // Write string table data... getGlobalStringTable().write(st); @@ -520,34 +520,34 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con smBreakLineCount = 0; U32 lastIp; if(gStatementList) - lastIp = compileBlock(gStatementList, code, 0, 0, 0); + lastIp = compileBlock(gStatementList, mCode, 0, 0, 0); else lastIp = 0; - if(lastIp != codeSize - 1) + if(lastIp != mCodeSize - 1) Con::errorf(ConsoleLogEntry::General, "CodeBlock::compile - precompile size mismatch, a precompile/compile function pair is probably mismatched."); - code[lastIp++] = OP_RETURN; - U32 totSize = codeSize + smBreakLineCount * 2; - st.write(codeSize); - st.write(lineBreakPairCount); + mCode[lastIp++] = OP_RETURN; + U32 totSize = mCodeSize + smBreakLineCount * 2; + st.write(mCodeSize); + st.write(mLineBreakPairCount); // Write out our bytecode, doing a bit of compression for low numbers. U32 i; - for(i = 0; i < codeSize; i++) + for(i = 0; i < mCodeSize; i++) { - if(code[i] < 0xFF) - st.write(U8(code[i])); + if(mCode[i] < 0xFF) + st.write(U8(mCode[i])); else { st.write(U8(0xFF)); - st.write(code[i]); + st.write(mCode[i]); } } // Write the break info... - for(i = codeSize; i < totSize; i++) - st.write(code[i]); + for(i = mCodeSize; i < totSize; i++) + st.write(mCode[i]); getIdentTable().write(st); @@ -568,33 +568,33 @@ const char *CodeBlock::compileExec(StringTableEntry fileName, const char *inStri STEtoU32 = evalSTEtoU32; consoleAllocReset(); - name = fileName; + mName = fileName; if(fileName) { const StringTableEntry exePath = Platform::getMainDotCsDir(); const StringTableEntry cwd = Platform::getCurrentDirectory(); - fullPath = NULL; + mFullPath = NULL; if(Platform::isFullPath(fileName)) - fullPath = fileName; + mFullPath = fileName; if(dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) - name = StringTable->insert(fileName + dStrlen(exePath) + 1, true); + mName = StringTable->insert(fileName + dStrlen(exePath) + 1, true); else if(dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) - name = StringTable->insert(fileName + dStrlen(cwd) + 1, true); + mName = StringTable->insert(fileName + dStrlen(cwd) + 1, true); - if(fullPath == NULL) + if(mFullPath == NULL) { char buf[1024]; - fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true); + mFullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true); } - modPath = Con::getModNameFromPath(fileName); + mModPath = Con::getModNameFromPath(fileName); } - if(name) + if(mName) addToCodeList(); gStatementList = NULL; @@ -620,33 +620,33 @@ const char *CodeBlock::compileExec(StringTableEntry fileName, const char *inStri smBreakLineCount = 0; setBreakCodeBlock(this); - codeSize = precompileBlock(gStatementList, 0) + 1; + mCodeSize = precompileBlock(gStatementList, 0) + 1; - lineBreakPairCount = smBreakLineCount; + mLineBreakPairCount = smBreakLineCount; - globalStrings = getGlobalStringTable().build(); - globalStringsMaxLen = getGlobalStringTable().totalLen; + mGlobalStrings = getGlobalStringTable().build(); + mGlobalStringsMaxLen = getGlobalStringTable().totalLen; - functionStrings = getFunctionStringTable().build(); - functionStringsMaxLen = getFunctionStringTable().totalLen; + mFunctionStrings = getFunctionStringTable().build(); + mFunctionStringsMaxLen = getFunctionStringTable().totalLen; - globalFloats = getGlobalFloatTable().build(); - functionFloats = getFunctionFloatTable().build(); + mGlobalFloats = getGlobalFloatTable().build(); + mFunctionFloats = getFunctionFloatTable().build(); - code = new U32[codeSize + lineBreakPairCount * 2]; - lineBreakPairs = code + codeSize; + mCode = new U32[mCodeSize + mLineBreakPairCount * 2]; + mLineBreakPairs = mCode + mCodeSize; smBreakLineCount = 0; - U32 lastIp = compileBlock(gStatementList, code, 0, 0, 0); - code[lastIp++] = OP_RETURN; + U32 lastIp = compileBlock(gStatementList, mCode, 0, 0, 0); + mCode[lastIp++] = OP_RETURN; consoleAllocReset(); - if(lineBreakPairCount && fileName) + if(mLineBreakPairCount && fileName) calcBreakList(); - if(lastIp != codeSize) - Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", codeSize, lastIp); + if(lastIp != mCodeSize) + Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", mCodeSize, lastIp); return exec(0, fileName, NULL, 0, 0, noCalls, NULL, setFrame); } @@ -655,13 +655,13 @@ const char *CodeBlock::compileExec(StringTableEntry fileName, const char *inStri void CodeBlock::incRefCount() { - refCount++; + mRefCount++; } void CodeBlock::decRefCount() { - refCount--; - if(!refCount) + mRefCount--; + if(!mRefCount) delete this; } @@ -671,10 +671,10 @@ String CodeBlock::getFunctionArgs( U32 ip ) { StringBuilder str; - U32 fnArgc = code[ ip + 5 ]; + U32 fnArgc = mCode[ ip + 5 ]; for( U32 i = 0; i < fnArgc; ++ i ) { - StringTableEntry var = U32toSTE( code[ ip + i + 6 ] ); + StringTableEntry var = U32toSTE( mCode[ ip + i + 6 ] ); if( i != 0 ) str.append( ", " ); @@ -696,18 +696,18 @@ String CodeBlock::getFunctionArgs( U32 ip ) void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) { U32 ip = startIp; - while( ip < codeSize ) + while( ip < mCodeSize ) { - switch( code[ ip ++ ] ) + switch( mCode[ ip ++ ] ) { case OP_FUNC_DECL: { - StringTableEntry fnName = U32toSTE(code[ip]); - StringTableEntry fnNamespace = U32toSTE(code[ip+1]); - StringTableEntry fnPackage = U32toSTE(code[ip+2]); - bool hasBody = bool(code[ip+3]); - U32 newIp = code[ ip + 4 ]; - U32 argc = code[ ip + 5 ]; + StringTableEntry fnName = U32toSTE(mCode[ip]); + StringTableEntry fnNamespace = U32toSTE(mCode[ip+1]); + StringTableEntry fnPackage = U32toSTE(mCode[ip+2]); + bool hasBody = bool(mCode[ip+3]); + U32 newIp = mCode[ ip + 4 ]; + U32 argc = mCode[ ip + 5 ]; Con::printf( "%i: OP_FUNC_DECL name=%s nspace=%s package=%s hasbody=%i newip=%i argc=%i", ip - 1, fnName, fnNamespace, fnPackage, hasBody, newIp, argc ); @@ -720,12 +720,12 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_CREATE_OBJECT: { - StringTableEntry objParent = U32toSTE(code[ip ]); - bool isDataBlock = code[ip + 1]; - bool isInternal = code[ip + 2]; - bool isSingleton = code[ip + 3]; - U32 lineNumber = code[ip + 4]; - U32 failJump = code[ip + 5]; + StringTableEntry objParent = U32toSTE(mCode[ip ]); + bool isDataBlock = mCode[ip + 1]; + bool isInternal = mCode[ip + 2]; + bool isSingleton = mCode[ip + 3]; + U32 lineNumber = mCode[ip + 4]; + U32 failJump = mCode[ip + 5]; Con::printf( "%i: OP_CREATE_OBJECT objParent=%s isDataBlock=%i isInternal=%i isSingleton=%i lineNumber=%i failJump=%i", ip - 1, objParent, isDataBlock, isInternal, isSingleton, lineNumber, failJump ); @@ -736,14 +736,14 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_ADD_OBJECT: { - bool placeAtRoot = code[ip++]; + bool placeAtRoot = mCode[ip++]; Con::printf( "%i: OP_ADD_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot ); break; } case OP_END_OBJECT: { - bool placeAtRoot = code[ip++]; + bool placeAtRoot = mCode[ip++]; Con::printf( "%i: OP_END_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot ); break; } @@ -756,49 +756,49 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_JMPIFFNOT: { - Con::printf( "%i: OP_JMPIFFNOT ip=%i", ip - 1, code[ ip ] ); + Con::printf( "%i: OP_JMPIFFNOT ip=%i", ip - 1, mCode[ ip ] ); ++ ip; break; } case OP_JMPIFNOT: { - Con::printf( "%i: OP_JMPIFNOT ip=%i", ip - 1, code[ ip ] ); + Con::printf( "%i: OP_JMPIFNOT ip=%i", ip - 1, mCode[ ip ] ); ++ ip; break; } case OP_JMPIFF: { - Con::printf( "%i: OP_JMPIFF ip=%i", ip - 1, code[ ip ] ); + Con::printf( "%i: OP_JMPIFF ip=%i", ip - 1, mCode[ ip ] ); ++ ip; break; } case OP_JMPIF: { - Con::printf( "%i: OP_JMPIF ip=%i", ip - 1, code[ ip ] ); + Con::printf( "%i: OP_JMPIF ip=%i", ip - 1, mCode[ ip ] ); ++ ip; break; } case OP_JMPIFNOT_NP: { - Con::printf( "%i: OP_JMPIFNOT_NP ip=%i", ip - 1, code[ ip ] ); + Con::printf( "%i: OP_JMPIFNOT_NP ip=%i", ip - 1, mCode[ ip ] ); ++ ip; break; } case OP_JMPIF_NP: { - Con::printf( "%i: OP_JMPIF_NP ip=%i", ip - 1, code[ ip ] ); + Con::printf( "%i: OP_JMPIF_NP ip=%i", ip - 1, mCode[ ip ] ); ++ ip; break; } case OP_JMP: { - Con::printf( "%i: OP_JMP ip=%i", ip - 1, code[ ip ] ); + Con::printf( "%i: OP_JMP ip=%i", ip - 1, mCode[ ip ] ); ++ ip; break; } @@ -957,7 +957,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_SETCURVAR: { - StringTableEntry var = U32toSTE(code[ip]); + StringTableEntry var = U32toSTE(mCode[ip]); Con::printf( "%i: OP_SETCURVAR var=%s", ip - 1, var ); ip++; @@ -966,7 +966,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_SETCURVAR_CREATE: { - StringTableEntry var = U32toSTE(code[ip]); + StringTableEntry var = U32toSTE(mCode[ip]); Con::printf( "%i: OP_SETCURVAR_CREATE var=%s", ip - 1, var ); ip++; @@ -1042,7 +1042,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_SETCURFIELD: { - StringTableEntry curField = U32toSTE(code[ip]); + StringTableEntry curField = U32toSTE(mCode[ip]); Con::printf( "%i: OP_SETCURFIELD field=%s", ip - 1, curField ); ++ ip; } @@ -1055,7 +1055,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_SETCURFIELD_TYPE: { - U32 type = code[ ip ]; + U32 type = mCode[ ip ]; Con::printf( "%i: OP_SETCURFIELD_TYPE type=%i", ip - 1, type ); ++ ip; break; @@ -1153,7 +1153,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_LOADIMMED_UINT: { - U32 val = code[ ip ]; + U32 val = mCode[ ip ]; Con::printf( "%i: OP_LOADIMMED_UINT val=%i", ip - 1, val ); ++ ip; break; @@ -1161,7 +1161,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_LOADIMMED_FLT: { - F64 val = functionFloats[ code[ ip ] ]; + F64 val = mFunctionFloats[ mCode[ ip ] ]; Con::printf( "%i: OP_LOADIMMED_FLT val=%f", ip - 1, val ); ++ ip; break; @@ -1169,7 +1169,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_TAG_TO_STR: { - const char* str = functionStrings + code[ ip ]; + const char* str = mFunctionStrings + mCode[ ip ]; Con::printf( "%i: OP_TAG_TO_STR str=%s", ip - 1, str ); ++ ip; break; @@ -1177,7 +1177,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_LOADIMMED_STR: { - const char* str = functionStrings + code[ ip ]; + const char* str = mFunctionStrings + mCode[ ip ]; Con::printf( "%i: OP_LOADIMMED_STR str=%s", ip - 1, str ); ++ ip; break; @@ -1185,7 +1185,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_DOCBLOCK_STR: { - const char* str = functionStrings + code[ ip ]; + const char* str = mFunctionStrings + mCode[ ip ]; Con::printf( "%i: OP_DOCBLOCK_STR str=%s", ip - 1, str ); ++ ip; break; @@ -1193,7 +1193,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_LOADIMMED_IDENT: { - StringTableEntry str = U32toSTE( code[ ip ] ); + StringTableEntry str = U32toSTE( mCode[ ip ] ); Con::printf( "%i: OP_LOADIMMED_IDENT str=%s", ip - 1, str ); ++ ip; break; @@ -1201,9 +1201,9 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_CALLFUNC_RESOLVE: { - StringTableEntry fnNamespace = U32toSTE(code[ip+1]); - StringTableEntry fnName = U32toSTE(code[ip]); - U32 callType = code[ip+2]; + StringTableEntry fnNamespace = U32toSTE(mCode[ip+1]); + StringTableEntry fnName = U32toSTE(mCode[ip]); + U32 callType = mCode[ip+2]; Con::printf( "%i: OP_CALLFUNC_RESOLVE name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, callType == FuncCallExprNode::FunctionCall ? "FunctionCall" @@ -1215,9 +1215,9 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_CALLFUNC: { - StringTableEntry fnNamespace = U32toSTE(code[ip+1]); - StringTableEntry fnName = U32toSTE(code[ip]); - U32 callType = code[ip+2]; + StringTableEntry fnNamespace = U32toSTE(mCode[ip+1]); + StringTableEntry fnName = U32toSTE(mCode[ip]); + U32 callType = mCode[ip+2]; Con::printf( "%i: OP_CALLFUNC name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, callType == FuncCallExprNode::FunctionCall ? "FunctionCall" @@ -1235,7 +1235,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_ADVANCE_STR_APPENDCHAR: { - char ch = code[ ip ]; + char ch = mCode[ ip ]; Con::printf( "%i: OP_ADVANCE_STR_APPENDCHAR char=%c", ip - 1, ch ); ++ ip; break; @@ -1285,7 +1285,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_ASSERT: { - const char* message = functionStrings + code[ ip ]; + const char* message = mFunctionStrings + mCode[ ip ]; Con::printf( "%i: OP_ASSERT message=%s", ip - 1, message ); ++ ip; break; @@ -1299,8 +1299,8 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_ITER_BEGIN: { - StringTableEntry varName = U32toSTE( code[ ip ] ); - U32 failIp = code[ ip + 1 ]; + StringTableEntry varName = U32toSTE( mCode[ ip ] ); + U32 failIp = mCode[ ip + 1 ]; Con::printf( "%i: OP_ITER_BEGIN varName=%s failIp=%i", varName, failIp ); @@ -1309,8 +1309,8 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_ITER_BEGIN_STR: { - StringTableEntry varName = U32toSTE( code[ ip ] ); - U32 failIp = code[ ip + 1 ]; + StringTableEntry varName = U32toSTE( mCode[ ip ] ); + U32 failIp = mCode[ ip + 1 ]; Con::printf( "%i: OP_ITER_BEGIN varName=%s failIp=%i", varName, failIp ); @@ -1319,7 +1319,7 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_ITER: { - U32 breakIp = code[ ip ]; + U32 breakIp = mCode[ ip ]; Con::printf( "%i: OP_ITER breakIp=%i", breakIp ); diff --git a/Engine/source/console/codeBlock.h b/Engine/source/console/codeBlock.h index bf09e79c7..9466ede62 100644 --- a/Engine/source/console/codeBlock.h +++ b/Engine/source/console/codeBlock.h @@ -60,28 +60,28 @@ public: CodeBlock(); ~CodeBlock(); - StringTableEntry name; - StringTableEntry fullPath; - StringTableEntry modPath; + StringTableEntry mName; + StringTableEntry mFullPath; + StringTableEntry mModPath; - char *globalStrings; - char *functionStrings; + char *mGlobalStrings; + char *mFunctionStrings; - U32 functionStringsMaxLen; - U32 globalStringsMaxLen; + U32 mFunctionStringsMaxLen; + U32 mGlobalStringsMaxLen; - F64 *globalFloats; - F64 *functionFloats; + F64 *mGlobalFloats; + F64 *mFunctionFloats; - U32 codeSize; - U32 *code; + U32 mCodeSize; + U32 *mCode; - U32 refCount; - U32 lineBreakPairCount; - U32 *lineBreakPairs; - U32 breakListSize; - U32 *breakList; - CodeBlock *nextFile; + U32 mRefCount; + U32 mLineBreakPairCount; + U32 *mLineBreakPairs; + U32 mBreakListSize; + U32 *mBreakList; + CodeBlock *mNextFile; void addToCodeList(); void removeFromCodeList(); diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 37f621997..379a2154a 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -422,8 +422,8 @@ const char *CodeBlock::exec(U32 ip, const char *functionName, Namespace *thisNam if(argv) { // assume this points into a function decl: - U32 fnArgc = code[ip + 5]; - thisFunctionName = U32toSTE(code[ip]); + U32 fnArgc = mCode[ip + 5]; + thisFunctionName = U32toSTE(mCode[ip]); argc = getMin(argc-1, fnArgc); // argv[0] is func name if(gEvalState.traceOn) { @@ -458,20 +458,20 @@ const char *CodeBlock::exec(U32 ip, const char *functionName, Namespace *thisNam popFrame = true; for(i = 0; i < argc; i++) { - StringTableEntry var = U32toSTE(code[ip + i + 6]); + StringTableEntry var = U32toSTE(mCode[ip + i + 6]); gEvalState.setCurVarNameCreate(var); gEvalState.setStringVariable(argv[i+1]); } ip = ip + fnArgc + 6; - curFloatTable = functionFloats; - curStringTable = functionStrings; - curStringTableLen = functionStringsMaxLen; + curFloatTable = mFunctionFloats; + curStringTable = mFunctionStrings; + curStringTableLen = mFunctionStringsMaxLen; } else { - curFloatTable = globalFloats; - curStringTable = globalStrings; - curStringTableLen = globalStringsMaxLen; + curFloatTable = mGlobalFloats; + curStringTable = mGlobalStrings; + curStringTableLen = mGlobalStringsMaxLen; // If requested stack frame isn't available, request a new one // (this prevents assert failures when creating local @@ -537,10 +537,10 @@ const char *CodeBlock::exec(U32 ip, const char *functionName, Namespace *thisNam CodeBlock *saveCodeBlock = smCurrentCodeBlock; smCurrentCodeBlock = this; - if(this->name) + if(this->mName) { - Con::gCurrentFile = this->name; - Con::gCurrentRoot = this->modPath; + Con::gCurrentFile = this->mName; + Con::gCurrentRoot = this->mModPath; } const char * val; @@ -551,7 +551,7 @@ const char *CodeBlock::exec(U32 ip, const char *functionName, Namespace *thisNam for(;;) { - U32 instruction = code[ip++]; + U32 instruction = mCode[ip++]; nsEntry = NULL; breakContinue: switch(instruction) @@ -559,11 +559,11 @@ breakContinue: case OP_FUNC_DECL: if(!noCalls) { - fnName = U32toSTE(code[ip]); - fnNamespace = U32toSTE(code[ip+1]); - fnPackage = U32toSTE(code[ip+2]); - bool hasBody = ( code[ ip + 3 ] & 0x01 ) != 0; - U32 lineNumber = code[ ip + 3 ] >> 1; + fnName = U32toSTE(mCode[ip]); + fnNamespace = U32toSTE(mCode[ip+1]); + fnPackage = U32toSTE(mCode[ip+2]); + bool hasBody = ( mCode[ ip + 3 ] & 0x01 ) != 0; + U32 lineNumber = mCode[ ip + 3 ] >> 1; Namespace::unlinkPackages(); ns = Namespace::find(fnNamespace, fnPackage); @@ -586,18 +586,18 @@ breakContinue: //Con::printf("Adding function %s::%s (%d)", fnNamespace, fnName, ip); } - ip = code[ip + 4]; + ip = mCode[ip + 4]; break; case OP_CREATE_OBJECT: { // Read some useful info. - objParent = U32toSTE(code[ip ]); - bool isDataBlock = code[ip + 1]; - bool isInternal = code[ip + 2]; - bool isSingleton = code[ip + 3]; - U32 lineNumber = code[ip + 4]; - failJump = code[ip + 5]; + objParent = U32toSTE(mCode[ip ]); + bool isDataBlock = mCode[ip + 1]; + bool isInternal = mCode[ip + 2]; + bool isSingleton = mCode[ip + 3]; + U32 lineNumber = mCode[ip + 4]; + failJump = mCode[ip + 5]; // If we don't allow calls, we certainly don't allow creating objects! // Moved this to after failJump is set. Engine was crashing when @@ -790,7 +790,7 @@ breakContinue: currentNewObject->setDeclarationLine(lineNumber); // Set the file that this object was created in - currentNewObject->setFilename(name); + currentNewObject->setFilename(mName); // Does it have a parent object? (ie, the copy constructor : syntax, not inheriance) if(*objParent) @@ -859,7 +859,7 @@ breakContinue: curNSDocBlock = NULL; // Do we place this object at the root? - bool placeAtRoot = code[ip++]; + bool placeAtRoot = mCode[ip++]; // Con::printf("Adding object %s", currentNewObject->getName()); @@ -962,7 +962,7 @@ breakContinue: { // If we're not to be placed at the root, make sure we clean up // our group reference. - bool placeAtRoot = code[ip++]; + bool placeAtRoot = mCode[ip++]; if(!placeAtRoot) _UINT--; break; @@ -983,7 +983,7 @@ breakContinue: ip++; break; } - ip = code[ip]; + ip = mCode[ip]; break; case OP_JMPIFNOT: if(intStack[_UINT--]) @@ -991,7 +991,7 @@ breakContinue: ip++; break; } - ip = code[ip]; + ip = mCode[ip]; break; case OP_JMPIFF: if(!floatStack[_FLT--]) @@ -999,7 +999,7 @@ breakContinue: ip++; break; } - ip = code[ip]; + ip = mCode[ip]; break; case OP_JMPIF: if(!intStack[_UINT--]) @@ -1007,7 +1007,7 @@ breakContinue: ip ++; break; } - ip = code[ip]; + ip = mCode[ip]; break; case OP_JMPIFNOT_NP: if(intStack[_UINT]) @@ -1016,7 +1016,7 @@ breakContinue: ip++; break; } - ip = code[ip]; + ip = mCode[ip]; break; case OP_JMPIF_NP: if(!intStack[_UINT]) @@ -1025,10 +1025,10 @@ breakContinue: ip++; break; } - ip = code[ip]; + ip = mCode[ip]; break; case OP_JMP: - ip = code[ip]; + ip = mCode[ip]; break; // This fixes a bug when not explicitly returning a value. @@ -1170,7 +1170,7 @@ breakContinue: break; case OP_SETCURVAR: - var = U32toSTE(code[ip]); + var = U32toSTE(mCode[ip]); ip++; // If a variable is set, then these must be NULL. It is necessary @@ -1190,7 +1190,7 @@ breakContinue: break; case OP_SETCURVAR_CREATE: - var = U32toSTE(code[ip]); + var = U32toSTE(mCode[ip]); ip++; // See OP_SETCURVAR @@ -1289,7 +1289,7 @@ breakContinue: if(set) { StringTableEntry intName = StringTable->insert(STR.getStringValue()); - bool recurse = code[ip-1]; + bool recurse = mCode[ip-1]; SimObject *obj = set->findObjectByInternalName(intName, recurse); intStack[_UINT+1] = obj ? obj->getId() : 0; _UINT++; @@ -1310,7 +1310,7 @@ breakContinue: // Save the previous field for parsing vector fields. prevField = curField; dStrcpy( prevFieldArray, curFieldArray ); - curField = U32toSTE(code[ip]); + curField = U32toSTE(mCode[ip]); curFieldArray[0] = 0; ip++; break; @@ -1321,7 +1321,7 @@ breakContinue: case OP_SETCURFIELD_TYPE: if(curObject) - curObject->setDataFieldType(code[ip], curField, curFieldArray); + curObject->setDataFieldType(mCode[ip], curField, curFieldArray); ip++; break; @@ -1449,34 +1449,34 @@ breakContinue: break; case OP_LOADIMMED_UINT: - intStack[_UINT+1] = code[ip++]; + intStack[_UINT+1] = mCode[ip++]; _UINT++; break; case OP_LOADIMMED_FLT: - floatStack[_FLT+1] = curFloatTable[code[ip]]; + floatStack[_FLT+1] = curFloatTable[mCode[ip]]; ip++; _FLT++; break; case OP_TAG_TO_STR: - code[ip-1] = OP_LOADIMMED_STR; + mCode[ip-1] = OP_LOADIMMED_STR; // it's possible the string has already been converted - if(U8(curStringTable[code[ip]]) != StringTagPrefixByte) + if(U8(curStringTable[mCode[ip]]) != StringTagPrefixByte) { - U32 id = GameAddTaggedString(curStringTable + code[ip]); - dSprintf(curStringTable + code[ip] + 1, 7, "%d", id); - *(curStringTable + code[ip]) = StringTagPrefixByte; + U32 id = GameAddTaggedString(curStringTable + mCode[ip]); + dSprintf(curStringTable + mCode[ip] + 1, 7, "%d", id); + *(curStringTable + mCode[ip]) = StringTagPrefixByte; } case OP_LOADIMMED_STR: - STR.setStringValue(curStringTable + code[ip++]); + STR.setStringValue(curStringTable + mCode[ip++]); break; case OP_DOCBLOCK_STR: { // If the first word of the doc is '\class' or '@class', then this // is a namespace doc block, otherwise it is a function doc block. - const char* docblock = curStringTable + code[ip++]; + const char* docblock = curStringTable + mCode[ip++]; const char* sansClass = dStrstr( docblock, "@class" ); if( !sansClass ) @@ -1504,13 +1504,13 @@ breakContinue: break; case OP_LOADIMMED_IDENT: - STR.setStringValue(U32toSTE(code[ip++])); + STR.setStringValue(U32toSTE(mCode[ip++])); break; case OP_CALLFUNC_RESOLVE: // This deals with a function that is potentially living in a namespace. - fnNamespace = U32toSTE(code[ip+1]); - fnName = U32toSTE(code[ip]); + fnNamespace = U32toSTE(mCode[ip+1]); + fnName = U32toSTE(mCode[ip]); // Try to look it up. ns = Namespace::find(fnNamespace); @@ -1535,7 +1535,7 @@ breakContinue: // or just on the object. S32 routingId = 0; - fnName = U32toSTE(code[ip]); + fnName = U32toSTE(mCode[ip]); //if this is called from inside a function, append the ip and codeptr if( gEvalState.getStackDepth() > 0 ) @@ -1544,7 +1544,7 @@ breakContinue: gEvalState.getCurrentFrame().ip = ip - 1; } - U32 callType = code[ip+2]; + U32 callType = mCode[ip+2]; ip += 3; STR.getArgcArgv(fnName, &callArgc, &callArgv); @@ -1682,19 +1682,19 @@ breakContinue: { S32 result = nsEntry->cb.mIntCallbackFunc(gEvalState.thisObject, callArgc, callArgv); STR.popFrame(); - if(code[ip] == OP_STR_TO_UINT) + if(mCode[ip] == OP_STR_TO_UINT) { ip++; intStack[++_UINT] = result; break; } - else if(code[ip] == OP_STR_TO_FLT) + else if(mCode[ip] == OP_STR_TO_FLT) { ip++; floatStack[++_FLT] = result; break; } - else if(code[ip] == OP_STR_TO_NONE) + else if(mCode[ip] == OP_STR_TO_NONE) ip++; else STR.setIntValue(result); @@ -1704,19 +1704,19 @@ breakContinue: { F64 result = nsEntry->cb.mFloatCallbackFunc(gEvalState.thisObject, callArgc, callArgv); STR.popFrame(); - if(code[ip] == OP_STR_TO_UINT) + if(mCode[ip] == OP_STR_TO_UINT) { ip++; intStack[++_UINT] = (S64)result; break; } - else if(code[ip] == OP_STR_TO_FLT) + else if(mCode[ip] == OP_STR_TO_FLT) { ip++; floatStack[++_FLT] = result; break; } - else if(code[ip] == OP_STR_TO_NONE) + else if(mCode[ip] == OP_STR_TO_NONE) ip++; else STR.setFloatValue(result); @@ -1724,7 +1724,7 @@ breakContinue: } case Namespace::Entry::VoidCallbackType: nsEntry->cb.mVoidCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - if( code[ ip ] != OP_STR_TO_NONE && Con::getBoolVariable( "$Con::warnVoidAssignment", true ) ) + if( mCode[ ip ] != OP_STR_TO_NONE && Con::getBoolVariable( "$Con::warnVoidAssignment", true ) ) Con::warnf(ConsoleLogEntry::General, "%s: Call to %s in %s uses result of void function call.", getFileLine(ip-4), fnName, functionName); STR.popFrame(); @@ -1734,19 +1734,19 @@ breakContinue: { bool result = nsEntry->cb.mBoolCallbackFunc(gEvalState.thisObject, callArgc, callArgv); STR.popFrame(); - if(code[ip] == OP_STR_TO_UINT) + if(mCode[ip] == OP_STR_TO_UINT) { ip++; intStack[++_UINT] = result; break; } - else if(code[ip] == OP_STR_TO_FLT) + else if(mCode[ip] == OP_STR_TO_FLT) { ip++; floatStack[++_FLT] = result; break; } - else if(code[ip] == OP_STR_TO_NONE) + else if(mCode[ip] == OP_STR_TO_NONE) ip++; else STR.setIntValue(result); @@ -1764,7 +1764,7 @@ breakContinue: STR.advance(); break; case OP_ADVANCE_STR_APPENDCHAR: - STR.advanceChar(code[ip++]); + STR.advanceChar(mCode[ip++]); break; case OP_ADVANCE_STR_COMMA: @@ -1798,13 +1798,13 @@ breakContinue: { if( !intStack[_UINT--] ) { - const char *message = curStringTable + code[ip]; + const char *message = curStringTable + mCode[ip]; U32 breakLine, inst; findBreakLine( ip - 1, breakLine, inst ); if ( PlatformAssert::processAssert( PlatformAssert::Fatal, - name ? name : "eval", + mName ? mName : "eval", breakLine, message ) ) { @@ -1844,8 +1844,8 @@ breakContinue: case OP_ITER_BEGIN: { - StringTableEntry varName = U32toSTE( code[ ip ] ); - U32 failIp = code[ ip + 1 ]; + StringTableEntry varName = U32toSTE( mCode[ ip ] ); + U32 failIp = mCode[ ip + 1 ]; IterStackRecord& iter = iterStack[ _ITER ]; @@ -1886,7 +1886,7 @@ breakContinue: case OP_ITER: { - U32 breakIp = code[ ip ]; + U32 breakIp = mCode[ ip ]; IterStackRecord& iter = iterStack[ _ITER - 1 ]; if( iter.mIsStringIter ) @@ -2001,18 +2001,18 @@ execFinished: } else { - delete[] globalStrings; - globalStringsMaxLen = 0; + delete[] mGlobalStrings; + mGlobalStringsMaxLen = 0; - delete[] globalFloats; - globalStrings = NULL; - globalFloats = NULL; + delete[] mGlobalFloats; + mGlobalStrings = NULL; + mGlobalFloats = NULL; } smCurrentCodeBlock = saveCodeBlock; - if(saveCodeBlock && saveCodeBlock->name) + if(saveCodeBlock && saveCodeBlock->mName) { - Con::gCurrentFile = saveCodeBlock->name; - Con::gCurrentRoot = saveCodeBlock->modPath; + Con::gCurrentFile = saveCodeBlock->mName; + Con::gCurrentRoot = saveCodeBlock->mModPath; } decRefCount(); diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 9ad66e627..f63d1a0df 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -2158,8 +2158,8 @@ DefineConsoleMethod( SimObject, dumpMethods, ArrayObject*, (),, str.append( e->getPrototypeString() ); str.append( '\n' ); - if( e->mCode && e->mCode->fullPath ) - str.append( e->mCode->fullPath ); + if( e->mCode && e->mCode->mFullPath ) + str.append( e->mCode->mFullPath ); str.append( '\n' ); if( e->mCode ) str.append( String::ToString( e->mFunctionLineNumber ) ); diff --git a/Engine/source/console/telnetDebugger.cpp b/Engine/source/console/telnetDebugger.cpp index 06b758d9a..ad058513a 100644 --- a/Engine/source/console/telnetDebugger.cpp +++ b/Engine/source/console/telnetDebugger.cpp @@ -382,7 +382,7 @@ void TelnetDebugger::executionStopped(CodeBlock *code, U32 lineNumber) return; } - Breakpoint **bp = findBreakpoint(code->name, lineNumber); + Breakpoint **bp = findBreakpoint(code->mName, lineNumber); if(!bp) return; @@ -396,7 +396,7 @@ void TelnetDebugger::executionStopped(CodeBlock *code, U32 lineNumber) { brk->curCount = 0; if(brk->clearOnHit) - removeBreakpoint(code->name, lineNumber); + removeBreakpoint(code->mName, lineNumber); breakProcess(); } } @@ -455,8 +455,8 @@ void TelnetDebugger::sendBreak() { CodeBlock *code = gEvalState.stack[i]->code; const char *file = ""; - if (code && code->name && code->name[0]) - file = code->name; + if (code && code->mName && code->mName[0]) + file = code->mName; Namespace *ns = gEvalState.stack[i]->scopeNamespace; scope[0] = 0; @@ -580,7 +580,7 @@ void TelnetDebugger::addAllBreakpoints(CodeBlock *code) { // TODO: This assumes that the OS file names are case // insensitive... Torque needs a dFilenameCmp() function. - if( dStricmp( cur->fileName, code->name ) == 0 ) + if( dStricmp( cur->fileName, code->mName ) == 0 ) { cur->code = code; @@ -774,7 +774,7 @@ void TelnetDebugger::setBreakOnNextStatement( bool enabled ) if ( enabled ) { // Apply breaks on all the code blocks. - for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile) + for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->mNextFile) walk->setAllBreaks(); mBreakOnNextStatement = true; } @@ -782,7 +782,7 @@ void TelnetDebugger::setBreakOnNextStatement( bool enabled ) { // Clear all the breaks on the codeblocks // then go reapply the breakpoints. - for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile) + for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->mNextFile) walk->clearAllBreaks(); for(Breakpoint *w = mBreakpoints; w; w = w->next) { @@ -878,10 +878,10 @@ void TelnetDebugger::evaluateExpression(const char *tag, S32 frame, const char * void TelnetDebugger::dumpFileList() { send("FILELISTOUT "); - for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile) + for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->mNextFile) { - send(walk->name); - if(walk->nextFile) + send(walk->mName); + if(walk->mNextFile) send(" "); } send("\r\n"); @@ -894,11 +894,11 @@ void TelnetDebugger::dumpBreakableList(const char *fileName) char buffer[MaxCommandSize]; if(file) { - dSprintf(buffer, MaxCommandSize, "BREAKLISTOUT %s %d", fileName, file->breakListSize >> 1); + dSprintf(buffer, MaxCommandSize, "BREAKLISTOUT %s %d", fileName, file->mBreakListSize >> 1); send(buffer); - for(U32 i = 0; i < file->breakListSize; i += 2) + for(U32 i = 0; i < file->mBreakListSize; i += 2) { - dSprintf(buffer, MaxCommandSize, " %d %d", file->breakList[i], file->breakList[i+1]); + dSprintf(buffer, MaxCommandSize, " %d %d", file->mBreakList[i], file->mBreakList[i+1]); send(buffer); } send("\r\n"); From aefa7960567c1c55f79f53c811676459c7e4eb25 Mon Sep 17 00:00:00 2001 From: bank Date: Mon, 12 May 2014 18:20:59 +0400 Subject: [PATCH 02/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class AppMesh --- Engine/source/ts/collada/colladaAppMesh.cpp | 110 +++++++++--------- .../source/ts/collada/colladaShapeLoader.cpp | 4 +- Engine/source/ts/loader/appMesh.cpp | 102 ++++++++-------- Engine/source/ts/loader/appMesh.h | 44 +++---- Engine/source/ts/loader/tsShapeLoader.cpp | 102 ++++++++-------- 5 files changed, 181 insertions(+), 181 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index c4036fbe9..8b4836d4a 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -319,17 +319,17 @@ public: ColladaAppMesh::ColladaAppMesh(const domInstance_geometry* instance, ColladaAppNode* node) : instanceGeom(instance), instanceCtrl(0), appNode(node), geomExt(0) { - flags = 0; - numFrames = 0; - numMatFrames = 0; + mFlags = 0; + mNumFrames = 0; + mNumMatFrames = 0; } ColladaAppMesh::ColladaAppMesh(const domInstance_controller* instance, ColladaAppNode* node) : instanceGeom(0), instanceCtrl(instance), appNode(node), geomExt(0) { - flags = 0; - numFrames = 0; - numMatFrames = 0; + mFlags = 0; + mNumFrames = 0; + mNumMatFrames = 0; } const char* ColladaAppMesh::getName(bool allowFixed) @@ -367,8 +367,8 @@ bool ColladaAppMesh::animatesMatFrame(const AppSequence* appSeq) // - by animating the morph weights for morph targets with different UVs // Check if the MAYA profile texture transform is animated - for (S32 iMat = 0; iMat < appMaterials.size(); iMat++) { - ColladaAppMaterial* appMat = static_cast(appMaterials[iMat]); + for (S32 iMat = 0; iMat < mAppMaterials.size(); iMat++) { + ColladaAppMaterial* appMat = static_cast(mAppMaterials[iMat]); if (appMat->effectExt && appMat->effectExt->animatesTextureTransform(appSeq->getStart(), appSeq->getEnd())) return true; @@ -446,17 +446,17 @@ S32 ColladaAppMesh::addMaterial(const char* symbol) // Find the index of the bound material in the shape global list const domMaterial* mat = daeSafeCast(matArray[iBind]->getTarget().getElement()); - for (matIndex = 0; matIndex < appMaterials.size(); matIndex++) { - if (static_cast(appMaterials[matIndex])->mat == mat) + for (matIndex = 0; matIndex < mAppMaterials.size(); matIndex++) { + if (static_cast(mAppMaterials[matIndex])->mat == mat) break; } // Check if this material needs to be added to the shape global list - if (matIndex == appMaterials.size()) { + if (matIndex == mAppMaterials.size()) { if (mat) - appMaterials.push_back(new ColladaAppMaterial(mat)); + mAppMaterials.push_back(new ColladaAppMaterial(mat)); else - appMaterials.push_back(new ColladaAppMaterial(symbol)); + mAppMaterials.push_back(new ColladaAppMaterial(symbol)); } break; @@ -466,7 +466,7 @@ S32 ColladaAppMesh::addMaterial(const char* symbol) else { // No Collada material is present for this symbol, so just create an empty one - appMaterials.push_back(new ColladaAppMaterial(symbol)); + mAppMaterials.push_back(new ColladaAppMaterial(symbol)); } // Add this symbol to the bound list for the mesh @@ -477,7 +477,7 @@ S32 ColladaAppMesh::addMaterial(const char* symbol) void ColladaAppMesh::getPrimitives(const domGeometry* geometry) { // Only do this once - if (primitives.size()) + if (mPrimitives.size()) return; // Read the extension @@ -517,16 +517,16 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) continue; // Create TSMesh primitive - primitives.increment(); - TSDrawPrimitive& primitive = primitives.last(); - primitive.start = indices.size(); + mPrimitives.increment(); + TSDrawPrimitive& primitive = mPrimitives.last(); + primitive.start = mIndices.size(); primitive.matIndex = (TSDrawPrimitive::Triangles | TSDrawPrimitive::Indexed) | addMaterial(meshPrims[iPrim]->getMaterial()); // Get the AppMaterial associated with this primitive ColladaAppMaterial* appMat = 0; if (!(primitive.matIndex & TSDrawPrimitive::NoMaterial)) - appMat = static_cast(appMaterials[primitive.matIndex & TSDrawPrimitive::MaterialMask]); + appMat = static_cast(mAppMaterials[primitive.matIndex & TSDrawPrimitive::MaterialMask]); // Force the material to be double-sided if this geometry is double-sided. if (geomExt->double_sided && appMat && appMat->effectExt) @@ -534,8 +534,8 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) // Pre-allocate triangle indices primitive.numElements = numTriangles * 3; - indices.setSize(indices.size() + primitive.numElements); - U32* dstIndex = indices.end() - primitive.numElements; + mIndices.setSize(mIndices.size() + primitive.numElements); + U32* dstIndex = mIndices.end() - primitive.numElements; // Determine the offset for each element type in the stream, and also the // maximum input offset, which will be the number of indices per vertex we @@ -569,12 +569,12 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) daeErrorHandler::get()->handleWarning(avar("Splitting primitive " "in %s: too many verts for 16-bit indices.", _GetNameOrId(geometry))); - primitives.last().numElements -= indicesRemaining; - primitives.push_back(TSDrawPrimitive(primitives.last())); + mPrimitives.last().numElements -= indicesRemaining; + mPrimitives.push_back(TSDrawPrimitive(mPrimitives.last())); } - primitives.last().numElements = indicesRemaining; - primitives.last().start = indices.size() - indicesRemaining; + mPrimitives.last().numElements = indicesRemaining; + mPrimitives.last().start = mIndices.size() - indicesRemaining; tupleMap.clear(); } @@ -631,7 +631,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const Vector& v_uv2s, bool appendValues) { - if (!primitives.size()) + if (!mPrimitives.size()) return; MeshStreams streams; @@ -676,7 +676,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const streams.readInputs(meshPrims[tuple.prim]->getInputs()); S32 matIndex = addMaterial(meshPrims[tuple.prim]->getMaterial()); if (matIndex != TSDrawPrimitive::NoMaterial) - appMat = static_cast(appMaterials[matIndex]); + appMat = static_cast(mAppMaterials[matIndex]); else appMat = 0; @@ -923,10 +923,10 @@ void ColladaAppMesh::lockMesh(F32 t, const MatrixF& objectOffset) // Now get the vertex data at the specified time if (geometry->getElementType() == COLLADA_TYPE::GEOMETRY) { getPrimitives(daeSafeCast(geometry)); - getVertexData(daeSafeCast(geometry), t, objectOffset, points, normals, colors, uvs, uv2s, true); + getVertexData(daeSafeCast(geometry), t, objectOffset, mPoints, mNormals, mColors, mUVs, mUV2s, true); } else if (geometry->getElementType() == COLLADA_TYPE::MORPH) { - getMorphVertexData(daeSafeCast(geometry), t, objectOffset, points, normals, colors, uvs, uv2s); + getMorphVertexData(daeSafeCast(geometry), t, objectOffset, mPoints, mNormals, mColors, mUVs, mUV2s); } else { daeErrorHandler::get()->handleWarning(avar("Unsupported geometry type " @@ -937,7 +937,7 @@ void ColladaAppMesh::lockMesh(F32 t, const MatrixF& objectOffset) void ColladaAppMesh::lookupSkinData() { // Only lookup skin data once - if (!isSkin() || weight.size()) + if (!isSkin() || mWeight.size()) return; // Get the skin and vertex weight data @@ -950,7 +950,7 @@ void ColladaAppMesh::lookupSkinData() streams.readInputs(skin->getJoints()->getInput_array()); streams.readInputs(weightIndices.getInput_array()); - MatrixF invObjOffset(objectOffset); + MatrixF invObjOffset(mObjectOffset); invObjOffset.inverse(); // Get the bind shape matrix @@ -971,7 +971,7 @@ void ColladaAppMesh::lookupSkinData() // Set vertex weights bool tooManyWeightsWarning = false; - for (S32 iVert = 0; iVert < vertsPerFrame; iVert++) { + for (S32 iVert = 0; iVert < mVertsPerFrame; iVert++) { const domUint* vcount = (domUint*)weights_vcount.getRaw(0); const domInt* vindices = (domInt*)weights_v.getRaw(0); vindices += vindicesOffset[vertTuples[iVert].vertex]; @@ -1002,25 +1002,25 @@ void ColladaAppMesh::lookupSkinData() } // Too many weights => find and replace the smallest one - S32 minIndex = weight.size() - TSSkinMesh::BatchData::maxBonePerVert; - F32 minWeight = weight[minIndex]; - for (S32 i = minIndex + 1; i < weight.size(); i++) + S32 minIndex = mWeight.size() - TSSkinMesh::BatchData::maxBonePerVert; + F32 minWeight = mWeight[minIndex]; + for (S32 i = minIndex + 1; i < mWeight.size(); i++) { - if (weight[i] < minWeight) + if (mWeight[i] < minWeight) { - minWeight = weight[i]; + minWeight = mWeight[i]; minIndex = i; } } - boneIndex[minIndex] = bIndex; - weight[minIndex] = bWeight; + mBoneIndex[minIndex] = bIndex; + mWeight[minIndex] = bWeight; } else { - vertexIndex.push_back( iVert ); - boneIndex.push_back( bIndex ); - weight.push_back( bWeight ); + mVertexIndex.push_back( iVert ); + mBoneIndex.push_back( bIndex ); + mWeight.push_back( bWeight ); nonZeroWeightCount++; } } @@ -1028,26 +1028,26 @@ void ColladaAppMesh::lookupSkinData() // Normalize vertex weights (force weights for each vert to sum to 1) S32 iWeight = 0; - while (iWeight < weight.size()) { + while (iWeight < mWeight.size()) { // Find the last weight with the same vertex number, and sum all weights for // that vertex F32 invTotalWeight = 0; S32 iLast; - for (iLast = iWeight; iLast < weight.size(); iLast++) { - if (vertexIndex[iLast] != vertexIndex[iWeight]) + for (iLast = iWeight; iLast < mWeight.size(); iLast++) { + if (mVertexIndex[iLast] != mVertexIndex[iWeight]) break; - invTotalWeight += weight[iLast]; + invTotalWeight += mWeight[iLast]; } // Then normalize the vertex weights invTotalWeight = 1.0f / invTotalWeight; for (; iWeight < iLast; iWeight++) - weight[iWeight] *= invTotalWeight; + mWeight[iWeight] *= invTotalWeight; } // Add dummy AppNodes to allow Collada joints to be mapped to 3space nodes - bones.setSize(streams.joints.size()); - initialTransforms.setSize(streams.joints.size()); + mBones.setSize(streams.joints.size()); + mInitialTransforms.setSize(streams.joints.size()); for (S32 iJoint = 0; iJoint < streams.joints.size(); iJoint++) { const char* jointName = streams.joints.getStringValue(iJoint); @@ -1075,9 +1075,9 @@ void ColladaAppMesh::lookupSkinData() "defaulting to instance_controller parent node '%s'", jointName, appNode->getName())); joint = appNode->getDomNode(); } - bones[iJoint] = new ColladaAppNode(joint); + mBones[iJoint] = new ColladaAppNode(joint); - initialTransforms[iJoint] = objectOffset; + mInitialTransforms[iJoint] = mObjectOffset; // Bone scaling is generally ignored during import, since 3space only // stores default node transform and rotation. Compensate for this by @@ -1089,16 +1089,16 @@ void ColladaAppMesh::lookupSkinData() invScale.x = invScale.x ? (1.0f / invScale.x) : 0; invScale.y = invScale.y ? (1.0f / invScale.y) : 0; invScale.z = invScale.z ? (1.0f / invScale.z) : 0; - initialTransforms[iJoint].scale(invScale); + mInitialTransforms[iJoint].scale(invScale); } // Inverted node coordinate spaces (negative scale factor) are corrected // in ColladaAppNode::getNodeTransform, so need to apply the same operation // here to match if (m_matF_determinant(invBind) < 0.0f) - initialTransforms[iJoint].scale(Point3F(1, 1, -1)); + mInitialTransforms[iJoint].scale(Point3F(1, 1, -1)); - initialTransforms[iJoint].mul(invBind); - initialTransforms[iJoint].mul(bindShapeMatrix); + mInitialTransforms[iJoint].mul(invBind); + mInitialTransforms[iJoint].mul(bindShapeMatrix); } } diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index 219b07459..07d2b7a40 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -458,9 +458,9 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false) // First see what materials we need to update PersistenceManager persistMgr; - for ( U32 iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++ ) + for ( U32 iMat = 0; iMat < AppMesh::mAppMaterials.size(); iMat++ ) { - ColladaAppMaterial *mat = dynamic_cast( AppMesh::appMaterials[iMat] ); + ColladaAppMaterial *mat = dynamic_cast( AppMesh::mAppMaterials[iMat] ); if ( mat ) { Material *mappedMat; diff --git a/Engine/source/ts/loader/appMesh.cpp b/Engine/source/ts/loader/appMesh.cpp index 8db105689..749431eb0 100644 --- a/Engine/source/ts/loader/appMesh.cpp +++ b/Engine/source/ts/loader/appMesh.cpp @@ -23,10 +23,10 @@ #include "ts/loader/appMesh.h" #include "ts/loader/tsShapeLoader.h" -Vector AppMesh::appMaterials; +Vector AppMesh::mAppMaterials; AppMesh::AppMesh() - : flags(0), numFrames(0), numMatFrames(0), vertsPerFrame(0) + : mFlags(0), mNumFrames(0), mNumMatFrames(0), mVertsPerFrame(0) { } @@ -44,43 +44,43 @@ void AppMesh::computeBounds(Box3F& bounds) // Setup bone transforms Vector boneTransforms; - boneTransforms.setSize( nodeIndex.size() ); + boneTransforms.setSize( mNodeIndex.size() ); for (S32 iBone = 0; iBone < boneTransforms.size(); iBone++) { - MatrixF nodeMat = bones[iBone]->getNodeTransform( TSShapeLoader::DefaultTime ); + MatrixF nodeMat = mBones[iBone]->getNodeTransform( TSShapeLoader::DefaultTime ); TSShapeLoader::zapScale(nodeMat); - boneTransforms[iBone].mul( nodeMat, initialTransforms[iBone] ); + boneTransforms[iBone].mul( nodeMat, mInitialTransforms[iBone] ); } // Multiply verts by weighted bone transforms - for (S32 iVert = 0; iVert < initialVerts.size(); iVert++) - points[iVert].set( Point3F::Zero ); + for (S32 iVert = 0; iVert < mInitialVerts.size(); iVert++) + mPoints[iVert].set( Point3F::Zero ); - for (S32 iWeight = 0; iWeight < vertexIndex.size(); iWeight++) + for (S32 iWeight = 0; iWeight < mVertexIndex.size(); iWeight++) { - const S32& vertIndex = vertexIndex[iWeight]; - const MatrixF& deltaTransform = boneTransforms[ boneIndex[iWeight] ]; + const S32& vertIndex = mVertexIndex[iWeight]; + const MatrixF& deltaTransform = boneTransforms[ mBoneIndex[iWeight] ]; Point3F v; - deltaTransform.mulP( initialVerts[vertIndex], &v ); - v *= weight[iWeight]; + deltaTransform.mulP( mInitialVerts[vertIndex], &v ); + v *= mWeight[iWeight]; - points[vertIndex] += v; + mPoints[vertIndex] += v; } // compute bounds for the skinned mesh - for (S32 iVert = 0; iVert < initialVerts.size(); iVert++) - bounds.extend( points[iVert] ); + for (S32 iVert = 0; iVert < mInitialVerts.size(); iVert++) + bounds.extend( mPoints[iVert] ); } else { MatrixF transform = getMeshTransform(TSShapeLoader::DefaultTime); TSShapeLoader::zapScale(transform); - for (S32 iVert = 0; iVert < points.size(); iVert++) + for (S32 iVert = 0; iVert < mPoints.size(); iVert++) { Point3F p; - transform.mulP(points[iVert], &p); + transform.mulP(mPoints[iVert], &p); bounds.extend(p); } } @@ -89,39 +89,39 @@ void AppMesh::computeBounds(Box3F& bounds) void AppMesh::computeNormals() { // Clear normals - normals.setSize( points.size() ); - for (S32 iNorm = 0; iNorm < normals.size(); iNorm++) - normals[iNorm] = Point3F::Zero; + mNormals.setSize( mPoints.size() ); + for (S32 iNorm = 0; iNorm < mNormals.size(); iNorm++) + mNormals[iNorm] = Point3F::Zero; // Sum triangle normals for each vertex - for (S32 iPrim = 0; iPrim < primitives.size(); iPrim++) + for (S32 iPrim = 0; iPrim < mPrimitives.size(); iPrim++) { - const TSDrawPrimitive& prim = primitives[iPrim]; + const TSDrawPrimitive& prim = mPrimitives[iPrim]; for (S32 iInd = 0; iInd < prim.numElements; iInd += 3) { // Compute the normal for this triangle - S32 idx0 = indices[prim.start + iInd + 0]; - S32 idx1 = indices[prim.start + iInd + 1]; - S32 idx2 = indices[prim.start + iInd + 2]; + S32 idx0 = mIndices[prim.start + iInd + 0]; + S32 idx1 = mIndices[prim.start + iInd + 1]; + S32 idx2 = mIndices[prim.start + iInd + 2]; - const Point3F& v0 = points[idx0]; - const Point3F& v1 = points[idx1]; - const Point3F& v2 = points[idx2]; + const Point3F& v0 = mPoints[idx0]; + const Point3F& v1 = mPoints[idx1]; + const Point3F& v2 = mPoints[idx2]; Point3F n; mCross(v2 - v0, v1 - v0, &n); n.normalize(); // remove this to use 'weighted' normals (large triangles will have more effect) - normals[idx0] += n; - normals[idx1] += n; - normals[idx2] += n; + mNormals[idx0] += n; + mNormals[idx1] += n; + mNormals[idx2] += n; } } // Normalize the vertex normals (this takes care of averaging the triangle normals) - for (S32 iNorm = 0; iNorm < normals.size(); iNorm++) - normals[iNorm].normalize(); + for (S32 iNorm = 0; iNorm < mNormals.size(); iNorm++) + mNormals[iNorm].normalize(); } TSMesh* AppMesh::constructTSMesh() @@ -133,13 +133,13 @@ TSMesh* AppMesh::constructTSMesh() tsmesh = tsskin; // Copy skin elements - tsskin->weight = weight; - tsskin->boneIndex = boneIndex; - tsskin->vertexIndex = vertexIndex; - tsskin->batchData.nodeIndex = nodeIndex; - tsskin->batchData.initialTransforms = initialTransforms; - tsskin->batchData.initialVerts = initialVerts; - tsskin->batchData.initialNorms = initialNorms; + tsskin->weight = mWeight; + tsskin->boneIndex = mBoneIndex; + tsskin->vertexIndex = mVertexIndex; + tsskin->batchData.nodeIndex = mNodeIndex; + tsskin->batchData.initialTransforms = mInitialTransforms; + tsskin->batchData.initialVerts = mInitialVerts; + tsskin->batchData.initialNorms = mInitialNorms; } else { @@ -147,20 +147,20 @@ TSMesh* AppMesh::constructTSMesh() } // Copy mesh elements - tsmesh->verts = points; - tsmesh->norms = normals; - tsmesh->tverts = uvs; - tsmesh->primitives = primitives; - tsmesh->indices = indices; - tsmesh->colors = colors; - tsmesh->tverts2 = uv2s; + tsmesh->verts = mPoints; + tsmesh->norms = mNormals; + tsmesh->tverts = mUVs; + tsmesh->primitives = mPrimitives; + tsmesh->indices = mIndices; + tsmesh->colors = mColors; + tsmesh->tverts2 = mUV2s; // Finish initializing the shape - tsmesh->setFlags(flags); + tsmesh->setFlags(mFlags); tsmesh->computeBounds(); - tsmesh->numFrames = numFrames; - tsmesh->numMatFrames = numMatFrames; - tsmesh->vertsPerFrame = vertsPerFrame; + tsmesh->numFrames = mNumFrames; + tsmesh->numMatFrames = mNumMatFrames; + tsmesh->vertsPerFrame = mVertsPerFrame; tsmesh->createTangents(tsmesh->verts, tsmesh->norms); tsmesh->encodedNorms.set(NULL,0); diff --git a/Engine/source/ts/loader/appMesh.h b/Engine/source/ts/loader/appMesh.h index dc6b193c6..784660901 100644 --- a/Engine/source/ts/loader/appMesh.h +++ b/Engine/source/ts/loader/appMesh.h @@ -42,33 +42,33 @@ class AppMesh { public: // Mesh and skin elements - Vector points; - Vector normals; - Vector uvs; - Vector uv2s; - Vector colors; - Vector primitives; - Vector indices; + Vector mPoints; + Vector mNormals; + Vector mUVs; + Vector mUV2s; + Vector mColors; + Vector mPrimitives; + Vector mIndices; // Skin elements - Vector weight; - Vector boneIndex; - Vector vertexIndex; - Vector nodeIndex; - Vector initialTransforms; - Vector initialVerts; - Vector initialNorms; + Vector mWeight; + Vector mBoneIndex; + Vector mVertexIndex; + Vector mNodeIndex; + Vector mInitialTransforms; + Vector mInitialVerts; + Vector mInitialNorms; - U32 flags; - U32 vertsPerFrame; - S32 numFrames; - S32 numMatFrames; + U32 mFlags; + U32 mVertsPerFrame; + S32 mNumFrames; + S32 mNumMatFrames; // Loader elements (can be discarded after loading) - S32 detailSize; - MatrixF objectOffset; - Vector bones; - static Vector appMaterials; + S32 mDetailSize; + MatrixF mObjectOffset; + Vector mBones; + static Vector mAppMaterials; public: AppMesh(); diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index a1b1b4ac4..8b01afab0 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -377,7 +377,7 @@ bool cmpMeshNameAndSize(const String& key, const Vector& names, void* ar { if (names[i].compare(key, 0, String::NoCase) == 0) { - if (meshes[i]->detailSize == meshSize) + if (meshes[i]->mDetailSize == meshSize) return false; } } @@ -396,17 +396,17 @@ void TSShapeLoader::generateObjects() for (S32 iMesh = 0; iMesh < subshape->objMeshes.size(); iMesh++) { AppMesh* mesh = subshape->objMeshes[iMesh]; - mesh->detailSize = 2; - String name = String::GetTrailingNumber( mesh->getName(), mesh->detailSize ); - name = getUniqueName( name, cmpMeshNameAndSize, meshNames, &(subshape->objMeshes), (void*)mesh->detailSize ); + mesh->mDetailSize = 2; + String name = String::GetTrailingNumber( mesh->getName(), mesh->mDetailSize ); + name = getUniqueName( name, cmpMeshNameAndSize, meshNames, &(subshape->objMeshes), (void*)mesh->mDetailSize ); meshNames.push_back( name ); // Fix up any collision details that don't have a negative detail level. if ( dStrStartsWith(meshNames[iMesh], "Collision") || dStrStartsWith(meshNames[iMesh], "LOSCol") ) { - if (mesh->detailSize > 0) - mesh->detailSize = -mesh->detailSize; + if (mesh->mDetailSize > 0) + mesh->mDetailSize = -mesh->mDetailSize; } } @@ -421,7 +421,7 @@ void TSShapeLoader::generateObjects() { if ((meshNames[i].compare(meshNames[j]) < 0) || ((meshNames[i].compare(meshNames[j]) == 0) && - (subshape->objMeshes[i]->detailSize < subshape->objMeshes[j]->detailSize))) + (subshape->objMeshes[i]->mDetailSize < subshape->objMeshes[j]->mDetailSize))) { { AppMesh* tmp = subshape->objMeshes[i]; @@ -463,17 +463,17 @@ void TSShapeLoader::generateObjects() shape->objects.last().numMeshes++; // Set mesh flags - mesh->flags = 0; + mesh->mFlags = 0; if (mesh->isBillboard()) { - mesh->flags |= TSMesh::Billboard; + mesh->mFlags |= TSMesh::Billboard; if (mesh->isBillboardZAxis()) - mesh->flags |= TSMesh::BillboardZAxis; + mesh->mFlags |= TSMesh::BillboardZAxis; } // Set the detail name... do fixups for collision details. const char* detailName = "detail"; - if ( mesh->detailSize < 0 ) + if ( mesh->mDetailSize < 0 ) { if ( dStrStartsWith(meshNames[iMesh], "Collision") || dStrStartsWith(meshNames[iMesh], "Col") ) @@ -484,11 +484,11 @@ void TSShapeLoader::generateObjects() // Attempt to add the detail (will fail if it already exists) S32 oldNumDetails = shape->details.size(); - shape->addDetail(detailName, mesh->detailSize, iSub); + shape->addDetail(detailName, mesh->mDetailSize, iSub); if (shape->details.size() > oldNumDetails) { Con::warnf("Object mesh \"%s\" has no matching detail (\"%s%d\" has" - " been added automatically)", mesh->getName(false), detailName, mesh->detailSize); + " been added automatically)", mesh->getName(false), detailName, mesh->mDetailSize); } } @@ -519,30 +519,30 @@ void TSShapeLoader::generateSkins() skin->lookupSkinData(); // Just copy initial verts and norms for now - skin->initialVerts.set(skin->points.address(), skin->vertsPerFrame); - skin->initialNorms.set(skin->normals.address(), skin->vertsPerFrame); + skin->mInitialVerts.set(skin->mPoints.address(), skin->mVertsPerFrame); + skin->mInitialNorms.set(skin->mNormals.address(), skin->mVertsPerFrame); // Map bones to nodes - skin->nodeIndex.setSize(skin->bones.size()); - for (S32 iBone = 0; iBone < skin->bones.size(); iBone++) + skin->mNodeIndex.setSize(skin->mBones.size()); + for (S32 iBone = 0; iBone < skin->mBones.size(); iBone++) { // Find the node that matches this bone - skin->nodeIndex[iBone] = -1; + skin->mNodeIndex[iBone] = -1; for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { - if (appNodes[iNode]->isEqual(skin->bones[iBone])) + if (appNodes[iNode]->isEqual(skin->mBones[iBone])) { - delete skin->bones[iBone]; - skin->bones[iBone] = appNodes[iNode]; - skin->nodeIndex[iBone] = iNode; + delete skin->mBones[iBone]; + skin->mBones[iBone] = appNodes[iNode]; + skin->mNodeIndex[iBone] = iNode; break; } } - if (skin->nodeIndex[iBone] == -1) + if (skin->mNodeIndex[iBone] == -1) { Con::warnf("Could not find bone %d. Defaulting to first node", iBone); - skin->nodeIndex[iBone] = 0; + skin->mNodeIndex[iBone] = 0; } } } @@ -569,7 +569,7 @@ void TSShapeLoader::generateDefaultStates() zapScale(nodeMat); - appMesh->objectOffset = nodeMat.inverse() * meshMat; + appMesh->mObjectOffset = nodeMat.inverse() * meshMat; } generateObjectState(shape->objects[iObject], DefaultTime, true, true); @@ -603,8 +603,8 @@ void TSShapeLoader::generateObjectState(TSShape::Object& obj, F32 t, bool addFra generateFrame(obj, t, addFrame, addMatFrame); // set the frame number for the object state - state.frameIndex = appMeshes[obj.startMeshIndex]->numFrames - 1; - state.matFrameIndex = appMeshes[obj.startMeshIndex]->numMatFrames - 1; + state.frameIndex = appMeshes[obj.startMeshIndex]->mNumFrames - 1; + state.matFrameIndex = appMeshes[obj.startMeshIndex]->mNumMatFrames - 1; } } @@ -614,45 +614,45 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo { AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; - U32 oldNumPoints = appMesh->points.size(); - U32 oldNumUvs = appMesh->uvs.size(); + U32 oldNumPoints = appMesh->mPoints.size(); + U32 oldNumUvs = appMesh->mUVs.size(); // Get the mesh geometry at time, 't' // Geometry verts, normals and tverts can be animated (different set for // each frame), but the TSDrawPrimitives stay the same, so the way lockMesh // works is that it will only generate the primitives once, then after that // will just append verts, normals and tverts each time it is called. - appMesh->lockMesh(t, appMesh->objectOffset); + appMesh->lockMesh(t, appMesh->mObjectOffset); // Calculate vertex normals if required - if (appMesh->normals.size() != appMesh->points.size()) + if (appMesh->mNormals.size() != appMesh->mPoints.size()) appMesh->computeNormals(); // If this is the first call, set the number of points per frame - if (appMesh->numFrames == 0) + if (appMesh->mNumFrames == 0) { - appMesh->vertsPerFrame = appMesh->points.size(); + appMesh->mVertsPerFrame = appMesh->mPoints.size(); } else { // Check frame topology => ie. that the right number of points, normals // and tverts was added - if ((appMesh->points.size() - oldNumPoints) != appMesh->vertsPerFrame) + if ((appMesh->mPoints.size() - oldNumPoints) != appMesh->mVertsPerFrame) { Con::warnf("Wrong number of points (%d) added at time=%f (expected %d)", - appMesh->points.size() - oldNumPoints, t, appMesh->vertsPerFrame); + appMesh->mPoints.size() - oldNumPoints, t, appMesh->mVertsPerFrame); addFrame = false; } - if ((appMesh->normals.size() - oldNumPoints) != appMesh->vertsPerFrame) + if ((appMesh->mNormals.size() - oldNumPoints) != appMesh->mVertsPerFrame) { Con::warnf("Wrong number of normals (%d) added at time=%f (expected %d)", - appMesh->normals.size() - oldNumPoints, t, appMesh->vertsPerFrame); + appMesh->mNormals.size() - oldNumPoints, t, appMesh->mVertsPerFrame); addFrame = false; } - if ((appMesh->uvs.size() - oldNumUvs) != appMesh->vertsPerFrame) + if ((appMesh->mUVs.size() - oldNumUvs) != appMesh->mVertsPerFrame) { Con::warnf("Wrong number of tverts (%d) added at time=%f (expected %d)", - appMesh->uvs.size() - oldNumUvs, t, appMesh->vertsPerFrame); + appMesh->mUVs.size() - oldNumUvs, t, appMesh->mVertsPerFrame); addMatFrame = false; } } @@ -663,21 +663,21 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo // points/normals/tverts are already in place! if (addFrame) { - appMesh->numFrames++; + appMesh->mNumFrames++; } else { - appMesh->points.setSize(oldNumPoints); - appMesh->normals.setSize(oldNumPoints); + appMesh->mPoints.setSize(oldNumPoints); + appMesh->mNormals.setSize(oldNumPoints); } if (addMatFrame) { - appMesh->numMatFrames++; + appMesh->mNumMatFrames++; } else { - appMesh->uvs.setSize(oldNumPoints); + appMesh->mUVs.setSize(oldNumPoints); } } } @@ -690,11 +690,11 @@ void TSShapeLoader::generateMaterialList() { // Install the materials into the material list shape->materialList = new TSMaterialList; - for (S32 iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++) + for (S32 iMat = 0; iMat < AppMesh::mAppMaterials.size(); iMat++) { - updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::appMaterials.size(), iMat); + updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::mAppMaterials.size(), iMat); - AppMaterial* appMat = AppMesh::appMaterials[iMat]; + AppMaterial* appMat = AppMesh::mAppMaterials[iMat]; shape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); } } @@ -1119,7 +1119,7 @@ void TSShapeLoader::sortDetails() // object does not already have a mesh with an equal or higher detail) S32 meshIndex = (iDet < object.numMeshes) ? iDet : object.numMeshes-1; - if (appMeshes[object.startMeshIndex + meshIndex]->detailSize < shape->details[iDet].size) + if (appMeshes[object.startMeshIndex + meshIndex]->mDetailSize < shape->details[iDet].size) { // Add a NULL mesh appMeshes.insert(object.startMeshIndex + iDet, NULL); @@ -1256,9 +1256,9 @@ TSShapeLoader::~TSShapeLoader() clearNodeTransformCache(); // Clear shared AppMaterial list - for (S32 iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++) - delete AppMesh::appMaterials[iMat]; - AppMesh::appMaterials.clear(); + for (S32 iMat = 0; iMat < AppMesh::mAppMaterials.size(); iMat++) + delete AppMesh::mAppMaterials[iMat]; + AppMesh::mAppMaterials.clear(); // Delete Subshapes delete boundsNode; From 9e3eab75518bd6bfe63cc72f367bb45687a785e3 Mon Sep 17 00:00:00 2001 From: bank Date: Mon, 12 May 2014 18:32:39 +0400 Subject: [PATCH 03/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - struct VertTuple (used in class ColladaAppMesh) --- Engine/source/ts/collada/colladaAppMesh.cpp | 60 ++++++++++----------- Engine/source/ts/collada/colladaAppMesh.h | 20 +++---- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index 8b4836d4a..839fdc0a0 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -49,7 +49,7 @@ namespace DictHash { inline U32 hash(const VertTuple& data) { - return (U32)data.vertex; + return (U32)data.mVertex; } } @@ -586,18 +586,18 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) // Collect vert tuples into a single array so we can easily grab // vertex data later. VertTuple tuple; - tuple.prim = iPrim; - tuple.vertex = offsets[MeshStreams::Points] >= 0 ? pSrcData[offsets[MeshStreams::Points]] : -1; - tuple.normal = offsets[MeshStreams::Normals] >= 0 ? pSrcData[offsets[MeshStreams::Normals]] : -1; - tuple.color = offsets[MeshStreams::Colors] >= 0 ? pSrcData[offsets[MeshStreams::Colors]] : -1; - tuple.uv = offsets[MeshStreams::UVs] >= 0 ? pSrcData[offsets[MeshStreams::UVs]] : -1; - tuple.uv2 = offsets[MeshStreams::UV2s] >= 0 ? pSrcData[offsets[MeshStreams::UV2s]] : -1; + tuple.mPrim = iPrim; + tuple.mVertex = offsets[MeshStreams::Points] >= 0 ? pSrcData[offsets[MeshStreams::Points]] : -1; + tuple.mNormal = offsets[MeshStreams::Normals] >= 0 ? pSrcData[offsets[MeshStreams::Normals]] : -1; + tuple.mColor = offsets[MeshStreams::Colors] >= 0 ? pSrcData[offsets[MeshStreams::Colors]] : -1; + tuple.mUV = offsets[MeshStreams::UVs] >= 0 ? pSrcData[offsets[MeshStreams::UVs]] : -1; + tuple.mUV2 = offsets[MeshStreams::UV2s] >= 0 ? pSrcData[offsets[MeshStreams::UV2s]] : -1; - tuple.dataVertex = tuple.vertex > -1 ? streams.points.getPoint3FValue(tuple.vertex) : Point3F::Max; - tuple.dataNormal = tuple.normal > -1 ? streams.normals.getPoint3FValue(tuple.normal) : Point3F::Max; - tuple.dataColor = tuple.color > -1 ? streams.colors.getColorIValue(tuple.color) : ColorI(0,0,0); - tuple.dataUV = tuple.uv > -1 ? streams.uvs.getPoint2FValue(tuple.uv) : Point2F::Max; - tuple.dataUV2 = tuple.uv2 > -1 ? streams.uv2s.getPoint2FValue(tuple.uv2) : Point2F::Max; + tuple.mDataVertex = tuple.mVertex > -1 ? streams.points.getPoint3FValue(tuple.mVertex) : Point3F::Max; + tuple.mDataNormal = tuple.mNormal > -1 ? streams.normals.getPoint3FValue(tuple.mNormal) : Point3F::Max; + tuple.mDataColor = tuple.mColor > -1 ? streams.colors.getColorIValue(tuple.mColor) : ColorI(0,0,0); + tuple.mDataUV = tuple.mUV > -1 ? streams.uvs.getPoint2FValue(tuple.mUV) : Point2F::Max; + tuple.mDataUV2 = tuple.mUV2 > -1 ? streams.uv2s.getPoint2FValue(tuple.mUV2) : Point2F::Max; VertTupleMap::Iterator itr = tupleMap.find(tuple); if (itr == tupleMap.end()) @@ -664,8 +664,8 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const const VertTuple& tuple = vertTuples[iVert]; // Change primitives? - if (tuple.prim != lastPrimitive) { - if (meshPrims.size() <= tuple.prim) { + if (tuple.mPrim != lastPrimitive) { + if (meshPrims.size() <= tuple.mPrim) { daeErrorHandler::get()->handleError(avar("Failed to get vertex data " "for %s. Primitives do not match base geometry.", geometry->getID())); break; @@ -673,21 +673,21 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const // Update vertex/normal/UV streams and get the new material index streams.reset(); - streams.readInputs(meshPrims[tuple.prim]->getInputs()); - S32 matIndex = addMaterial(meshPrims[tuple.prim]->getMaterial()); + streams.readInputs(meshPrims[tuple.mPrim]->getInputs()); + S32 matIndex = addMaterial(meshPrims[tuple.mPrim]->getMaterial()); if (matIndex != TSDrawPrimitive::NoMaterial) appMat = static_cast(mAppMaterials[matIndex]); else appMat = 0; - lastPrimitive = tuple.prim; + lastPrimitive = tuple.mPrim; } // If we are NOT appending values, only set the value if it actually exists // in the mesh data stream. - if (appendValues || ((tuple.vertex >= 0) && (tuple.vertex < streams.points.size()))) { - points_array[iVert] = streams.points.getPoint3FValue(tuple.vertex); + if (appendValues || ((tuple.mVertex >= 0) && (tuple.mVertex < streams.points.size()))) { + points_array[iVert] = streams.points.getPoint3FValue(tuple.mVertex); // Flip verts for inverted meshes if (appNode->invertMeshes) @@ -696,8 +696,8 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const objectOffset.mulP(points_array[iVert]); } - if (appendValues || ((tuple.uv >= 0) && (tuple.uv < streams.uvs.size()))) { - uvs_array[iVert] = streams.uvs.getPoint2FValue(tuple.uv); + if (appendValues || ((tuple.mUV >= 0) && (tuple.mUV < streams.uvs.size()))) { + uvs_array[iVert] = streams.uvs.getPoint2FValue(tuple.mUV); if (appMat && appMat->effectExt) appMat->effectExt->applyTextureTransform(uvs_array[iVert], time); uvs_array[iVert].y = 1.0f - uvs_array[iVert].y; // Collada texcoords are upside down compared to TGE @@ -705,7 +705,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const // The rest is non-required data... if it doesn't exist then don't append it. - if ( (tuple.normal >= 0) && (tuple.normal < streams.normals.size()) ) { + if ( (tuple.mNormal >= 0) && (tuple.mNormal < streams.normals.size()) ) { if ( !norms_array && iVert == 0 ) { v_norms.setSize(v_norms.size() + vertTuples.size()); @@ -713,7 +713,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const } if ( norms_array ) { - norms_array[iVert] = streams.normals.getPoint3FValue(tuple.normal); + norms_array[iVert] = streams.normals.getPoint3FValue(tuple.mNormal); // Flip normals for inverted meshes if (appNode->invertMeshes) @@ -721,7 +721,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const } } - if ( (tuple.color >= 0) && (tuple.color < streams.colors.size())) + if ( (tuple.mColor >= 0) && (tuple.mColor < streams.colors.size())) { if ( !colors_array && iVert == 0 ) { @@ -730,10 +730,10 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const } if ( colors_array ) - colors_array[iVert] = streams.colors.getColorIValue(tuple.color); + colors_array[iVert] = streams.colors.getColorIValue(tuple.mColor); } - if ( (tuple.uv2 >= 0) && (tuple.uv2 < streams.uv2s.size()) ) + if ( (tuple.mUV2 >= 0) && (tuple.mUV2 < streams.uv2s.size()) ) { if ( !uv2s_array && iVert == 0 ) { @@ -743,7 +743,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const if ( uv2s_array ) { - uv2s_array[iVert] = streams.uv2s.getPoint2FValue(tuple.uv2); + uv2s_array[iVert] = streams.uv2s.getPoint2FValue(tuple.mUV2); if (appMat && appMat->effectExt) appMat->effectExt->applyTextureTransform(uv2s_array[iVert], time); uv2s_array[iVert].y = 1.0f - uv2s_array[iVert].y; // Collada texcoords are upside down compared to TGE @@ -974,11 +974,11 @@ void ColladaAppMesh::lookupSkinData() for (S32 iVert = 0; iVert < mVertsPerFrame; iVert++) { const domUint* vcount = (domUint*)weights_vcount.getRaw(0); const domInt* vindices = (domInt*)weights_v.getRaw(0); - vindices += vindicesOffset[vertTuples[iVert].vertex]; + vindices += vindicesOffset[vertTuples[iVert].mVertex]; S32 nonZeroWeightCount = 0; - for (S32 iWeight = 0; iWeight < vcount[vertTuples[iVert].vertex]; iWeight++) { + for (S32 iWeight = 0; iWeight < vcount[vertTuples[iVert].mVertex]; iWeight++) { S32 bIndex = vindices[iWeight*2]; F32 bWeight = streams.weights.getFloatValue( vindices[iWeight*2 + 1] ); @@ -990,7 +990,7 @@ void ColladaAppMesh::lookupSkinData() // Limit the number of weights per bone (keep the N largest influences) if ( nonZeroWeightCount >= TSSkinMesh::BatchData::maxBonePerVert ) { - if (vcount[vertTuples[iVert].vertex] > TSSkinMesh::BatchData::maxBonePerVert) + if (vcount[vertTuples[iVert].mVertex] > TSSkinMesh::BatchData::maxBonePerVert) { if (!tooManyWeightsWarning) { diff --git a/Engine/source/ts/collada/colladaAppMesh.h b/Engine/source/ts/collada/colladaAppMesh.h index e7d07c376..f5263b28c 100644 --- a/Engine/source/ts/collada/colladaAppMesh.h +++ b/Engine/source/ts/collada/colladaAppMesh.h @@ -57,20 +57,20 @@ // AND all of the target geometries because they MUST have the same topology. struct VertTuple { - S32 prim, vertex, normal, color, uv, uv2; + S32 mPrim, mVertex, mNormal, mColor, mUV, mUV2; - Point3F dataVertex, dataNormal; - ColorI dataColor; - Point2F dataUV, dataUV2; + Point3F mDataVertex, mDataNormal; + ColorI mDataColor; + Point2F mDataUV, mDataUV2; - VertTuple(): prim(-1), vertex(-1), normal(-1), color(-1), uv(-1), uv2(-1) {} + VertTuple(): mPrim(-1), mVertex(-1), mNormal(-1), mColor(-1), mUV(-1), mUV2(-1) {} bool operator==(const VertTuple& p) const { - return dataVertex == p.dataVertex && - dataColor == p.dataColor && - dataNormal == p.dataNormal && - dataUV == p.dataUV && - dataUV2 == p.dataUV2; + return mDataVertex == p.mDataVertex && + mDataColor == p.mDataColor && + mDataNormal == p.mDataNormal && + mDataUV == p.mDataUV && + mDataUV2 == p.mDataUV2; } }; From 7c1544317be517b877e23e39376e88b5ce478169 Mon Sep 17 00:00:00 2001 From: bank Date: Mon, 12 May 2014 18:37:22 +0400 Subject: [PATCH 04/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class ColladaAppMesh --- Engine/source/ts/collada/colladaAppMesh.cpp | 134 ++++++++++---------- Engine/source/ts/collada/colladaAppMesh.h | 36 +++--- 2 files changed, 85 insertions(+), 85 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index 839fdc0a0..75e58eef6 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -40,8 +40,8 @@ namespace DictHash using namespace ColladaUtils; -bool ColladaAppMesh::fixedSizeEnabled = false; -S32 ColladaAppMesh::fixedSize = 2; +bool ColladaAppMesh::mFixedSizeEnabled = false; +S32 ColladaAppMesh::mFixedSize = 2; //----------------------------------------------------------------------------- // Define a VertTuple dictionary to allow fast tuple lookups @@ -317,7 +317,7 @@ public: //------------------------------------------------------------------------------ ColladaAppMesh::ColladaAppMesh(const domInstance_geometry* instance, ColladaAppNode* node) - : instanceGeom(instance), instanceCtrl(0), appNode(node), geomExt(0) + : mInstanceGeom(instance), mInstanceCtrl(0), mAppNode(node), mGeomExt(0) { mFlags = 0; mNumFrames = 0; @@ -325,7 +325,7 @@ ColladaAppMesh::ColladaAppMesh(const domInstance_geometry* instance, ColladaAppN } ColladaAppMesh::ColladaAppMesh(const domInstance_controller* instance, ColladaAppNode* node) - : instanceGeom(0), instanceCtrl(instance), appNode(node), geomExt(0) + : mInstanceGeom(0), mInstanceCtrl(instance), mAppNode(node), mGeomExt(0) { mFlags = 0; mNumFrames = 0; @@ -337,18 +337,18 @@ const char* ColladaAppMesh::getName(bool allowFixed) // Some exporters add a 'PIVOT' or unnamed node between the mesh and the // actual object node. Detect this and return the object node name instead // of the pivot node. - const char* nodeName = appNode->getName(); + const char* nodeName = mAppNode->getName(); if ( dStrEqual(nodeName, "null") || dStrEndsWith(nodeName, "PIVOT") ) - nodeName = appNode->getParentName(); + nodeName = mAppNode->getParentName(); // If all geometry is being fixed to the same size, append the size // to the name - return allowFixed && fixedSizeEnabled ? avar("%s %d", nodeName, fixedSize) : nodeName; + return allowFixed && mFixedSizeEnabled ? avar("%s %d", nodeName, mFixedSize) : nodeName; } MatrixF ColladaAppMesh::getMeshTransform(F32 time) { - return appNode->getNodeTransform(time); + return mAppNode->getNodeTransform(time); } bool ColladaAppMesh::animatesVis(const AppSequence* appSeq) @@ -357,7 +357,7 @@ bool ColladaAppMesh::animatesVis(const AppSequence* appSeq) (dynamic_cast(node)->nodeExt->visibility.isAnimated(appSeq->getStart(), appSeq->getEnd())) // Check if the node visibility is animated within the sequence interval - return IS_VIS_ANIMATED(appNode) || (appNode->appParent ? IS_VIS_ANIMATED(appNode->appParent) : false); + return IS_VIS_ANIMATED(mAppNode) || (mAppNode->appParent ? IS_VIS_ANIMATED(mAppNode->appParent) : false); } bool ColladaAppMesh::animatesMatFrame(const AppSequence* appSeq) @@ -421,7 +421,7 @@ F32 ColladaAppMesh::getVisValue(F32 t) (dynamic_cast(node)->nodeExt->visibility.getValue(t)) // Get the visibility of the mesh's node at time, 't' - return GET_VIS(appNode) * (appNode->appParent ? GET_VIS(appNode->appParent) : 1.0f); + return GET_VIS(mAppNode) * (mAppNode->appParent ? GET_VIS(mAppNode->appParent) : 1.0f); } S32 ColladaAppMesh::addMaterial(const char* symbol) @@ -431,14 +431,14 @@ S32 ColladaAppMesh::addMaterial(const char* symbol) // Lookup the symbol in the materials already bound to this geometry/controller // instance - Map::Iterator itr = boundMaterials.find(symbol); - if (itr != boundMaterials.end()) + Map::Iterator itr = mBoundMaterials.find(symbol); + if (itr != mBoundMaterials.end()) return itr->value; // Find the Collada material that this symbol maps to U32 matIndex = TSDrawPrimitive::NoMaterial; - const domBind_material* binds = instanceGeom ? instanceGeom->getBind_material() : - instanceCtrl->getBind_material(); + const domBind_material* binds = mInstanceGeom ? mInstanceGeom->getBind_material() : + mInstanceCtrl->getBind_material(); if (binds) { const domInstance_material_Array& matArray = binds->getTechnique_common()->getInstance_material_array(); for (S32 iBind = 0; iBind < matArray.getCount(); iBind++) { @@ -470,7 +470,7 @@ S32 ColladaAppMesh::addMaterial(const char* symbol) } // Add this symbol to the bound list for the mesh - boundMaterials.insert(StringTable->insert(symbol), matIndex); + mBoundMaterials.insert(StringTable->insert(symbol), matIndex); return matIndex; } @@ -481,8 +481,8 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) return; // Read the extension - if (!geomExt) - geomExt = new ColladaExtension_geometry(geometry); + if (!mGeomExt) + mGeomExt = new ColladaExtension_geometry(geometry); // Get the supported primitive elements for this geometry, and warn // about unsupported elements @@ -529,7 +529,7 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) appMat = static_cast(mAppMaterials[primitive.matIndex & TSDrawPrimitive::MaterialMask]); // Force the material to be double-sided if this geometry is double-sided. - if (geomExt->double_sided && appMat && appMat->effectExt) + if (mGeomExt->double_sided && appMat && appMat->effectExt) appMat->effectExt->double_sided = true; // Pre-allocate triangle indices @@ -555,12 +555,12 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) // If the next triangle could cause us to index across a 16-bit // boundary, split this primitive and clear the tuple map to // ensure primitives only index verts within a 16-bit range. - if (vertTuples.size() && - (((vertTuples.size()-1) ^ (vertTuples.size()+2)) & 0x10000)) + if (mVertTuples.size() && + (((mVertTuples.size()-1) ^ (mVertTuples.size()+2)) & 0x10000)) { // Pad vertTuples up to the next 16-bit boundary - while (vertTuples.size() & 0xFFFF) - vertTuples.push_back(VertTuple(vertTuples.last())); + while (mVertTuples.size() & 0xFFFF) + mVertTuples.push_back(VertTuple(mVertTuples.last())); // Split the primitive at the current triangle S32 indicesRemaining = (numTriangles - iTri) * 3; @@ -602,13 +602,13 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) VertTupleMap::Iterator itr = tupleMap.find(tuple); if (itr == tupleMap.end()) { - itr = tupleMap.insert(tuple, vertTuples.size()); - vertTuples.push_back(tuple); + itr = tupleMap.insert(tuple, mVertTuples.size()); + mVertTuples.push_back(tuple); } // Collada uses CCW for front face and Torque uses the opposite, so // for normal (non-inverted) meshes, the indices are flipped. - if (appNode->invertMeshes) + if (mAppNode->invertMeshes) dstIndex[v] = itr->value; else dstIndex[2 - v] = itr->value; @@ -648,20 +648,20 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const // If appending values, pre-allocate the arrays if (appendValues) { - v_points.setSize(v_points.size() + vertTuples.size()); - v_uvs.setSize(v_uvs.size() + vertTuples.size()); + v_points.setSize(v_points.size() + mVertTuples.size()); + v_uvs.setSize(v_uvs.size() + mVertTuples.size()); } // Get pointers to arrays - Point3F* points_array = &v_points[v_points.size() - vertTuples.size()]; - Point2F* uvs_array = &v_uvs[v_uvs.size() - vertTuples.size()]; + Point3F* points_array = &v_points[v_points.size() - mVertTuples.size()]; + Point2F* uvs_array = &v_uvs[v_uvs.size() - mVertTuples.size()]; Point3F* norms_array = NULL; ColorI* colors_array = NULL; Point2F* uv2s_array = NULL; - for (S32 iVert = 0; iVert < vertTuples.size(); iVert++) { + for (S32 iVert = 0; iVert < mVertTuples.size(); iVert++) { - const VertTuple& tuple = vertTuples[iVert]; + const VertTuple& tuple = mVertTuples[iVert]; // Change primitives? if (tuple.mPrim != lastPrimitive) { @@ -690,7 +690,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const points_array[iVert] = streams.points.getPoint3FValue(tuple.mVertex); // Flip verts for inverted meshes - if (appNode->invertMeshes) + if (mAppNode->invertMeshes) points_array[iVert].z = -points_array[iVert].z; objectOffset.mulP(points_array[iVert]); @@ -708,15 +708,15 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const if ( (tuple.mNormal >= 0) && (tuple.mNormal < streams.normals.size()) ) { if ( !norms_array && iVert == 0 ) { - v_norms.setSize(v_norms.size() + vertTuples.size()); - norms_array = &v_norms[v_norms.size() - vertTuples.size()]; + v_norms.setSize(v_norms.size() + mVertTuples.size()); + norms_array = &v_norms[v_norms.size() - mVertTuples.size()]; } if ( norms_array ) { norms_array[iVert] = streams.normals.getPoint3FValue(tuple.mNormal); // Flip normals for inverted meshes - if (appNode->invertMeshes) + if (mAppNode->invertMeshes) norms_array[iVert].z = -norms_array[iVert].z; } } @@ -725,8 +725,8 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const { if ( !colors_array && iVert == 0 ) { - v_colors.setSize(v_colors.size() + vertTuples.size()); - colors_array = &v_colors[v_colors.size() - vertTuples.size()]; + v_colors.setSize(v_colors.size() + mVertTuples.size()); + colors_array = &v_colors[v_colors.size() - mVertTuples.size()]; } if ( colors_array ) @@ -737,8 +737,8 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const { if ( !uv2s_array && iVert == 0 ) { - v_uv2s.setSize(v_uv2s.size() + vertTuples.size()); - uv2s_array = &v_uv2s[v_uv2s.size() - vertTuples.size()]; + v_uv2s.setSize(v_uv2s.size() + mVertTuples.size()); + uv2s_array = &v_uv2s[v_uv2s.size() - mVertTuples.size()]; } if ( uv2s_array ) @@ -810,11 +810,11 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M getVertexData(baseGeometry, time, objectOffset, v_points, v_norms, v_colors, v_uvs, v_uv2s, true); // Get pointers to the arrays of base geometry data - Point3F* points_array = &v_points[v_points.size() - vertTuples.size()]; - Point3F* norms_array = &v_norms[v_norms.size() - vertTuples.size()]; - Point2F* uvs_array = &v_uvs[v_uvs.size() - vertTuples.size()]; - ColorI* colors_array = v_colors.size() ? &v_colors[v_colors.size() - vertTuples.size()] : 0; - Point2F* uv2s_array = v_uv2s.size() ? &v_uv2s[v_uv2s.size() - vertTuples.size()] : 0; + Point3F* points_array = &v_points[v_points.size() - mVertTuples.size()]; + Point3F* norms_array = &v_norms[v_norms.size() - mVertTuples.size()]; + Point2F* uvs_array = &v_uvs[v_uvs.size() - mVertTuples.size()]; + ColorI* colors_array = v_colors.size() ? &v_colors[v_colors.size() - mVertTuples.size()] : 0; + Point2F* uv2s_array = v_uv2s.size() ? &v_uv2s[v_uv2s.size() - mVertTuples.size()] : 0; // Normalize base vertex data? if (morph->getMethod() == MORPHMETHODTYPE_NORMALIZED) { @@ -827,14 +827,14 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M // Result = Base*(1.0-w1-w2 ... -wN) + w1*Target1 + w2*Target2 ... + wN*TargetN weightSum = mClampF(1.0f - weightSum, 0.0f, 1.0f); - for (S32 iVert = 0; iVert < vertTuples.size(); iVert++) { + for (S32 iVert = 0; iVert < mVertTuples.size(); iVert++) { points_array[iVert] *= weightSum; norms_array[iVert] *= weightSum; uvs_array[iVert] *= weightSum; } if (uv2s_array) { - for (S32 iVert = 0; iVert < vertTuples.size(); iVert++) + for (S32 iVert = 0; iVert < mVertTuples.size(); iVert++) uv2s_array[iVert] *= weightSum; } } @@ -855,29 +855,29 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M // Copy base geometry into target geometry (will be used if target does // not define normals or uvs) - targetPoints.set(points_array, vertTuples.size()); - targetNorms.set(norms_array, vertTuples.size()); - targetUvs.set(uvs_array, vertTuples.size()); + targetPoints.set(points_array, mVertTuples.size()); + targetNorms.set(norms_array, mVertTuples.size()); + targetUvs.set(uvs_array, mVertTuples.size()); if (colors_array) - targetColors.set(colors_array, vertTuples.size()); + targetColors.set(colors_array, mVertTuples.size()); if (uv2s_array) - targetUv2s.set(uv2s_array, vertTuples.size()); + targetUv2s.set(uv2s_array, mVertTuples.size()); getVertexData(targetGeoms[iTarget], time, objectOffset, targetPoints, targetNorms, targetColors, targetUvs, targetUv2s, false); // Combine with base geometry - for (S32 iVert = 0; iVert < vertTuples.size(); iVert++) { + for (S32 iVert = 0; iVert < mVertTuples.size(); iVert++) { points_array[iVert] += targetPoints[iVert] * targetWeights[iTarget]; norms_array[iVert] += targetNorms[iVert] * targetWeights[iTarget]; uvs_array[iVert] += targetUvs[iVert] * targetWeights[iTarget]; } if (uv2s_array) { - for (S32 iVert = 0; iVert < vertTuples.size(); iVert++) + for (S32 iVert = 0; iVert < mVertTuples.size(); iVert++) uv2s_array[iVert] += targetUv2s[iVert] * targetWeights[iTarget]; } if (colors_array) { - for (S32 iVert = 0; iVert < vertTuples.size(); iVert++) + for (S32 iVert = 0; iVert < mVertTuples.size(); iVert++) colors_array[iVert] += targetColors[iVert] * (F32)targetWeights[iTarget]; } } @@ -891,12 +891,12 @@ void ColladaAppMesh::lockMesh(F32 t, const MatrixF& objectOffset) // 3) a skin (skin geometry could also be a morph!) daeElement* geometry = 0; - if (instanceGeom) { + if (mInstanceGeom) { // Simple, static mesh - geometry = instanceGeom->getUrl().getElement(); + geometry = mInstanceGeom->getUrl().getElement(); } - else if (instanceCtrl) { - const domController* ctrl = daeSafeCast(instanceCtrl->getUrl().getElement()); + else if (mInstanceCtrl) { + const domController* ctrl = daeSafeCast(mInstanceCtrl->getUrl().getElement()); if (!ctrl) { daeErrorHandler::get()->handleWarning(avar("Failed to find " "element for %s", getName())); @@ -941,7 +941,7 @@ void ColladaAppMesh::lookupSkinData() return; // Get the skin and vertex weight data - const domSkin* skin = daeSafeCast(instanceCtrl->getUrl().getElement())->getSkin(); + const domSkin* skin = daeSafeCast(mInstanceCtrl->getUrl().getElement())->getSkin(); const domSkin::domVertex_weights& weightIndices = *(skin->getVertex_weights()); const domListOfInts& weights_v = weightIndices.getV()->getValue(); const domListOfUInts& weights_vcount = weightIndices.getVcount()->getValue(); @@ -974,11 +974,11 @@ void ColladaAppMesh::lookupSkinData() for (S32 iVert = 0; iVert < mVertsPerFrame; iVert++) { const domUint* vcount = (domUint*)weights_vcount.getRaw(0); const domInt* vindices = (domInt*)weights_v.getRaw(0); - vindices += vindicesOffset[vertTuples[iVert].mVertex]; + vindices += vindicesOffset[mVertTuples[iVert].mVertex]; S32 nonZeroWeightCount = 0; - for (S32 iWeight = 0; iWeight < vcount[vertTuples[iVert].mVertex]; iWeight++) { + for (S32 iWeight = 0; iWeight < vcount[mVertTuples[iVert].mVertex]; iWeight++) { S32 bIndex = vindices[iWeight*2]; F32 bWeight = streams.weights.getFloatValue( vindices[iWeight*2 + 1] ); @@ -990,7 +990,7 @@ void ColladaAppMesh::lookupSkinData() // Limit the number of weights per bone (keep the N largest influences) if ( nonZeroWeightCount >= TSSkinMesh::BatchData::maxBonePerVert ) { - if (vcount[vertTuples[iVert].mVertex] > TSSkinMesh::BatchData::maxBonePerVert) + if (vcount[mVertTuples[iVert].mVertex] > TSSkinMesh::BatchData::maxBonePerVert) { if (!tooManyWeightsWarning) { @@ -1054,10 +1054,10 @@ void ColladaAppMesh::lookupSkinData() // Lookup the joint element const domNode* joint = 0; - if (instanceCtrl->getSkeleton_array().getCount()) { + if (mInstanceCtrl->getSkeleton_array().getCount()) { // Search for the node using the as the base element - for (S32 iSkel = 0; iSkel < instanceCtrl->getSkeleton_array().getCount(); iSkel++) { - xsAnyURI skeleton = instanceCtrl->getSkeleton_array()[iSkel]->getValue(); + for (S32 iSkel = 0; iSkel < mInstanceCtrl->getSkeleton_array().getCount(); iSkel++) { + xsAnyURI skeleton = mInstanceCtrl->getSkeleton_array()[iSkel]->getValue(); daeSIDResolver resolver(skeleton.getElement(), jointName); joint = daeSafeCast(resolver.getElement()); if (joint) @@ -1072,8 +1072,8 @@ void ColladaAppMesh::lookupSkinData() if (!joint) { daeErrorHandler::get()->handleWarning(avar("Failed to find bone '%s', " - "defaulting to instance_controller parent node '%s'", jointName, appNode->getName())); - joint = appNode->getDomNode(); + "defaulting to instance_controller parent node '%s'", jointName, mAppNode->getName())); + joint = mAppNode->getDomNode(); } mBones[iJoint] = new ColladaAppNode(joint); diff --git a/Engine/source/ts/collada/colladaAppMesh.h b/Engine/source/ts/collada/colladaAppMesh.h index f5263b28c..7b91091a4 100644 --- a/Engine/source/ts/collada/colladaAppMesh.h +++ b/Engine/source/ts/collada/colladaAppMesh.h @@ -79,24 +79,24 @@ class ColladaAppMesh : public AppMesh typedef AppMesh Parent; protected: - class ColladaAppNode* appNode; ///< Pointer to the node that owns this mesh - const domInstance_geometry* instanceGeom; - const domInstance_controller* instanceCtrl; - ColladaExtension_geometry* geomExt; ///< geometry extension + class ColladaAppNode* mAppNode; ///< Pointer to the node that owns this mesh + const domInstance_geometry* mInstanceGeom; + const domInstance_controller* mInstanceCtrl; + ColladaExtension_geometry* mGeomExt; ///< geometry extension - Vector vertTuples; ///< - Map boundMaterials; ///< Local map of symbols to materials + Vector mVertTuples; ///< + Map mBoundMaterials; ///< Local map of symbols to materials - static bool fixedSizeEnabled; ///< Set to true to fix the detail size to a particular value for all geometry - static S32 fixedSize; ///< The fixed detail size value for all geometry + static bool mFixedSizeEnabled; ///< Set to true to fix the detail size to a particular value for all geometry + static S32 mFixedSize; ///< The fixed detail size value for all geometry //----------------------------------------------------------------------- /// Get the morph controller for this mesh (if any) const domMorph* getMorph() { - if (instanceCtrl) { - const domController* ctrl = daeSafeCast(instanceCtrl->getUrl().getElement()); + if (mInstanceCtrl) { + const domController* ctrl = daeSafeCast(mInstanceCtrl->getUrl().getElement()); if (ctrl && ctrl->getSkin()) ctrl = daeSafeCast(ctrl->getSkin()->getSource().getElement()); return ctrl ? ctrl->getMorph() : NULL; @@ -123,13 +123,13 @@ public: ColladaAppMesh(const domInstance_controller* instance, ColladaAppNode* node); ~ColladaAppMesh() { - delete geomExt; + delete mGeomExt; } static void fixDetailSize(bool fixed, S32 size=2) { - fixedSizeEnabled = fixed; - fixedSize = size; + mFixedSizeEnabled = fixed; + mFixedSize = size; } /// Get the name of this mesh @@ -147,7 +147,7 @@ public: /// @return True if a value was set, false if not bool getFloat(const char *propName, F32 &defaultVal) { - return appNode->getFloat(propName,defaultVal); + return mAppNode->getFloat(propName,defaultVal); } /// Get an integer property value @@ -158,7 +158,7 @@ public: /// @return True if a value was set, false if not bool getInt(const char *propName, S32 &defaultVal) { - return appNode->getInt(propName,defaultVal); + return mAppNode->getInt(propName,defaultVal); } /// Get a boolean property value @@ -169,14 +169,14 @@ public: /// @return True if a value was set, false if not bool getBool(const char *propName, bool &defaultVal) { - return appNode->getBool(propName,defaultVal); + return mAppNode->getBool(propName,defaultVal); } /// Return true if this mesh is a skin bool isSkin() { - if (instanceCtrl) { - const domController* ctrl = daeSafeCast(instanceCtrl->getUrl().getElement()); + if (mInstanceCtrl) { + const domController* ctrl = daeSafeCast(mInstanceCtrl->getUrl().getElement()); if (ctrl && ctrl->getSkin() && (ctrl->getSkin()->getVertex_weights()->getV()->getValue().getCount() > 0)) return true; From a53580ca60d103cfc994bfa1236e5c199692a13d Mon Sep 17 00:00:00 2001 From: bank Date: Mon, 12 May 2014 18:41:30 +0400 Subject: [PATCH 05/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class MeshStreams --- Engine/source/ts/collada/colladaAppMesh.cpp | 98 ++++++++++----------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index 75e58eef6..e2a489e7e 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -197,27 +197,27 @@ private: public: - _SourceReader points; - _SourceReader normals; - _SourceReader colors; - _SourceReader uvs; - _SourceReader uv2s; + _SourceReader mPoints; + _SourceReader mNormals; + _SourceReader mColors; + _SourceReader mUVs; + _SourceReader mUV2s; - _SourceReader joints; - _SourceReader weights; - _SourceReader invBindMatrices; + _SourceReader mJoints; + _SourceReader mWeights; + _SourceReader mInvBindMatrices; /// Clear the mesh streams void reset() { - points.reset(); - normals.reset(); - colors.reset(); - uvs.reset(); - uv2s.reset(); - joints.reset(); - weights.reset(); - invBindMatrices.reset(); + mPoints.reset(); + mNormals.reset(); + mColors.reset(); + mUVs.reset(); + mUV2s.reset(); + mJoints.reset(); + mWeights.reset(); + mInvBindMatrices.reset(); } /// Classify a set of inputs by type and set number (needs to be a template @@ -283,32 +283,32 @@ public: // Attempt to initialise the SourceReaders const char* vertex_params[] = { "X", "Y", "Z", "" }; - initSourceReader(sortedInputs[Points], Points, points, vertex_params); + initSourceReader(sortedInputs[Points], Points, mPoints, vertex_params); const char* normal_params[] = { "X", "Y", "Z", "" }; - initSourceReader(sortedInputs[Normals], Normals, normals, normal_params); + initSourceReader(sortedInputs[Normals], Normals, mNormals, normal_params); const char* color_params[] = { "R", "G", "B", "A", "" }; - initSourceReader(sortedInputs[Colors], Colors, colors, color_params); + initSourceReader(sortedInputs[Colors], Colors, mColors, color_params); const char* uv_params[] = { "S", "T", "" }; const char* uv_params2[] = { "U", "V", "" }; // some files use the nonstandard U,V or X,Y param names const char* uv_params3[] = { "X", "Y", "" }; - if (!initSourceReader(sortedInputs[UVs], UVs, uvs, uv_params)) - if (!initSourceReader(sortedInputs[UVs], UVs, uvs, uv_params2)) - initSourceReader(sortedInputs[UVs], UVs, uvs, uv_params3); - if (!initSourceReader(sortedInputs[UV2s], UV2s, uv2s, uv_params)) - if (!initSourceReader(sortedInputs[UV2s], UV2s, uv2s, uv_params2)) - initSourceReader(sortedInputs[UV2s], UV2s, uv2s, uv_params3); + if (!initSourceReader(sortedInputs[UVs], UVs, mUVs, uv_params)) + if (!initSourceReader(sortedInputs[UVs], UVs, mUVs, uv_params2)) + initSourceReader(sortedInputs[UVs], UVs, mUVs, uv_params3); + if (!initSourceReader(sortedInputs[UV2s], UV2s, mUV2s, uv_params)) + if (!initSourceReader(sortedInputs[UV2s], UV2s, mUV2s, uv_params2)) + initSourceReader(sortedInputs[UV2s], UV2s, mUV2s, uv_params3); const char* joint_params[] = { "JOINT", "" }; - initSourceReader(sortedInputs[Joints], Joints, joints, joint_params); + initSourceReader(sortedInputs[Joints], Joints, mJoints, joint_params); const char* weight_params[] = { "WEIGHT", "" }; - initSourceReader(sortedInputs[Weights], Weights, weights, weight_params); + initSourceReader(sortedInputs[Weights], Weights, mWeights, weight_params); const char* matrix_params[] = { "TRANSFORM", "" }; - initSourceReader(sortedInputs[InvBindMatrices], InvBindMatrices, invBindMatrices, matrix_params); + initSourceReader(sortedInputs[InvBindMatrices], InvBindMatrices, mInvBindMatrices, matrix_params); return true; } @@ -593,11 +593,11 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) tuple.mUV = offsets[MeshStreams::UVs] >= 0 ? pSrcData[offsets[MeshStreams::UVs]] : -1; tuple.mUV2 = offsets[MeshStreams::UV2s] >= 0 ? pSrcData[offsets[MeshStreams::UV2s]] : -1; - tuple.mDataVertex = tuple.mVertex > -1 ? streams.points.getPoint3FValue(tuple.mVertex) : Point3F::Max; - tuple.mDataNormal = tuple.mNormal > -1 ? streams.normals.getPoint3FValue(tuple.mNormal) : Point3F::Max; - tuple.mDataColor = tuple.mColor > -1 ? streams.colors.getColorIValue(tuple.mColor) : ColorI(0,0,0); - tuple.mDataUV = tuple.mUV > -1 ? streams.uvs.getPoint2FValue(tuple.mUV) : Point2F::Max; - tuple.mDataUV2 = tuple.mUV2 > -1 ? streams.uv2s.getPoint2FValue(tuple.mUV2) : Point2F::Max; + tuple.mDataVertex = tuple.mVertex > -1 ? streams.mPoints.getPoint3FValue(tuple.mVertex) : Point3F::Max; + tuple.mDataNormal = tuple.mNormal > -1 ? streams.mNormals.getPoint3FValue(tuple.mNormal) : Point3F::Max; + tuple.mDataColor = tuple.mColor > -1 ? streams.mColors.getColorIValue(tuple.mColor) : ColorI(0,0,0); + tuple.mDataUV = tuple.mUV > -1 ? streams.mUVs.getPoint2FValue(tuple.mUV) : Point2F::Max; + tuple.mDataUV2 = tuple.mUV2 > -1 ? streams.mUV2s.getPoint2FValue(tuple.mUV2) : Point2F::Max; VertTupleMap::Iterator itr = tupleMap.find(tuple); if (itr == tupleMap.end()) @@ -686,8 +686,8 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const // If we are NOT appending values, only set the value if it actually exists // in the mesh data stream. - if (appendValues || ((tuple.mVertex >= 0) && (tuple.mVertex < streams.points.size()))) { - points_array[iVert] = streams.points.getPoint3FValue(tuple.mVertex); + if (appendValues || ((tuple.mVertex >= 0) && (tuple.mVertex < streams.mPoints.size()))) { + points_array[iVert] = streams.mPoints.getPoint3FValue(tuple.mVertex); // Flip verts for inverted meshes if (mAppNode->invertMeshes) @@ -696,8 +696,8 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const objectOffset.mulP(points_array[iVert]); } - if (appendValues || ((tuple.mUV >= 0) && (tuple.mUV < streams.uvs.size()))) { - uvs_array[iVert] = streams.uvs.getPoint2FValue(tuple.mUV); + if (appendValues || ((tuple.mUV >= 0) && (tuple.mUV < streams.mUVs.size()))) { + uvs_array[iVert] = streams.mUVs.getPoint2FValue(tuple.mUV); if (appMat && appMat->effectExt) appMat->effectExt->applyTextureTransform(uvs_array[iVert], time); uvs_array[iVert].y = 1.0f - uvs_array[iVert].y; // Collada texcoords are upside down compared to TGE @@ -705,7 +705,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const // The rest is non-required data... if it doesn't exist then don't append it. - if ( (tuple.mNormal >= 0) && (tuple.mNormal < streams.normals.size()) ) { + if ( (tuple.mNormal >= 0) && (tuple.mNormal < streams.mNormals.size()) ) { if ( !norms_array && iVert == 0 ) { v_norms.setSize(v_norms.size() + mVertTuples.size()); @@ -713,7 +713,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const } if ( norms_array ) { - norms_array[iVert] = streams.normals.getPoint3FValue(tuple.mNormal); + norms_array[iVert] = streams.mNormals.getPoint3FValue(tuple.mNormal); // Flip normals for inverted meshes if (mAppNode->invertMeshes) @@ -721,7 +721,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const } } - if ( (tuple.mColor >= 0) && (tuple.mColor < streams.colors.size())) + if ( (tuple.mColor >= 0) && (tuple.mColor < streams.mColors.size())) { if ( !colors_array && iVert == 0 ) { @@ -730,10 +730,10 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const } if ( colors_array ) - colors_array[iVert] = streams.colors.getColorIValue(tuple.mColor); + colors_array[iVert] = streams.mColors.getColorIValue(tuple.mColor); } - if ( (tuple.mUV2 >= 0) && (tuple.mUV2 < streams.uv2s.size()) ) + if ( (tuple.mUV2 >= 0) && (tuple.mUV2 < streams.mUV2s.size()) ) { if ( !uv2s_array && iVert == 0 ) { @@ -743,7 +743,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const if ( uv2s_array ) { - uv2s_array[iVert] = streams.uv2s.getPoint2FValue(tuple.mUV2); + uv2s_array[iVert] = streams.mUV2s.getPoint2FValue(tuple.mUV2); if (appMat && appMat->effectExt) appMat->effectExt->applyTextureTransform(uv2s_array[iVert], time); uv2s_array[iVert].y = 1.0f - uv2s_array[iVert].y; // Collada texcoords are upside down compared to TGE @@ -981,7 +981,7 @@ void ColladaAppMesh::lookupSkinData() for (S32 iWeight = 0; iWeight < vcount[mVertTuples[iVert].mVertex]; iWeight++) { S32 bIndex = vindices[iWeight*2]; - F32 bWeight = streams.weights.getFloatValue( vindices[iWeight*2 + 1] ); + F32 bWeight = streams.mWeights.getFloatValue( vindices[iWeight*2 + 1] ); // Ignore empty weights if ( bIndex < 0 || bWeight == 0 ) @@ -1046,11 +1046,11 @@ void ColladaAppMesh::lookupSkinData() } // Add dummy AppNodes to allow Collada joints to be mapped to 3space nodes - mBones.setSize(streams.joints.size()); - mInitialTransforms.setSize(streams.joints.size()); - for (S32 iJoint = 0; iJoint < streams.joints.size(); iJoint++) + mBones.setSize(streams.mJoints.size()); + mInitialTransforms.setSize(streams.mJoints.size()); + for (S32 iJoint = 0; iJoint < streams.mJoints.size(); iJoint++) { - const char* jointName = streams.joints.getStringValue(iJoint); + const char* jointName = streams.mJoints.getStringValue(iJoint); // Lookup the joint element const domNode* joint = 0; @@ -1082,7 +1082,7 @@ void ColladaAppMesh::lookupSkinData() // Bone scaling is generally ignored during import, since 3space only // stores default node transform and rotation. Compensate for this by // removing the scaling from the inverse bind transform as well - MatrixF invBind = streams.invBindMatrices.getMatrixFValue(iJoint); + MatrixF invBind = streams.mInvBindMatrices.getMatrixFValue(iJoint); if (!ColladaUtils::getOptions().ignoreNodeScale) { Point3F invScale = invBind.getScale(); From 1619e194e109a097fbbd8c532c3f087048017248 Mon Sep 17 00:00:00 2001 From: bank Date: Mon, 12 May 2014 18:58:38 +0400 Subject: [PATCH 06/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class _SourceReader (ColladaUtils) --- Engine/source/ts/collada/colladaUtils.h | 66 ++++++++++++------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/Engine/source/ts/collada/colladaUtils.h b/Engine/source/ts/collada/colladaUtils.h index 4cc4cf5da..0dc97c776 100644 --- a/Engine/source/ts/collada/colladaUtils.h +++ b/Engine/source/ts/collada/colladaUtils.h @@ -291,27 +291,27 @@ template<> inline const char* _GetNameOrId(const domInstance_controller* element // is done until we actually try to extract values from the source. class _SourceReader { - const domSource* source; // the wrapped Collada source - const domAccessor* accessor; // shortcut to the source accessor - Vector offsets; // offset of each of the desired values to pull from the source array + const domSource* mSource; // the wrapped Collada source + const domAccessor* mAccessor; // shortcut to the source accessor + Vector mOffsets; // offset of each of the desired values to pull from the source array public: - _SourceReader() : source(0), accessor(0) {} + _SourceReader() : mSource(0), mAccessor(0) {} void reset() { - source = 0; - accessor = 0; - offsets.clear(); + mSource = 0; + mAccessor = 0; + mOffsets.clear(); } //------------------------------------------------------ // Initialize the _SourceReader object bool initFromSource(const domSource* src, const char* paramNames[] = 0) { - source = src; - accessor = source->getTechnique_common()->getAccessor(); - offsets.clear(); + mSource = src; + mAccessor = mSource->getTechnique_common()->getAccessor(); + mOffsets.clear(); // The source array has groups of values in a 1D stream => need to map the // input param names to source params to determine the offset within the @@ -319,11 +319,11 @@ public: U32 paramCount = 0; while (paramNames && paramNames[paramCount][0]) { // lookup the index of the source param that matches the input param - offsets.push_back(paramCount); - for (U32 iParam = 0; iParam < accessor->getParam_array().getCount(); iParam++) { - if (accessor->getParam_array()[iParam]->getName() && - dStrEqual(accessor->getParam_array()[iParam]->getName(), paramNames[paramCount])) { - offsets.last() = iParam; + mOffsets.push_back(paramCount); + for (U32 iParam = 0; iParam < mAccessor->getParam_array().getCount(); iParam++) { + if (mAccessor->getParam_array()[iParam]->getName() && + dStrEqual(mAccessor->getParam_array()[iParam]->getName(), paramNames[paramCount])) { + mOffsets.last() = iParam; break; } } @@ -331,9 +331,9 @@ public: } // If no input params were specified, just map the source params directly - if (!offsets.size()) { - for (S32 iParam = 0; iParam < accessor->getParam_array().getCount(); iParam++) - offsets.push_back(iParam); + if (!mOffsets.size()) { + for (S32 iParam = 0; iParam < mAccessor->getParam_array().getCount(); iParam++) + mOffsets.push_back(iParam); } return true; @@ -341,10 +341,10 @@ public: //------------------------------------------------------ // Shortcut to the size of the array (should be the number of destination objects) - S32 size() const { return accessor ? accessor->getCount() : 0; } + S32 size() const { return mAccessor ? mAccessor->getCount() : 0; } // Get the number of elements per group in the source - S32 stride() const { return accessor ? accessor->getStride() : 0; } + S32 stride() const { return mAccessor ? mAccessor->getStride() : 0; } //------------------------------------------------------ // Get a pointer to the start of a group of values (index advances by stride) @@ -353,8 +353,8 @@ public: const double* getStringArrayData(S32 index) const { if ((index >= 0) && (index < size())) { - if (source->getFloat_array()) - return &source->getFloat_array()->getValue()[index*stride()]; + if (mSource->getFloat_array()) + return &mSource->getFloat_array()->getValue()[index*stride()]; } return 0; } @@ -367,10 +367,10 @@ public: { if ((index >= 0) && (index < size())) { // could be plain strings or IDREFs - if (source->getName_array()) - return source->getName_array()->getValue()[index*stride()]; - else if (source->getIDREF_array()) - return source->getIDREF_array()->getValue()[index*stride()].getID(); + if (mSource->getName_array()) + return mSource->getName_array()->getValue()[index*stride()]; + else if (mSource->getIDREF_array()) + return mSource->getIDREF_array()->getValue()[index*stride()].getID(); } return ""; } @@ -379,7 +379,7 @@ public: { F32 value(0); if (const double* data = getStringArrayData(index)) - return data[offsets[0]]; + return data[mOffsets[0]]; return value; } @@ -387,7 +387,7 @@ public: { Point2F value(0, 0); if (const double* data = getStringArrayData(index)) - value.set(data[offsets[0]], data[offsets[1]]); + value.set(data[mOffsets[0]], data[mOffsets[1]]); return value; } @@ -395,7 +395,7 @@ public: { Point3F value(1, 0, 0); if (const double* data = getStringArrayData(index)) - value.set(data[offsets[0]], data[offsets[1]], data[offsets[2]]); + value.set(data[mOffsets[0]], data[mOffsets[1]], data[mOffsets[2]]); return value; } @@ -404,11 +404,11 @@ public: ColorI value(255, 255, 255, 255); if (const double* data = getStringArrayData(index)) { - value.red = data[offsets[0]] * 255.0; - value.green = data[offsets[1]] * 255.0; - value.blue = data[offsets[2]] * 255.0; + value.red = data[mOffsets[0]] * 255.0; + value.green = data[mOffsets[1]] * 255.0; + value.blue = data[mOffsets[2]] * 255.0; if ( stride() == 4 ) - value.alpha = data[offsets[3]] * 255.0; + value.alpha = data[mOffsets[3]] * 255.0; } return value; } From 9ccf5baf942266541a14c1540affd984914f3b29 Mon Sep 17 00:00:00 2001 From: bank Date: Mon, 12 May 2014 19:03:16 +0400 Subject: [PATCH 07/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class ColladaPrimitive --- Engine/source/ts/collada/colladaUtils.h | 86 ++++++++++++------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/Engine/source/ts/collada/colladaUtils.h b/Engine/source/ts/collada/colladaUtils.h index 0dc97c776..3cfe0908c 100644 --- a/Engine/source/ts/collada/colladaUtils.h +++ b/Engine/source/ts/collada/colladaUtils.h @@ -475,14 +475,14 @@ public: /// Template child class for supported Collada primitive elements template class ColladaPrimitive : public BasePrimitive { - T* primitive; - domListOfUInts *pTriangleData; + T* mPrimitive; + domListOfUInts *mTriangleData; S32 stride; public: - ColladaPrimitive(const daeElement* e) : pTriangleData(0) + ColladaPrimitive(const daeElement* e) : mTriangleData(0) { // Cast to geometric primitive element - primitive = daeSafeCast(const_cast(e)); + mPrimitive = daeSafeCast(const_cast(e)); // Determine stride stride = 0; @@ -493,13 +493,13 @@ public: } ~ColladaPrimitive() { - delete pTriangleData; + delete mTriangleData; } /// Most primitives can use these common implementations - const char* getElementName() { return primitive->getElementName(); } - const char* getMaterial() { return primitive->getMaterial(); } - const domInputLocalOffset_Array& getInputs() { return primitive->getInput_array(); } + const char* getElementName() { return mPrimitive->getElementName(); } + const char* getMaterial() { return mPrimitive->getMaterial(); } + const domInputLocalOffset_Array& getInputs() { return mPrimitive->getInput_array(); } S32 getStride() const { return stride; } /// Each supported primitive needs to implement this method (and convert @@ -512,21 +512,21 @@ public: template<> inline const domListOfUInts *ColladaPrimitive::getTriangleData() { // Return the

integer list directly - return (primitive->getP() ? &(primitive->getP()->getValue()) : NULL); + return (mPrimitive->getP() ? &(mPrimitive->getP()->getValue()) : NULL); } //----------------------------------------------------------------------------- // template<> inline const domListOfUInts *ColladaPrimitive::getTriangleData() { - if (!pTriangleData) + if (!mTriangleData) { // Convert strips to triangles - pTriangleData = new domListOfUInts(); + mTriangleData = new domListOfUInts(); - for (S32 iStrip = 0; iStrip < primitive->getCount(); iStrip++) { + for (S32 iStrip = 0; iStrip < mPrimitive->getCount(); iStrip++) { - domP* P = primitive->getP_array()[iStrip]; + domP* P = mPrimitive->getP_array()[iStrip]; // Ignore invalid P arrays if (!P || !P->getValue().getCount()) @@ -541,33 +541,33 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTrian if (iTri & 0x1) { // CW triangle - pTriangleData->appendArray(stride, v0); - pTriangleData->appendArray(stride, v0 + 2*stride); - pTriangleData->appendArray(stride, v0 + stride); + mTriangleData->appendArray(stride, v0); + mTriangleData->appendArray(stride, v0 + 2*stride); + mTriangleData->appendArray(stride, v0 + stride); } else { // CCW triangle - pTriangleData->appendArray(stride*3, v0); + mTriangleData->appendArray(stride*3, v0); } } } } - return pTriangleData; + return mTriangleData; } //----------------------------------------------------------------------------- // template<> inline const domListOfUInts *ColladaPrimitive::getTriangleData() { - if (!pTriangleData) + if (!mTriangleData) { // Convert strips to triangles - pTriangleData = new domListOfUInts(); + mTriangleData = new domListOfUInts(); - for (S32 iStrip = 0; iStrip < primitive->getCount(); iStrip++) { + for (S32 iStrip = 0; iStrip < mPrimitive->getCount(); iStrip++) { - domP* P = primitive->getP_array()[iStrip]; + domP* P = mPrimitive->getP_array()[iStrip]; // Ignore invalid P arrays if (!P || !P->getValue().getCount()) @@ -579,27 +579,27 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTriangl // Convert the fan back to a triangle list domUint* v0 = pSrcData + stride; for (S32 iTri = 0; iTri < numTriangles; iTri++, v0 += stride) { - pTriangleData->appendArray(stride, pSrcData); // shared vertex - pTriangleData->appendArray(stride, v0); // previous vertex - pTriangleData->appendArray(stride, v0+stride); // current vertex + mTriangleData->appendArray(stride, pSrcData); // shared vertex + mTriangleData->appendArray(stride, v0); // previous vertex + mTriangleData->appendArray(stride, v0+stride); // current vertex } } } - return pTriangleData; + return mTriangleData; } //----------------------------------------------------------------------------- // template<> inline const domListOfUInts *ColladaPrimitive::getTriangleData() { - if (!pTriangleData) + if (!mTriangleData) { // Convert polygons to triangles - pTriangleData = new domListOfUInts(); + mTriangleData = new domListOfUInts(); - for (S32 iPoly = 0; iPoly < primitive->getCount(); iPoly++) { + for (S32 iPoly = 0; iPoly < mPrimitive->getCount(); iPoly++) { - domP* P = primitive->getP_array()[iPoly]; + domP* P = mPrimitive->getP_array()[iPoly]; // Ignore invalid P arrays if (!P || !P->getValue().getCount()) @@ -613,41 +613,41 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTriang domUint* v0 = pSrcData; pSrcData += stride; for (S32 iTri = 0; iTri < numPoints-2; iTri++) { - pTriangleData->appendArray(stride, v0); - pTriangleData->appendArray(stride*2, pSrcData); + mTriangleData->appendArray(stride, v0); + mTriangleData->appendArray(stride*2, pSrcData); pSrcData += stride; } } } - return pTriangleData; + return mTriangleData; } //----------------------------------------------------------------------------- // template<> inline const domListOfUInts *ColladaPrimitive::getTriangleData() { - if (!pTriangleData) + if (!mTriangleData) { // Convert polygons to triangles - pTriangleData = new domListOfUInts(); + mTriangleData = new domListOfUInts(); // Check that the P element has the right number of values (this // has been seen with certain models exported using COLLADAMax) - const domListOfUInts& vcount = primitive->getVcount()->getValue(); + const domListOfUInts& vcount = mPrimitive->getVcount()->getValue(); U32 expectedCount = 0; for (S32 iPoly = 0; iPoly < vcount.getCount(); iPoly++) expectedCount += vcount[iPoly]; expectedCount *= stride; - if (!primitive->getP() || !primitive->getP()->getValue().getCount() || - (primitive->getP()->getValue().getCount() != expectedCount) ) + if (!mPrimitive->getP() || !mPrimitive->getP()->getValue().getCount() || + (mPrimitive->getP()->getValue().getCount() != expectedCount) ) { Con::warnf(" element found with invalid

array. This primitive will be ignored."); - return pTriangleData; + return mTriangleData; } - domUint* pSrcData = &(primitive->getP()->getValue()[0]); + domUint* pSrcData = &(mPrimitive->getP()->getValue()[0]); for (S32 iPoly = 0; iPoly < vcount.getCount(); iPoly++) { // Use a simple tri-fan (centered at the first point) method of @@ -655,14 +655,14 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTriang domUint* v0 = pSrcData; pSrcData += stride; for (S32 iTri = 0; iTri < vcount[iPoly]-2; iTri++) { - pTriangleData->appendArray(stride, v0); - pTriangleData->appendArray(stride*2, pSrcData); + mTriangleData->appendArray(stride, v0); + mTriangleData->appendArray(stride*2, pSrcData); pSrcData += stride; } pSrcData += stride; } } - return pTriangleData; + return mTriangleData; } //----------------------------------------------------------------------------- From 40037b8b51aa449a204afcef1933b323ee182267 Mon Sep 17 00:00:00 2001 From: bank Date: Mon, 12 May 2014 19:11:45 +0400 Subject: [PATCH 08/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - ColladaUtils (struct AnimChannels, struct AnimData, struct AnimatedElement) --- Engine/source/ts/collada/colladaAppNode.cpp | 4 +- .../source/ts/collada/colladaAppSequence.cpp | 2 +- Engine/source/ts/collada/colladaExtensions.h | 4 +- .../source/ts/collada/colladaShapeLoader.cpp | 20 ++--- Engine/source/ts/collada/colladaUtils.cpp | 76 +++++++++---------- Engine/source/ts/collada/colladaUtils.h | 58 +++++++------- 6 files changed, 82 insertions(+), 82 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppNode.cpp b/Engine/source/ts/collada/colladaAppNode.cpp index fdf56c775..c66df325e 100644 --- a/Engine/source/ts/collada/colladaAppNode.cpp +++ b/Engine/source/ts/collada/colladaAppNode.cpp @@ -99,7 +99,7 @@ ColladaAppNode::ColladaAppNode(const domNode* node, ColladaAppNode* parent) case COLLADA_TYPE::MATRIX: case COLLADA_TYPE::LOOKAT: nodeTransforms.increment(); - nodeTransforms.last().element = node->getContents()[iChild]; + nodeTransforms.last().mElement = node->getContents()[iChild]; break; } } @@ -232,7 +232,7 @@ MatrixF ColladaAppNode::getTransform(F32 time) MatrixF mat(true); // Convert the transform element to a MatrixF - switch (nodeTransforms[iTxfm].element->getElementType()) { + switch (nodeTransforms[iTxfm].mElement->getElementType()) { case COLLADA_TYPE::TRANSLATE: mat = vecToMatrixF(nodeTransforms[iTxfm].getValue(time)); break; case COLLADA_TYPE::SCALE: mat = vecToMatrixF(nodeTransforms[iTxfm].getValue(time)); break; case COLLADA_TYPE::ROTATE: mat = vecToMatrixF(nodeTransforms[iTxfm].getValue(time)); break; diff --git a/Engine/source/ts/collada/colladaAppSequence.cpp b/Engine/source/ts/collada/colladaAppSequence.cpp index 6f65a01bf..a3ccc6864 100644 --- a/Engine/source/ts/collada/colladaAppSequence.cpp +++ b/Engine/source/ts/collada/colladaAppSequence.cpp @@ -88,7 +88,7 @@ void ColladaAppSequence::setAnimationActive(const domAnimation* anim, bool activ domChannel* channel = anim->getChannel_array()[iChannel]; AnimData* animData = reinterpret_cast(channel->getUserData()); if (animData) - animData->enabled = active; + animData->mEnabled = active; } // Recurse into child animations diff --git a/Engine/source/ts/collada/colladaExtensions.h b/Engine/source/ts/collada/colladaExtensions.h index 40e490267..0d440a3f7 100644 --- a/Engine/source/ts/collada/colladaExtensions.h +++ b/Engine/source/ts/collada/colladaExtensions.h @@ -108,9 +108,9 @@ protected: /// Get the value of the named animated parameter (use defaultVal if parameter not found) template void get(const char* name, AnimatedElement& value, T defaultVal) { - value.defaultVal = defaultVal; + value.mDefaultVal = defaultVal; if (const domAny* param = findParam(name)) - value.element = param; + value.mElement = param; } public: diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index 07d2b7a40..b7047b336 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -160,14 +160,14 @@ void ColladaShapeLoader::processAnimation(const domAnimation* anim, F32& maxEndT // @todo:don't care about the input param names for now. Could // validate against the target type.... if (dStrEqual(input->getSemantic(), "INPUT")) { - data.input.initFromSource(source); + data.mInput.initFromSource(source); // Adjust the maximum sequence end time - maxEndTime = getMax(maxEndTime, data.input.getFloatValue((S32)data.input.size()-1)); + maxEndTime = getMax(maxEndTime, data.mInput.getFloatValue((S32)data.mInput.size()-1)); // Detect the frame rate (minimum time between keyframes) - for (S32 iFrame = 1; iFrame < data.input.size(); iFrame++) + for (S32 iFrame = 1; iFrame < data.mInput.size(); iFrame++) { - F32 delta = data.input.getFloatValue( iFrame ) - data.input.getFloatValue( iFrame-1 ); + F32 delta = data.mInput.getFloatValue( iFrame ) - data.mInput.getFloatValue( iFrame-1 ); if ( delta < 0 ) { daeErrorHandler::get()->handleError(avar(" INPUT '%s' " @@ -178,13 +178,13 @@ void ColladaShapeLoader::processAnimation(const domAnimation* anim, F32& maxEndT } } else if (dStrEqual(input->getSemantic(), "OUTPUT")) - data.output.initFromSource(source); + data.mOutput.initFromSource(source); else if (dStrEqual(input->getSemantic(), "IN_TANGENT")) - data.inTangent.initFromSource(source); + data.mInTangent.initFromSource(source); else if (dStrEqual(input->getSemantic(), "OUT_TANGENT")) - data.outTangent.initFromSource(source); + data.mOutTangent.initFromSource(source); else if (dStrEqual(input->getSemantic(), "INTERPOLATION")) - data.interpolation.initFromSource(source); + data.mInterpolation.initFromSource(source); } // Set initial value for visibility targets that were added automatically (in colladaUtils.cpp @@ -192,11 +192,11 @@ void ColladaShapeLoader::processAnimation(const domAnimation* anim, F32& maxEndT { domAny* visTarget = daeSafeCast(target); if (visTarget && dStrEqual(visTarget->getValue(), "")) - visTarget->setValue(avar("%g", data.output.getFloatValue(0))); + visTarget->setValue(avar("%g", data.mOutput.getFloatValue(0))); } // Ignore empty animations - if (data.input.size() == 0) { + if (data.mInput.size() == 0) { channel->setUserData(0); delete targetChannels->last(); targetChannels->pop_back(); diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index 0c409fc95..647d94164 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -248,27 +248,27 @@ BasePrimitive* BasePrimitive::get(const daeElement* element) void AnimData::parseTargetString(const char* target, S32 fullCount, const char* elements[]) { // Assume targeting all elements at offset 0 - targetValueCount = fullCount; - targetValueOffset = 0; + mTargetValueCount = fullCount; + mTargetValueOffset = 0; // Check for array syntax: (n) or (n)(m) if (const char* p = dStrchr(target, '(')) { S32 indN, indM; if (dSscanf(p, "(%d)(%d)", &indN, &indM) == 2) { - targetValueOffset = (indN * 4) + indM; // @todo: 4x4 matrix only - targetValueCount = 1; + mTargetValueOffset = (indN * 4) + indM; // @todo: 4x4 matrix only + mTargetValueCount = 1; } else if (dSscanf(p, "(%d)", &indN) == 1) { - targetValueOffset = indN; - targetValueCount = 1; + mTargetValueOffset = indN; + mTargetValueCount = 1; } } else if (const char* p = dStrrchr(target, '.')) { // Check for named elements for (S32 iElem = 0; elements[iElem][0] != 0; iElem++) { if (!dStrcmp(p, elements[iElem])) { - targetValueOffset = iElem; - targetValueCount = 1; + mTargetValueOffset = iElem; + mTargetValueCount = 1; break; } } @@ -327,47 +327,47 @@ F32 AnimData::invertParamCubic(F32 param, F32 x0, F32 x1, F32 x2, F32 x3) const void AnimData::interpValue(F32 t, U32 offset, double* value) const { // handle degenerate animation data - if (input.size() == 0) + if (mInput.size() == 0) { *value = 0.0f; return; } - else if (input.size() == 1) + else if (mInput.size() == 1) { - *value = output.getStringArrayData(0)[offset]; + *value = mOutput.getStringArrayData(0)[offset]; return; } // clamp time to valid range - F32 curveStart = input.getFloatValue(0); - F32 curveEnd = input.getFloatValue(input.size()-1); + F32 curveStart = mInput.getFloatValue(0); + F32 curveEnd = mInput.getFloatValue(mInput.size()-1); t = mClampF(t, curveStart, curveEnd); // find the index of the input keyframe BEFORE 't' S32 index; - for (index = 0; index < input.size()-2; index++) { - if (input.getFloatValue(index + 1) > t) + for (index = 0; index < mInput.size()-2; index++) { + if (mInput.getFloatValue(index + 1) > t) break; } // get the data for the two control points either side of 't' Point2F v0; - v0.x = input.getFloatValue(index); - v0.y = output.getStringArrayData(index)[offset]; + v0.x = mInput.getFloatValue(index); + v0.y = mOutput.getStringArrayData(index)[offset]; Point2F v3; - v3.x = input.getFloatValue(index + 1); - v3.y = output.getStringArrayData(index + 1)[offset]; + v3.x = mInput.getFloatValue(index + 1); + v3.y = mOutput.getStringArrayData(index + 1)[offset]; // If spline interpolation is specified but the tangents are not available, // default to LINEAR. - const char* interp_method = interpolation.getStringValue(index); + const char* interp_method = mInterpolation.getStringValue(index); if (dStrEqual(interp_method, "BEZIER") || dStrEqual(interp_method, "HERMITE") || dStrEqual(interp_method, "CARDINAL")) { - const double* inArray = inTangent.getStringArrayData(index + 1); - const double* outArray = outTangent.getStringArrayData(index); + const double* inArray = mInTangent.getStringArrayData(index + 1); + const double* outArray = mOutTangent.getStringArrayData(index); if (!inArray || !outArray) interp_method = "LINEAR"; } @@ -398,17 +398,17 @@ void AnimData::interpValue(F32 t, U32 offset, double* value) const v2 = v3; if (index > 0) { - v0.x = input.getFloatValue(index-1); - v0.y = output.getStringArrayData(index-1)[offset]; + v0.x = mInput.getFloatValue(index-1); + v0.y = mOutput.getStringArrayData(index-1)[offset]; } else { // mirror P1 through P0 v0 = v1 + (v1 - v2); } - if (index < (input.size()-2)) { - v3.x = input.getFloatValue(index+2); - v3.y = output.getStringArrayData(index+2)[offset]; + if (index < (mInput.size()-2)) { + v3.x = mInput.getFloatValue(index+2); + v3.y = mOutput.getStringArrayData(index+2)[offset]; } else { // mirror P0 through P1 @@ -416,10 +416,10 @@ void AnimData::interpValue(F32 t, U32 offset, double* value) const } } else { - const double* inArray = inTangent.getStringArrayData(index + 1); - const double* outArray = outTangent.getStringArrayData(index); + const double* inArray = mInTangent.getStringArrayData(index + 1); + const double* outArray = mOutTangent.getStringArrayData(index); - if (output.stride() == inTangent.stride()) { + if (mOutput.stride() == mInTangent.stride()) { // This degenerate form (1D control points) does 2 things wrong: // 1) it does not specify the key (time) value // 2) the control point is specified as a tangent for both bezier and hermite @@ -458,27 +458,27 @@ void AnimData::interpValue(F32 t, U32 offset, double* value) const void AnimData::interpValue(F32 t, U32 offset, const char** value) const { - if (input.size() == 0) + if (mInput.size() == 0) *value = ""; - else if (input.size() == 1) - *value = output.getStringValue(0); + else if (mInput.size() == 1) + *value = mOutput.getStringValue(0); else { // clamp time to valid range - F32 curveStart = input.getFloatValue(0); - F32 curveEnd = input.getFloatValue(input.size()-1); + F32 curveStart = mInput.getFloatValue(0); + F32 curveEnd = mInput.getFloatValue(mInput.size()-1); t = mClampF(t, curveStart, curveEnd); // find the index of the input keyframe BEFORE 't' S32 index; - for (index = 0; index < input.size()-2; index++) { - if (input.getFloatValue(index + 1) > t) + for (index = 0; index < mInput.size()-2; index++) { + if (mInput.getFloatValue(index + 1) > t) break; } // String values only support STEP interpolation, so just get the // value at the input keyframe - *value = output.getStringValue(index); + *value = mOutput.getStringValue(index); } } diff --git a/Engine/source/ts/collada/colladaUtils.h b/Engine/source/ts/collada/colladaUtils.h index 3cfe0908c..8a8643973 100644 --- a/Engine/source/ts/collada/colladaUtils.h +++ b/Engine/source/ts/collada/colladaUtils.h @@ -678,32 +678,32 @@ template<> inline F32 convert(const char* value) { return convert(value) /// Collada animation data struct AnimChannels : public Vector { - daeElement *element; - AnimChannels(daeElement* el) : element(el) + daeElement *mElement; + AnimChannels(daeElement* el) : mElement(el) { - element->setUserData(this); + mElement->setUserData(this); } ~AnimChannels() { - if (element) - element->setUserData(0); + if (mElement) + mElement->setUserData(0); } }; struct AnimData { - bool enabled; ///!< Used to select animation channels for the current clip + bool mEnabled; ///!< Used to select animation channels for the current clip - _SourceReader input; - _SourceReader output; + _SourceReader mInput; + _SourceReader mOutput; - _SourceReader inTangent; - _SourceReader outTangent; + _SourceReader mInTangent; + _SourceReader mOutTangent; - _SourceReader interpolation; + _SourceReader mInterpolation; - U32 targetValueOffset; ///< Offset into the target element (for arrays of values) - U32 targetValueCount; ///< Number of values animated (from OUTPUT source array) + U32 mTargetValueOffset; ///< Offset into the target element (for arrays of values) + U32 mTargetValueCount; ///< Number of values animated (from OUTPUT source array) /// Get the animation channels for the Collada element (if any) static AnimChannels* getAnimChannels(const daeElement* element) @@ -711,7 +711,7 @@ struct AnimData return element ? (AnimChannels*)const_cast(element)->getUserData() : 0; } - AnimData() : enabled(false) { } + AnimData() : mEnabled(false) { } void parseTargetString(const char* target, S32 fullCount, const char* elements[]); @@ -735,13 +735,13 @@ struct AnimData template struct AnimatedElement { - const daeElement* element; ///< The Collada element (can be NULL) - T defaultVal; ///< Default value (used when element is NULL) + const daeElement* mElement; ///< The Collada element (can be NULL) + T mDefaultVal; ///< Default value (used when element is NULL) - AnimatedElement(const daeElement* e=0) : element(e) { } + AnimatedElement(const daeElement* e=0) : mElement(e) { } /// Check if the element has any animations channels - bool isAnimated() { return (AnimData::getAnimChannels(element) != 0); } + bool isAnimated() { return (AnimData::getAnimChannels(mElement) != 0); } bool isAnimated(F32 start, F32 end) { return isAnimated(); } /// Get the value of the element at the specified time @@ -749,17 +749,17 @@ struct AnimatedElement { // If the element is NULL, just use the default (handy for profiles which // may or may not be present in the document) - T value(defaultVal); - if (const domAny* param = daeSafeCast(const_cast(element))) { + T value(mDefaultVal); + if (const domAny* param = daeSafeCast(const_cast(mElement))) { // If the element is not animated, just use its current value value = convert(param->getValue()); // Animate the value - const AnimChannels* channels = AnimData::getAnimChannels(element); + const AnimChannels* channels = AnimData::getAnimChannels(mElement); if (channels && (time >= 0)) { for (S32 iChannel = 0; iChannel < channels->size(); iChannel++) { const AnimData* animData = (*channels)[iChannel]; - if (animData->enabled) + if (animData->mEnabled) animData->interpValue(time, 0, &value); } } @@ -779,19 +779,19 @@ template struct AnimatedElementList : public AnimatedElement // Get the value of the element list at the specified time T getValue(F32 time) { - T vec(this->defaultVal); - if (this->element) { + T vec(this->mDefaultVal); + if (this->mElement) { // Get a copy of the vector - vec = *(T*)const_cast(this->element)->getValuePointer(); + vec = *(T*)const_cast(this->mElement)->getValuePointer(); // Animate the vector - const AnimChannels* channels = AnimData::getAnimChannels(this->element); + const AnimChannels* channels = AnimData::getAnimChannels(this->mElement); if (channels && (time >= 0)) { for (S32 iChannel = 0; iChannel < channels->size(); iChannel++) { const AnimData* animData = (*channels)[iChannel]; - if (animData->enabled) { - for (S32 iValue = 0; iValue < animData->targetValueCount; iValue++) - animData->interpValue(time, iValue, &vec[animData->targetValueOffset + iValue]); + if (animData->mEnabled) { + for (S32 iValue = 0; iValue < animData->mTargetValueCount; iValue++) + animData->interpValue(time, iValue, &vec[animData->mTargetValueOffset + iValue]); } } } From 733347fd6149265ec2e68382a97ca0dfd49cafba Mon Sep 17 00:00:00 2001 From: bank Date: Mon, 12 May 2014 19:23:25 +0400 Subject: [PATCH 09/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - struct ImportOptions (ColladaUtils) --- .../source/ts/collada/colladaAppMaterial.cpp | 4 +- Engine/source/ts/collada/colladaAppMesh.cpp | 2 +- Engine/source/ts/collada/colladaAppNode.cpp | 4 +- Engine/source/ts/collada/colladaExtensions.h | 2 +- Engine/source/ts/collada/colladaLights.cpp | 4 +- .../source/ts/collada/colladaShapeLoader.cpp | 36 ++++++------ Engine/source/ts/collada/colladaUtils.cpp | 2 +- Engine/source/ts/collada/colladaUtils.h | 56 +++++++++---------- Engine/source/ts/tsShapeConstruct.cpp | 26 ++++----- 9 files changed, 68 insertions(+), 68 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMaterial.cpp b/Engine/source/ts/collada/colladaAppMaterial.cpp index a29964ad0..992c0f57c 100644 --- a/Engine/source/ts/collada/colladaAppMaterial.cpp +++ b/Engine/source/ts/collada/colladaAppMaterial.cpp @@ -155,8 +155,8 @@ ColladaAppMaterial::ColladaAppMaterial(const domMaterial *pMat) normalMap = getSamplerImagePath(effect, effectExt->bumpSampler); // Set the material name - name = ColladaUtils::getOptions().matNamePrefix; - if ( ColladaUtils::getOptions().useDiffuseNames ) + name = ColladaUtils::getOptions().mMatNamePrefix; + if ( ColladaUtils::getOptions().mUseDiffuseNames ) { Torque::Path diffusePath( diffuseMap ); name += diffusePath.getFileName(); diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index e2a489e7e..2b9d601eb 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -1083,7 +1083,7 @@ void ColladaAppMesh::lookupSkinData() // stores default node transform and rotation. Compensate for this by // removing the scaling from the inverse bind transform as well MatrixF invBind = streams.mInvBindMatrices.getMatrixFValue(iJoint); - if (!ColladaUtils::getOptions().ignoreNodeScale) + if (!ColladaUtils::getOptions().mIgnoreNodeScale) { Point3F invScale = invBind.getScale(); invScale.x = invScale.x ? (1.0f / invScale.x) : 0; diff --git a/Engine/source/ts/collada/colladaAppNode.cpp b/Engine/source/ts/collada/colladaAppNode.cpp index c66df325e..70dd94154 100644 --- a/Engine/source/ts/collada/colladaAppNode.cpp +++ b/Engine/source/ts/collada/colladaAppNode.cpp @@ -221,7 +221,7 @@ MatrixF ColladaAppNode::getTransform(F32 time) else { // no parent (ie. root level) => scale by global shape lastTransform.identity(); - lastTransform.scale(ColladaUtils::getOptions().unit); + lastTransform.scale(ColladaUtils::getOptions().mUnit); if (!isBounds()) ColladaUtils::convertTransform(lastTransform); // don't convert bounds node transform (or upAxis won't work!) } @@ -242,7 +242,7 @@ MatrixF ColladaAppNode::getTransform(F32 time) } // Remove node scaling (but keep reflections) if desired - if (ColladaUtils::getOptions().ignoreNodeScale) + if (ColladaUtils::getOptions().mIgnoreNodeScale) { Point3F invScale = mat.getScale(); invScale.x = invScale.x ? (1.0f / invScale.x) : 0; diff --git a/Engine/source/ts/collada/colladaExtensions.h b/Engine/source/ts/collada/colladaExtensions.h index 0d440a3f7..a2b92a33d 100644 --- a/Engine/source/ts/collada/colladaExtensions.h +++ b/Engine/source/ts/collada/colladaExtensions.h @@ -247,7 +247,7 @@ public: // OpenCOLLADA profile pTechnique = findExtraTechnique(node, "OpenCOLLADA"); - if (!visibility.element) + if (!visibility.mElement) GET_EXTRA_PARAM(visibility, 1.0); GET_EXTRA_PARAM(user_properties, user_properties); } diff --git a/Engine/source/ts/collada/colladaLights.cpp b/Engine/source/ts/collada/colladaLights.cpp index 71d2c33df..5aee6d43f 100644 --- a/Engine/source/ts/collada/colladaLights.cpp +++ b/Engine/source/ts/collada/colladaLights.cpp @@ -210,8 +210,8 @@ ConsoleFunction( loadColladaLights, bool, 2, 4, upAxis = root->getAsset()->getUp_axis()->getValue(); } - ColladaUtils::getOptions().unit = unit; - ColladaUtils::getOptions().upAxis = upAxis; + ColladaUtils::getOptions().mUnit = unit; + ColladaUtils::getOptions().mUpAxis = upAxis; // First grab all of the top-level nodes Vector sceneNodes; diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index b7047b336..319173e01 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -86,11 +86,11 @@ ColladaShapeLoader::ColladaShapeLoader(domCOLLADA* _root) } // Set import options (if they are not set to override) - if (ColladaUtils::getOptions().unit <= 0.0f) - ColladaUtils::getOptions().unit = unit; + if (ColladaUtils::getOptions().mUnit <= 0.0f) + ColladaUtils::getOptions().mUnit = unit; - if (ColladaUtils::getOptions().upAxis == UPAXISTYPE_COUNT) - ColladaUtils::getOptions().upAxis = upAxis; + if (ColladaUtils::getOptions().mUpAxis == UPAXISTYPE_COUNT) + ColladaUtils::getOptions().mUpAxis = upAxis; } ColladaShapeLoader::~ColladaShapeLoader() @@ -267,7 +267,7 @@ void ColladaShapeLoader::enumerateScene() // Set LOD option bool singleDetail = true; - switch (ColladaUtils::getOptions().lodType) + switch (ColladaUtils::getOptions().mLodType) { case ColladaUtils::ImportOptions::DetectDTS: // Check for a baseXX->startXX hierarchy at the top-level, if we find @@ -298,7 +298,7 @@ void ColladaShapeLoader::enumerateScene() break; } - ColladaAppMesh::fixDetailSize( singleDetail, ColladaUtils::getOptions().singleDetailSize ); + ColladaAppMesh::fixDetailSize( singleDetail, ColladaUtils::getOptions().mSingleDetailSize ); // Process the top level nodes for (S32 iNode = 0; iNode < sceneNodes.size(); iNode++) { @@ -321,18 +321,18 @@ void ColladaShapeLoader::enumerateScene() bool ColladaShapeLoader::ignoreNode(const String& name) { - if (FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().alwaysImport, name, false)) + if (FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().mAlwaysImport, name, false)) return false; else - return FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().neverImport, name, false); + return FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().mNeverImport, name, false); } bool ColladaShapeLoader::ignoreMesh(const String& name) { - if (FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().alwaysImportMesh, name, false)) + if (FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().mAlwaysImportMesh, name, false)) return false; else - return FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().neverImportMesh, name, false); + return FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().mNeverImportMesh, name, false); } void ColladaShapeLoader::computeBounds(Box3F& bounds) @@ -341,17 +341,17 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) // Check if the model origin needs adjusting if ( bounds.isValidBox() && - (ColladaUtils::getOptions().adjustCenter || - ColladaUtils::getOptions().adjustFloor) ) + (ColladaUtils::getOptions().mAdjustCenter || + ColladaUtils::getOptions().mAdjustFloor) ) { // Compute shape offset Point3F shapeOffset = Point3F::Zero; - if ( ColladaUtils::getOptions().adjustCenter ) + if ( ColladaUtils::getOptions().mAdjustCenter ) { bounds.getCenter( &shapeOffset ); shapeOffset = -shapeOffset; } - if ( ColladaUtils::getOptions().adjustFloor ) + if ( ColladaUtils::getOptions().mAdjustFloor ) shapeOffset.z = -bounds.minExtents.z; // Adjust bounds @@ -448,7 +448,7 @@ void copySketchupTexture(const Torque::Path &path, String &textureFilename) void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false) { #ifdef DAE2DTS_TOOL - if (!ColladaUtils::getOptions().forceUpdateMaterials) + if (!ColladaUtils::getOptions().mForceUpdateMaterials) return; #endif @@ -467,7 +467,7 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false) if ( Sim::findObject( MATMGR->getMapEntry( mat->getName() ), mappedMat ) ) { // Only update existing materials if forced to - if ( ColladaUtils::getOptions().forceUpdateMaterials ) + if ( ColladaUtils::getOptions().mForceUpdateMaterials ) persistMgr.setDirty( mappedMat ); } else @@ -677,8 +677,8 @@ TSShape* loadColladaShape(const Torque::Path &path) #ifdef DAE2DTS_TOOL // Command line overrides certain options - ColladaUtils::getOptions().forceUpdateMaterials = cmdLineOptions.forceUpdateMaterials; - ColladaUtils::getOptions().useDiffuseNames = cmdLineOptions.useDiffuseNames; + ColladaUtils::getOptions().mForceUpdateMaterials = cmdLineOptions.mForceUpdateMaterials; + ColladaUtils::getOptions().mUseDiffuseNames = cmdLineOptions.mUseDiffuseNames; #endif } diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index 647d94164..c9c2a6ae7 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -49,7 +49,7 @@ void ColladaUtils::convertTransform(MatrixF& mat) { MatrixF rot(true); - switch (ColladaUtils::getOptions().upAxis) + switch (ColladaUtils::getOptions().mUpAxis) { case UPAXISTYPE_X_UP: // rotate 90 around Y-axis, then 90 around Z-axis diff --git a/Engine/source/ts/collada/colladaUtils.h b/Engine/source/ts/collada/colladaUtils.h index 8a8643973..bb56c66c5 100644 --- a/Engine/source/ts/collada/colladaUtils.h +++ b/Engine/source/ts/collada/colladaUtils.h @@ -76,20 +76,20 @@ namespace ColladaUtils NumLodTypes }; - domUpAxisType upAxis; // Override for the collada element - F32 unit; // Override for the collada element - eLodType lodType; // LOD type option - S32 singleDetailSize; // Detail size for all meshes in the model - String matNamePrefix; // Prefix to apply to collada material names - String alwaysImport; // List of node names (with wildcards) to import, even if in the neverImport list - String neverImport; // List of node names (with wildcards) to ignore on loading - String alwaysImportMesh; // List of mesh names (with wildcards) to import, even if in the neverImportMesh list - String neverImportMesh; // List of mesh names (with wildcards) to ignore on loading - bool ignoreNodeScale; // Ignore elements in s - bool adjustCenter; // Translate model so origin is at the center - bool adjustFloor; // Translate model so origin is at the bottom - bool forceUpdateMaterials; // Force update of materials.cs - bool useDiffuseNames; // Use diffuse texture as the material name + domUpAxisType mUpAxis; // Override for the collada element + F32 mUnit; // Override for the collada element + eLodType mLodType; // LOD type option + S32 mSingleDetailSize; // Detail size for all meshes in the model + String mMatNamePrefix; // Prefix to apply to collada material names + String mAlwaysImport; // List of node names (with wildcards) to import, even if in the neverImport list + String mNeverImport; // List of node names (with wildcards) to ignore on loading + String mAlwaysImportMesh; // List of mesh names (with wildcards) to import, even if in the neverImportMesh list + String mNeverImportMesh; // List of mesh names (with wildcards) to ignore on loading + bool mIgnoreNodeScale; // Ignore elements in s + bool mAdjustCenter; // Translate model so origin is at the center + bool mAdjustFloor; // Translate model so origin is at the bottom + bool mForceUpdateMaterials; // Force update of materials.cs + bool mUseDiffuseNames; // Use diffuse texture as the material name ImportOptions() { @@ -98,20 +98,20 @@ namespace ColladaUtils void reset() { - upAxis = UPAXISTYPE_COUNT; - unit = -1.0f; - lodType = DetectDTS; - singleDetailSize = 2; - matNamePrefix = ""; - alwaysImport = ""; - neverImport = ""; - alwaysImportMesh = ""; - neverImportMesh = ""; - ignoreNodeScale = false; - adjustCenter = false; - adjustFloor = false; - forceUpdateMaterials = false; - useDiffuseNames = false; + mUpAxis = UPAXISTYPE_COUNT; + mUnit = -1.0f; + mLodType = DetectDTS; + mSingleDetailSize = 2; + mMatNamePrefix = ""; + mAlwaysImport = ""; + mNeverImport = ""; + mAlwaysImportMesh = ""; + mNeverImportMesh = ""; + mIgnoreNodeScale = false; + mAdjustCenter = false; + mAdjustFloor = false; + mForceUpdateMaterials = false; + mUseDiffuseNames = false; } }; diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index aa23e22cf..54e288850 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -159,7 +159,7 @@ void TSShapeConstructor::initPersistFields() endGroup( "Media" ); addGroup( "Collada" ); - addField( "upAxis", TYPEID< domUpAxisType >(), Offset(mOptions.upAxis, TSShapeConstructor), + addField( "upAxis", TYPEID< domUpAxisType >(), Offset(mOptions.mUpAxis, TSShapeConstructor), "Override the element in the COLLADA (.dae) file. No effect for DTS files.\n" "Set to one of the following values:\n" "

X_AXIS
Positive X points up. Model will be rotated into Torque's coordinate system (Z up).
" @@ -167,7 +167,7 @@ void TSShapeConstructor::initPersistFields() "
Z_AXIS
Positive Z points up. No rotation will be applied to the model.
" "
DEFAULT
The default value. Use the value in the .dae file (defaults to Z_AXIS if the element is not present).
" ); - addField( "unit", TypeF32, Offset(mOptions.unit, TSShapeConstructor), + addField( "unit", TypeF32, Offset(mOptions.mUnit, TSShapeConstructor), "Override the element in the COLLADA (.dae) file. No effect for DTS files.\n" "COLLADA (.dae) files usually contain a element that indicates the " "'real world' units that the model is described in. It means you can work " @@ -182,7 +182,7 @@ void TSShapeConstructor::initPersistFields() "Omit the field or set to -1 to use the value in the .dae file (1.0 if the " " element is not present)" ); - addField( "lodType", TYPEID< ColladaUtils::ImportOptions::eLodType >(), Offset(mOptions.lodType, TSShapeConstructor), + addField( "lodType", TYPEID< ColladaUtils::ImportOptions::eLodType >(), Offset(mOptions.mLodType, TSShapeConstructor), "Control how the COLLADA (.dae) importer interprets LOD in the model. No effect for DTS files.\n" "Set to one of the following values:\n" "
DetectDTS
The default value. Instructs the importer to search for a 'baseXXX->startXXX' node hierarchy at the root level. If found, the importer acts as if ''TrailingNumber'' was set. Otherwise, all geometry is imported at a single detail size.
" @@ -190,16 +190,16 @@ void TSShapeConstructor::initPersistFields() "
TrailingNumber
Numbers at the end of geometry node's name are interpreted as the detail size (similar to DTS exporting). Geometry instances with the same base name but different trailing number are grouped into the same object.
" "
DEFAULT
The default value. Use the value in the .dae file (defaults to Z_AXIS if the element is not present).
" ); - addField( "singleDetailSize", TypeS32, Offset(mOptions.singleDetailSize, TSShapeConstructor), + addField( "singleDetailSize", TypeS32, Offset(mOptions.mSingleDetailSize, TSShapeConstructor), "Sets the detail size when lodType is set to SingleSize. No effect otherwise, and no effect for DTS files.\n" "@see lodType" ); - addField( "matNamePrefix", TypeRealString, Offset(mOptions.matNamePrefix, TSShapeConstructor), + addField( "matNamePrefix", TypeRealString, Offset(mOptions.mMatNamePrefix, TSShapeConstructor), "Prefix to apply to all material map names in the COLLADA (.dae) file. No effect for DTS files.\n" "This field is useful to avoid material name clashes for exporters that generate generic material " "names like \"texture0\" or \"material1\"." ); - addField( "alwaysImport", TypeRealString, Offset(mOptions.alwaysImport, TSShapeConstructor), + addField( "alwaysImport", TypeRealString, Offset(mOptions.mAlwaysImport, TSShapeConstructor), "TAB separated patterns of nodes to import even if in neverImport list. No effect for DTS files.\n" "Torque allows unwanted nodes in COLLADA (.dae) files to to be ignored " "during import. This field contains a TAB separated list of patterns to " @@ -215,7 +215,7 @@ void TSShapeConstructor::initPersistFields() "}\n" "@endtsexample" ); - addField( "neverImport", TypeRealString, Offset(mOptions.neverImport, TSShapeConstructor), + addField( "neverImport", TypeRealString, Offset(mOptions.mNeverImport, TSShapeConstructor), "TAB separated patterns of nodes to ignore on loading. No effect for DTS files.\n" "Torque allows unwanted nodes in COLLADA (.dae) files to to be ignored " "during import. This field contains a TAB separated list of patterns to " @@ -223,7 +223,7 @@ void TSShapeConstructor::initPersistFields() "not be imported (unless it matches the alwaysImport list.\n" "@see alwaysImport" ); - addField( "alwaysImportMesh", TypeRealString, Offset(mOptions.alwaysImportMesh, TSShapeConstructor), + addField( "alwaysImportMesh", TypeRealString, Offset(mOptions.mAlwaysImportMesh, TSShapeConstructor), "TAB separated patterns of meshes to import even if in neverImportMesh list. No effect for DTS files.\n" "Torque allows unwanted meshes in COLLADA (.dae) files to to be ignored " "during import. This field contains a TAB separated list of patterns to " @@ -239,7 +239,7 @@ void TSShapeConstructor::initPersistFields() "}\n" "@endtsexample" ); - addField( "neverImportMesh", TypeRealString, Offset(mOptions.neverImportMesh, TSShapeConstructor), + addField( "neverImportMesh", TypeRealString, Offset(mOptions.mNeverImportMesh, TSShapeConstructor), "TAB separated patterns of meshes to ignore on loading. No effect for DTS files.\n" "Torque allows unwanted meshes in COLLADA (.dae) files to to be ignored " "during import. This field contains a TAB separated list of patterns to " @@ -247,21 +247,21 @@ void TSShapeConstructor::initPersistFields() "not be imported (unless it matches the alwaysImportMesh list.\n" "@see alwaysImportMesh" ); - addField( "ignoreNodeScale", TypeBool, Offset(mOptions.ignoreNodeScale, TSShapeConstructor), + addField( "ignoreNodeScale", TypeBool, Offset(mOptions.mIgnoreNodeScale, TSShapeConstructor), "Ignore elements inside COLLADA s. No effect for DTS files.\n" "This field is a workaround for certain exporters that generate bad node " "scaling, and is not usually required." ); - addField( "adjustCenter", TypeBool, Offset(mOptions.adjustCenter, TSShapeConstructor), + addField( "adjustCenter", TypeBool, Offset(mOptions.mAdjustCenter, TSShapeConstructor), "Translate COLLADA model on import so the origin is at the center. No effect for DTS files." ); - addField( "adjustFloor", TypeBool, Offset(mOptions.adjustFloor, TSShapeConstructor), + addField( "adjustFloor", TypeBool, Offset(mOptions.mAdjustFloor, TSShapeConstructor), "Translate COLLADA model on import so origin is at the (Z axis) bottom of the model. No effect for DTS files.\n" "This can be used along with adjustCenter to have the origin at the " "center of the bottom of the model.\n" "@see adjustCenter" ); - addField( "forceUpdateMaterials", TypeBool, Offset(mOptions.forceUpdateMaterials, TSShapeConstructor), + addField( "forceUpdateMaterials", TypeBool, Offset(mOptions.mForceUpdateMaterials, TSShapeConstructor), "Forces update of the materials.cs file in the same folder as the COLLADA " "(.dae) file, even if Materials already exist. No effect for DTS files.\n" "Normally only Materials that are not already defined are written to materials.cs." ); From 9aeb4389f3c8307a3de7dd8938e9d06fe6c7012e Mon Sep 17 00:00:00 2001 From: bank Date: Tue, 13 May 2014 11:32:08 +0400 Subject: [PATCH 10/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - ColladaExtensions --- .../source/ts/collada/colladaAppMaterial.cpp | 8 +- Engine/source/ts/collada/colladaAppMesh.cpp | 8 +- Engine/source/ts/collada/colladaAppNode.cpp | 2 +- .../source/ts/collada/colladaAppSequence.cpp | 14 +- .../source/ts/collada/colladaExtensions.cpp | 24 +-- Engine/source/ts/collada/colladaExtensions.h | 146 +++++++++--------- 6 files changed, 101 insertions(+), 101 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMaterial.cpp b/Engine/source/ts/collada/colladaAppMaterial.cpp index 992c0f57c..ec8bc777f 100644 --- a/Engine/source/ts/collada/colladaAppMaterial.cpp +++ b/Engine/source/ts/collada/colladaAppMaterial.cpp @@ -82,9 +82,9 @@ ColladaAppMaterial::ColladaAppMaterial(const domMaterial *pMat) const domCommon_color_or_texture_type_complexType* domSpecular = findEffectSpecular(effect); // Wrap flags - if (effectExt->wrapU) + if (effectExt->mWrapU) flags |= TSMaterialList::S_Wrap; - if (effectExt->wrapV) + if (effectExt->mWrapV) flags |= TSMaterialList::T_Wrap; // Set material attributes @@ -146,13 +146,13 @@ ColladaAppMaterial::ColladaAppMaterial(const domMaterial *pMat) } // Double-sided flag - doubleSided = effectExt->double_sided; + doubleSided = effectExt->mDoubleSided; // Get the paths for the various textures => Collada indirection at its finest! // ........ diffuseMap = getSamplerImagePath(effect, getTextureSampler(effect, domDiffuse)); specularMap = getSamplerImagePath(effect, getTextureSampler(effect, domSpecular)); - normalMap = getSamplerImagePath(effect, effectExt->bumpSampler); + normalMap = getSamplerImagePath(effect, effectExt->mBumpSampler); // Set the material name name = ColladaUtils::getOptions().mMatNamePrefix; diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index 2b9d601eb..314b71cff 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -354,7 +354,7 @@ MatrixF ColladaAppMesh::getMeshTransform(F32 time) bool ColladaAppMesh::animatesVis(const AppSequence* appSeq) { #define IS_VIS_ANIMATED(node) \ - (dynamic_cast(node)->nodeExt->visibility.isAnimated(appSeq->getStart(), appSeq->getEnd())) + (dynamic_cast(node)->nodeExt->mVisibility.isAnimated(appSeq->getStart(), appSeq->getEnd())) // Check if the node visibility is animated within the sequence interval return IS_VIS_ANIMATED(mAppNode) || (mAppNode->appParent ? IS_VIS_ANIMATED(mAppNode->appParent) : false); @@ -418,7 +418,7 @@ bool ColladaAppMesh::animatesFrame(const AppSequence* appSeq) F32 ColladaAppMesh::getVisValue(F32 t) { #define GET_VIS(node) \ - (dynamic_cast(node)->nodeExt->visibility.getValue(t)) + (dynamic_cast(node)->nodeExt->mVisibility.getValue(t)) // Get the visibility of the mesh's node at time, 't' return GET_VIS(mAppNode) * (mAppNode->appParent ? GET_VIS(mAppNode->appParent) : 1.0f); @@ -529,8 +529,8 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) appMat = static_cast(mAppMaterials[primitive.matIndex & TSDrawPrimitive::MaterialMask]); // Force the material to be double-sided if this geometry is double-sided. - if (mGeomExt->double_sided && appMat && appMat->effectExt) - appMat->effectExt->double_sided = true; + if (mGeomExt->mDoubleSided && appMat && appMat->effectExt) + appMat->effectExt->mDoubleSided = true; // Pre-allocate triangle indices primitive.numElements = numTriangles * 3; diff --git a/Engine/source/ts/collada/colladaAppNode.cpp b/Engine/source/ts/collada/colladaAppNode.cpp index 70dd94154..acc8a18ca 100644 --- a/Engine/source/ts/collada/colladaAppNode.cpp +++ b/Engine/source/ts/collada/colladaAppNode.cpp @@ -66,7 +66,7 @@ ColladaAppNode::ColladaAppNode(const domNode* node, ColladaAppNode* parent) // Extract user properties from the extension as whitespace separated // "name=value" pairs - char* properties = dStrdup(nodeExt->user_properties); + char* properties = dStrdup(nodeExt->mUserProperties); char* pos = properties; char* end = properties + dStrlen( properties ); while ( pos < end ) diff --git a/Engine/source/ts/collada/colladaAppSequence.cpp b/Engine/source/ts/collada/colladaAppSequence.cpp index a3ccc6864..85a283d4e 100644 --- a/Engine/source/ts/collada/colladaAppSequence.cpp +++ b/Engine/source/ts/collada/colladaAppSequence.cpp @@ -45,31 +45,31 @@ const char* ColladaAppSequence::getName() const S32 ColladaAppSequence::getNumTriggers() { - return clipExt->triggers.size(); + return clipExt->mTriggers.size(); } void ColladaAppSequence::getTrigger(S32 index, TSShape::Trigger& trigger) { - trigger.pos = clipExt->triggers[index].time; - trigger.state = clipExt->triggers[index].state; + trigger.pos = clipExt->mTriggers[index].time; + trigger.state = clipExt->mTriggers[index].state; } U32 ColladaAppSequence::getFlags() const { U32 flags = 0; - if (clipExt->cyclic) flags |= TSShape::Cyclic; - if (clipExt->blend) flags |= TSShape::Blend; + if (clipExt->mCyclic) flags |= TSShape::Cyclic; + if (clipExt->mBlend) flags |= TSShape::Blend; return flags; } F32 ColladaAppSequence::getPriority() { - return clipExt->priority; + return clipExt->mPriority; } F32 ColladaAppSequence::getBlendRefTime() { - return clipExt->blendReferenceTime; + return clipExt->mBlendReferenceTime; } void ColladaAppSequence::setActive(bool active) diff --git a/Engine/source/ts/collada/colladaExtensions.cpp b/Engine/source/ts/collada/colladaExtensions.cpp index aed8dc581..cb67688d6 100644 --- a/Engine/source/ts/collada/colladaExtensions.cpp +++ b/Engine/source/ts/collada/colladaExtensions.cpp @@ -29,10 +29,10 @@ /// the interval bool ColladaExtension_effect::animatesTextureTransform(F32 start, F32 end) { - return repeatU.isAnimated(start, end) || repeatV.isAnimated(start, end) || - offsetU.isAnimated(start, end) || offsetV.isAnimated(start, end) || - rotateUV.isAnimated(start, end) || noiseU.isAnimated(start, end) || - noiseV.isAnimated(start, end); + return mRepeatU.isAnimated(start, end) || mRepeatV.isAnimated(start, end) || + mOffsetU.isAnimated(start, end) || mOffsetV.isAnimated(start, end) || + mRotateUV.isAnimated(start, end) || mNoiseU.isAnimated(start, end) || + mNoiseV.isAnimated(start, end); } /// Apply the MAYA texture transform to the given UV coordinates @@ -41,21 +41,21 @@ void ColladaExtension_effect::applyTextureTransform(Point2F& uv, F32 time) // This function will be called for every tvert, every frame. So cache the // texture transform parameters to avoid interpolating them every call (since // they are constant for all tverts for a given 't') - if (time != lastAnimTime) { + if (time != mLastAnimTime) { // Update texture transform - textureTransform.set(EulerF(0, 0, rotateUV.getValue(time))); - textureTransform.setPosition(Point3F( - offsetU.getValue(time) + noiseU.getValue(time)*gRandGen.randF(), - offsetV.getValue(time) + noiseV.getValue(time)*gRandGen.randF(), + mTextureTransform.set(EulerF(0, 0, mRotateUV.getValue(time))); + mTextureTransform.setPosition(Point3F( + mOffsetU.getValue(time) + mNoiseU.getValue(time)*gRandGen.randF(), + mOffsetV.getValue(time) + mNoiseV.getValue(time)*gRandGen.randF(), 0)); - textureTransform.scale(Point3F(repeatU.getValue(time), repeatV.getValue(time), 1.0f)); + mTextureTransform.scale(Point3F(mRepeatU.getValue(time), mRepeatV.getValue(time), 1.0f)); - lastAnimTime = time; + mLastAnimTime = time; } // Apply texture transform Point3F result; - textureTransform.mulP(Point3F(uv.x, uv.y, 0), &result); + mTextureTransform.mulP(Point3F(uv.x, uv.y, 0), &result); uv.x = result.x; uv.y = result.y; diff --git a/Engine/source/ts/collada/colladaExtensions.h b/Engine/source/ts/collada/colladaExtensions.h index a2b92a33d..ea093c052 100644 --- a/Engine/source/ts/collada/colladaExtensions.h +++ b/Engine/source/ts/collada/colladaExtensions.h @@ -53,7 +53,7 @@ class ColladaExtension get(#param, param, defaultVal) protected: - const domTechnique* pTechnique; + const domTechnique* mTechnique; /// Find the technique with the named profile template const domTechnique* findExtraTechnique(const T* element, const char* name) const @@ -86,10 +86,10 @@ protected: /// Find the parameter with the given name const domAny* findParam(const char* name) { - if (pTechnique) { + if (mTechnique) { // search the technique contents for the desired parameter - for (S32 iParam = 0; iParam < pTechnique->getContents().getCount(); iParam++) { - const domAny* param = daeSafeCast(pTechnique->getContents()[iParam]); + for (S32 iParam = 0; iParam < mTechnique->getContents().getCount(); iParam++) { + const domAny* param = daeSafeCast(mTechnique->getContents()[iParam]); if (param && !dStrcmp(param->getElementName(), name)) return param; } @@ -114,7 +114,7 @@ protected: } public: - ColladaExtension() : pTechnique(0) { } + ColladaExtension() : mTechnique(0) { } virtual ~ColladaExtension() { } }; @@ -122,14 +122,14 @@ public: class ColladaExtension_effect : public ColladaExtension { // Cached texture transform - F32 lastAnimTime; - MatrixF textureTransform; + F32 mLastAnimTime; + MatrixF mTextureTransform; public: //---------------------------------- // // MAX3D profile elements - bool double_sided; + bool mDoubleSided; //---------------------------------- // . @@ -139,39 +139,39 @@ public: //---------------------------------- // ..... // MAYA profile elements - bool wrapU, wrapV; - bool mirrorU, mirrorV; - AnimatedFloat coverageU, coverageV; - AnimatedFloat translateFrameU, translateFrameV; - AnimatedFloat rotateFrame; - AnimatedBool stagger; // @todo: not supported yet - AnimatedFloat repeatU, repeatV; - AnimatedFloat offsetU, offsetV; - AnimatedFloat rotateUV; - AnimatedFloat noiseU, noiseV; + bool mWrapU, mWrapV; + bool mMirrorU, mMirrorV; + AnimatedFloat mCoverageU, mCoverageV; + AnimatedFloat mTranslateFrameU, mTranslateFrameV; + AnimatedFloat mRotateFrame; + AnimatedBool mStagger; // @todo: not supported yet + AnimatedFloat mRepeatU, mRepeatV; + AnimatedFloat mOffsetU, mOffsetV; + AnimatedFloat mRotateUV; + AnimatedFloat mNoiseU, mNoiseV; //---------------------------------- // .. // FCOLLADA profile elements - domFx_sampler2D_common_complexType* bumpSampler; + domFx_sampler2D_common_complexType* mBumpSampler; public: ColladaExtension_effect(const domEffect* effect) - : lastAnimTime(TSShapeLoader::DefaultTime-1), textureTransform(true), bumpSampler(0) + : mLastAnimTime(TSShapeLoader::DefaultTime-1), mTextureTransform(true), mBumpSampler(0) { //---------------------------------- // // MAX3D profile - pTechnique = findExtraTechnique(effect, "MAX3D"); - GET_EXTRA_PARAM(double_sided, false); + mTechnique = findExtraTechnique(effect, "MAX3D"); + GET_EXTRA_PARAM(mDoubleSided, false); //---------------------------------- // . const domProfile_COMMON* profileCommon = ColladaUtils::findEffectCommonProfile(effect); // GOOGLEEARTH profile (same double_sided element) - pTechnique = findExtraTechnique(profileCommon, "GOOGLEEARTH"); - GET_EXTRA_PARAM(double_sided, double_sided); + mTechnique = findExtraTechnique(profileCommon, "GOOGLEEARTH"); + GET_EXTRA_PARAM(mDoubleSided, mDoubleSided); //---------------------------------- // ..... @@ -179,43 +179,43 @@ public: const domFx_sampler2D_common_complexType* sampler2D = ColladaUtils::getTextureSampler(effect, domDiffuse); // Use the sampler2D to set default values for wrap/mirror flags - wrapU = wrapV = true; - mirrorU = mirrorV = false; + mWrapU = mWrapV = true; + mMirrorU = mMirrorV = false; if (sampler2D) { domFx_sampler2D_common_complexType::domWrap_s* wrap_s = sampler2D->getWrap_s(); domFx_sampler2D_common_complexType::domWrap_t* wrap_t = sampler2D->getWrap_t(); - mirrorU = (wrap_s && wrap_s->getValue() == FX_SAMPLER_WRAP_COMMON_MIRROR); - wrapU = (mirrorU || !wrap_s || (wrap_s->getValue() == FX_SAMPLER_WRAP_COMMON_WRAP)); - mirrorV = (wrap_t && wrap_t->getValue() == FX_SAMPLER_WRAP_COMMON_MIRROR); - wrapV = (mirrorV || !wrap_t || (wrap_t->getValue() == FX_SAMPLER_WRAP_COMMON_WRAP)); + mMirrorU = (wrap_s && wrap_s->getValue() == FX_SAMPLER_WRAP_COMMON_MIRROR); + mWrapU = (mMirrorU || !wrap_s || (wrap_s->getValue() == FX_SAMPLER_WRAP_COMMON_WRAP)); + mMirrorV = (wrap_t && wrap_t->getValue() == FX_SAMPLER_WRAP_COMMON_MIRROR); + mWrapV = (mMirrorV || !wrap_t || (wrap_t->getValue() == FX_SAMPLER_WRAP_COMMON_WRAP)); } // MAYA profile - pTechnique = findExtraTechnique(domDiffuse ? domDiffuse->getTexture() : 0, "MAYA"); - GET_EXTRA_PARAM(wrapU, wrapU); GET_EXTRA_PARAM(wrapV, wrapV); - GET_EXTRA_PARAM(mirrorU, mirrorU); GET_EXTRA_PARAM(mirrorV, mirrorV); - GET_EXTRA_PARAM(coverageU, 1.0); GET_EXTRA_PARAM(coverageV, 1.0); - GET_EXTRA_PARAM(translateFrameU, 0.0); GET_EXTRA_PARAM(translateFrameV, 0.0); - GET_EXTRA_PARAM(rotateFrame, 0.0); - GET_EXTRA_PARAM(stagger, false); - GET_EXTRA_PARAM(repeatU, 1.0); GET_EXTRA_PARAM(repeatV, 1.0); - GET_EXTRA_PARAM(offsetU, 0.0); GET_EXTRA_PARAM(offsetV, 0.0); - GET_EXTRA_PARAM(rotateUV, 0.0); - GET_EXTRA_PARAM(noiseU, 0.0); GET_EXTRA_PARAM(noiseV, 0.0); + mTechnique = findExtraTechnique(domDiffuse ? domDiffuse->getTexture() : 0, "MAYA"); + GET_EXTRA_PARAM(mWrapU, mWrapU); GET_EXTRA_PARAM(mWrapV, mWrapV); + GET_EXTRA_PARAM(mMirrorU, mMirrorU); GET_EXTRA_PARAM(mMirrorV, mMirrorV); + GET_EXTRA_PARAM(mCoverageU, 1.0); GET_EXTRA_PARAM(mCoverageV, 1.0); + GET_EXTRA_PARAM(mTranslateFrameU, 0.0); GET_EXTRA_PARAM(mTranslateFrameV, 0.0); + GET_EXTRA_PARAM(mRotateFrame, 0.0); + GET_EXTRA_PARAM(mStagger, false); + GET_EXTRA_PARAM(mRepeatU, 1.0); GET_EXTRA_PARAM(mRepeatV, 1.0); + GET_EXTRA_PARAM(mOffsetU, 0.0); GET_EXTRA_PARAM(mOffsetV, 0.0); + GET_EXTRA_PARAM(mRotateUV, 0.0); + GET_EXTRA_PARAM(mNoiseU, 0.0); GET_EXTRA_PARAM(mNoiseV, 0.0); // FCOLLADA profile if (profileCommon) { - pTechnique = findExtraTechnique((const domProfile_COMMON::domTechnique*)profileCommon->getTechnique(), "FCOLLADA"); - if (pTechnique) { - domAny* bump = daeSafeCast(const_cast(pTechnique)->getChild("bump")); + mTechnique = findExtraTechnique((const domProfile_COMMON::domTechnique*)profileCommon->getTechnique(), "FCOLLADA"); + if (mTechnique) { + domAny* bump = daeSafeCast(const_cast(mTechnique)->getChild("bump")); if (bump) { domAny* bumpTexture = daeSafeCast(bump->getChild("texture")); if (bumpTexture) { daeSIDResolver resolver(const_cast(effect), bumpTexture->getAttribute("texture").c_str()); domCommon_newparam_type* param = daeSafeCast(resolver.getElement()); if (param) - bumpSampler = param->getSampler2D(); + mBumpSampler = param->getSampler2D(); } } } @@ -235,21 +235,21 @@ class ColladaExtension_node : public ColladaExtension { public: // FCOLLADA or OpenCOLLADA profile elements - AnimatedFloat visibility; - const char* user_properties; + AnimatedFloat mVisibility; + const char* mUserProperties; ColladaExtension_node(const domNode* node) { // FCOLLADA profile - pTechnique = findExtraTechnique(node, "FCOLLADA"); - GET_EXTRA_PARAM(visibility, 1.0); - GET_EXTRA_PARAM(user_properties, ""); + mTechnique = findExtraTechnique(node, "FCOLLADA"); + GET_EXTRA_PARAM(mVisibility, 1.0); + GET_EXTRA_PARAM(mUserProperties, ""); // OpenCOLLADA profile - pTechnique = findExtraTechnique(node, "OpenCOLLADA"); - if (!visibility.mElement) - GET_EXTRA_PARAM(visibility, 1.0); - GET_EXTRA_PARAM(user_properties, user_properties); + mTechnique = findExtraTechnique(node, "OpenCOLLADA"); + if (!mVisibility.mElement) + GET_EXTRA_PARAM(mVisibility, 1.0); + GET_EXTRA_PARAM(mUserProperties, mUserProperties); } }; @@ -258,13 +258,13 @@ class ColladaExtension_geometry : public ColladaExtension { public: // MAYA profile elements - bool double_sided; + bool mDoubleSided; ColladaExtension_geometry(const domGeometry* geometry) { // MAYA profile - pTechnique = findExtraTechnique(geometry, "MAYA"); - GET_EXTRA_PARAM(double_sided, false); + mTechnique = findExtraTechnique(geometry, "MAYA"); + GET_EXTRA_PARAM(mDoubleSided, false); } }; @@ -278,27 +278,27 @@ public: }; // Torque profile elements (none of these are animatable) - S32 num_triggers; - Vector triggers; - bool cyclic; - bool blend; - F32 blendReferenceTime; - F32 priority; + S32 mNumTriggers; + Vector mTriggers; + bool mCyclic; + bool mBlend; + F32 mBlendReferenceTime; + F32 mPriority; ColladaExtension_animation_clip(const domAnimation_clip* clip) { // Torque profile - pTechnique = findExtraTechnique(clip, "Torque"); - GET_EXTRA_PARAM(num_triggers, 0); - for (S32 iTrigger = 0; iTrigger < num_triggers; iTrigger++) { - triggers.increment(); - get(avar("trigger_time%d", iTrigger), triggers.last().time, 0.0f); - get(avar("trigger_state%d", iTrigger), triggers.last().state, 0); + mTechnique = findExtraTechnique(clip, "Torque"); + GET_EXTRA_PARAM(mNumTriggers, 0); + for (S32 iTrigger = 0; iTrigger < mNumTriggers; iTrigger++) { + mTriggers.increment(); + get(avar("trigger_time%d", iTrigger), mTriggers.last().time, 0.0f); + get(avar("trigger_state%d", iTrigger), mTriggers.last().state, 0); } - GET_EXTRA_PARAM(cyclic, false); - GET_EXTRA_PARAM(blend, false); - GET_EXTRA_PARAM(blendReferenceTime, 0.0f); - GET_EXTRA_PARAM(priority, 5.0f); + GET_EXTRA_PARAM(mCyclic, false); + GET_EXTRA_PARAM(mBlend, false); + GET_EXTRA_PARAM(mBlendReferenceTime, 0.0f); + GET_EXTRA_PARAM(mPriority, 5.0f); } }; From 1778a8d7f21cf9902687deeb6c81bc42f8084ec9 Mon Sep 17 00:00:00 2001 From: bank Date: Tue, 13 May 2014 12:15:47 +0400 Subject: [PATCH 11/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSShapeLoader --- Engine/source/ts/collada/colladaAppNode.cpp | 6 +- Engine/source/ts/collada/colladaExtensions.h | 2 +- Engine/source/ts/collada/colladaLights.cpp | 2 +- .../source/ts/collada/colladaShapeLoader.cpp | 22 +- Engine/source/ts/loader/appMesh.cpp | 4 +- Engine/source/ts/loader/tsShapeLoader.cpp | 496 +++++++++--------- Engine/source/ts/loader/tsShapeLoader.h | 36 +- 7 files changed, 284 insertions(+), 284 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppNode.cpp b/Engine/source/ts/collada/colladaAppNode.cpp index acc8a18ca..67de18048 100644 --- a/Engine/source/ts/collada/colladaAppNode.cpp +++ b/Engine/source/ts/collada/colladaAppNode.cpp @@ -58,7 +58,7 @@ static char* TrimFirstWord(char* str) ColladaAppNode::ColladaAppNode(const domNode* node, ColladaAppNode* parent) : p_domNode(node), appParent(parent), nodeExt(new ColladaExtension_node(node)), - lastTransformTime(TSShapeLoader::DefaultTime-1), defaultTransformValid(false), + lastTransformTime(TSShapeLoader::smDefaultTime-1), defaultTransformValid(false), invertMeshes(false) { mName = dStrdup(_GetNameOrId(node)); @@ -178,7 +178,7 @@ bool ColladaAppNode::animatesTransform(const AppSequence* appSeq) MatrixF ColladaAppNode::getNodeTransform(F32 time) { // Avoid re-computing the default transform if possible - if (defaultTransformValid && time == TSShapeLoader::DefaultTime) + if (defaultTransformValid && time == TSShapeLoader::smDefaultTime) { return defaultNodeTransform; } @@ -198,7 +198,7 @@ MatrixF ColladaAppNode::getNodeTransform(F32 time) } // Cache the default transform - if (time == TSShapeLoader::DefaultTime) + if (time == TSShapeLoader::smDefaultTime) { defaultTransformValid = true; defaultNodeTransform = nodeTransform; diff --git a/Engine/source/ts/collada/colladaExtensions.h b/Engine/source/ts/collada/colladaExtensions.h index ea093c052..d5259eef6 100644 --- a/Engine/source/ts/collada/colladaExtensions.h +++ b/Engine/source/ts/collada/colladaExtensions.h @@ -157,7 +157,7 @@ public: public: ColladaExtension_effect(const domEffect* effect) - : mLastAnimTime(TSShapeLoader::DefaultTime-1), mTextureTransform(true), mBumpSampler(0) + : mLastAnimTime(TSShapeLoader::smDefaultTime-1), mTextureTransform(true), mBumpSampler(0) { //---------------------------------- // diff --git a/Engine/source/ts/collada/colladaLights.cpp b/Engine/source/ts/collada/colladaLights.cpp index 5aee6d43f..47b21d94e 100644 --- a/Engine/source/ts/collada/colladaLights.cpp +++ b/Engine/source/ts/collada/colladaLights.cpp @@ -116,7 +116,7 @@ static void processNodeLights(AppNode* appNode, const MatrixF& offset, SimGroup* Con::printf("Adding <%s> light \"%s\" as a %s", lightType, lightName.c_str(), pLight->getClassName()); MatrixF mat(offset); - mat.mul(appNode->getNodeTransform(TSShapeLoader::DefaultTime)); + mat.mul(appNode->getNodeTransform(TSShapeLoader::smDefaultTime)); pLight->setDataField(StringTable->insert("color"), 0, avar("%f %f %f %f", color.red, color.green, color.blue, color.alpha)); diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index 319173e01..8461b5954 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -230,14 +230,14 @@ void ColladaShapeLoader::enumerateScene() for (S32 iClipLib = 0; iClipLib < root->getLibrary_animation_clips_array().getCount(); iClipLib++) { const domLibrary_animation_clips* libraryClips = root->getLibrary_animation_clips_array()[iClipLib]; for (S32 iClip = 0; iClip < libraryClips->getAnimation_clip_array().getCount(); iClip++) - appSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); + mAppSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); } // Process all animations => this attaches animation channels to the targeted // Collada elements, and determines the length of the sequence if it is not // already specified in the Collada element - for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) { - ColladaAppSequence* appSeq = dynamic_cast(appSequences[iSeq]); + for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) { + ColladaAppSequence* appSeq = dynamic_cast(mAppSequences[iSeq]); F32 maxEndTime = 0; F32 minFrameTime = 1000.0f; for (S32 iAnim = 0; iAnim < appSeq->getClip()->getInstance_animation_array().getCount(); iAnim++) { @@ -251,7 +251,7 @@ void ColladaShapeLoader::enumerateScene() // Collada animations can be stored as sampled frames or true keyframes. For // sampled frames, use the same frame rate as the DAE file. For true keyframes, // resample at a fixed frame rate. - appSeq->fps = mClamp(1.0f / minFrameTime + 0.5f, TSShapeLoader::MinFrameRate, TSShapeLoader::MaxFrameRate); + appSeq->fps = mClamp(1.0f / minFrameTime + 0.5f, TSShapeLoader::smMinFrameRate, TSShapeLoader::smMaxFrameRate); } // First grab all of the top-level nodes @@ -308,7 +308,7 @@ void ColladaShapeLoader::enumerateScene() } // Make sure that the scene has a bounds node (for getting the root scene transform) - if (!boundsNode) + if (!mBoundsNode) { domVisual_scene* visualScene = root->getLibrary_visual_scenes_array()[0]->getVisual_scene_array()[0]; domNode* dombounds = daeSafeCast( visualScene->createAndPlace( "node" ) ); @@ -359,24 +359,24 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) bounds.maxExtents += shapeOffset; // Now adjust all positions for root level nodes (nodes with no parent) - for (S32 iNode = 0; iNode < shape->nodes.size(); iNode++) + for (S32 iNode = 0; iNode < mShape->nodes.size(); iNode++) { - if ( !appNodes[iNode]->isParentRoot() ) + if ( !mAppNodes[iNode]->isParentRoot() ) continue; // Adjust default translation - shape->defaultTranslations[iNode] += shapeOffset; + mShape->defaultTranslations[iNode] += shapeOffset; // Adjust animated translations - for (S32 iSeq = 0; iSeq < shape->sequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < mShape->sequences.size(); iSeq++) { - const TSShape::Sequence& seq = shape->sequences[iSeq]; + const TSShape::Sequence& seq = mShape->sequences[iSeq]; if ( seq.translationMatters.test(iNode) ) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame; - shape->nodeTranslations[index] += shapeOffset; + mShape->nodeTranslations[index] += shapeOffset; } } } diff --git a/Engine/source/ts/loader/appMesh.cpp b/Engine/source/ts/loader/appMesh.cpp index 749431eb0..d7a5088ea 100644 --- a/Engine/source/ts/loader/appMesh.cpp +++ b/Engine/source/ts/loader/appMesh.cpp @@ -47,7 +47,7 @@ void AppMesh::computeBounds(Box3F& bounds) boneTransforms.setSize( mNodeIndex.size() ); for (S32 iBone = 0; iBone < boneTransforms.size(); iBone++) { - MatrixF nodeMat = mBones[iBone]->getNodeTransform( TSShapeLoader::DefaultTime ); + MatrixF nodeMat = mBones[iBone]->getNodeTransform( TSShapeLoader::smDefaultTime ); TSShapeLoader::zapScale(nodeMat); boneTransforms[iBone].mul( nodeMat, mInitialTransforms[iBone] ); } @@ -74,7 +74,7 @@ void AppMesh::computeBounds(Box3F& bounds) } else { - MatrixF transform = getMeshTransform(TSShapeLoader::DefaultTime); + MatrixF transform = getMeshTransform(TSShapeLoader::smDefaultTime); TSShapeLoader::zapScale(transform); for (S32 iVert = 0; iVert < mPoints.size(); iVert++) diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 8b01afab0..464de6a5d 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -31,11 +31,11 @@ #include "ts/tsMaterialList.h" -const F32 TSShapeLoader::DefaultTime = -1.0f; -const F64 TSShapeLoader::MinFrameRate = 15.0f; -const F64 TSShapeLoader::MaxFrameRate = 60.0f; -const F64 TSShapeLoader::AppGroundFrameRate = 10.0f; -Torque::Path TSShapeLoader::shapePath; +const F32 TSShapeLoader::smDefaultTime = -1.0f; +const F64 TSShapeLoader::smMinFrameRate = 15.0f; +const F64 TSShapeLoader::smMaxFrameRate = 60.0f; +const F64 TSShapeLoader::smAppGroundFrameRate = 10.0f; +Torque::Path TSShapeLoader::smShapePath; //------------------------------------------------------------------------------ // Utility functions @@ -57,26 +57,26 @@ MatrixF TSShapeLoader::getLocalNodeMatrix(AppNode* node, F32 t) MatrixF m1 = node->getNodeTransform(t); // multiply by inverse scale at t=0 - MatrixF m10 = node->getNodeTransform(DefaultTime); + MatrixF m10 = node->getNodeTransform(smDefaultTime); m1.scale(Point3F(1.0f/m10.getScale().x, 1.0f/m10.getScale().y, 1.0f/m10.getScale().z)); if (node->mParentIndex >= 0) { - AppNode *parent = appNodes[node->mParentIndex]; + AppNode *parent = mAppNodes[node->mParentIndex]; MatrixF m2 = parent->getNodeTransform(t); // multiply by inverse scale at t=0 - MatrixF m20 = parent->getNodeTransform(DefaultTime); + MatrixF m20 = parent->getNodeTransform(smDefaultTime); m2.scale(Point3F(1.0f/m20.getScale().x, 1.0f/m20.getScale().y, 1.0f/m20.getScale().z)); // get local transform by pre-multiplying by inverted parent transform m1 = m2.inverse() * m1; } - else if (boundsNode && node != boundsNode) + else if (mBoundsNode && node != mBoundsNode) { // make transform relative to bounds node transform at time=t - MatrixF mb = boundsNode->getNodeTransform(t); + MatrixF mb = mBoundsNode->getNodeTransform(t); zapScale(mb); m1 = mb.inverse() * m1; } @@ -122,22 +122,22 @@ void TSShapeLoader::updateProgress(S32 major, const char* msg, S32 numMinor, S32 TSShape* TSShapeLoader::generateShape(const Torque::Path& path) { - shapePath = path; - shape = new TSShape(); + smShapePath = path; + mShape = new TSShape(); - shape->mExporterVersion = 124; - shape->mSmallestVisibleSize = 999999; - shape->mSmallestVisibleDL = 0; - shape->mReadVersion = 24; - shape->mFlags = 0; - shape->mSequencesConstructed = 0; + mShape->mExporterVersion = 124; + mShape->mSmallestVisibleSize = 999999; + mShape->mSmallestVisibleDL = 0; + mShape->mReadVersion = 24; + mShape->mFlags = 0; + mShape->mSequencesConstructed = 0; // Get all nodes, objects and sequences in the shape updateProgress(Load_EnumerateScene, "Enumerating scene..."); enumerateScene(); - if (!subshapes.size()) + if (!mSubShapes.size()) { - delete shape; + delete mShape; Con::errorf("Failed to load shape \"%s\", no subshapes found", path.getFullPath().c_str()); return NULL; } @@ -167,7 +167,7 @@ TSShape* TSShapeLoader::generateShape(const Torque::Path& path) // Install the TS memory helper into a TSShape object. install(); - return shape; + return mShape; } bool TSShapeLoader::processNode(AppNode* node) @@ -175,23 +175,23 @@ bool TSShapeLoader::processNode(AppNode* node) // Detect bounds node if ( node->isBounds() ) { - if ( boundsNode ) + if ( mBoundsNode ) { Con::warnf( "More than one bounds node found" ); return false; } - boundsNode = node; + mBoundsNode = node; // Process bounds geometry - MatrixF boundsMat(boundsNode->getNodeTransform(DefaultTime)); + MatrixF boundsMat(mBoundsNode->getNodeTransform(smDefaultTime)); boundsMat.inverse(); zapScale(boundsMat); - for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) + for (S32 iMesh = 0; iMesh < mBoundsNode->getNumMesh(); iMesh++) { - AppMesh* mesh = boundsNode->getMesh(iMesh); - MatrixF transform = mesh->getMeshTransform(DefaultTime); + AppMesh* mesh = mBoundsNode->getMesh(iMesh); + MatrixF transform = mesh->getMeshTransform(smDefaultTime); transform.mulL(boundsMat); - mesh->lockMesh(DefaultTime, transform); + mesh->lockMesh(smDefaultTime, transform); } return true; } @@ -204,10 +204,10 @@ bool TSShapeLoader::processNode(AppNode* node) } // Add this node to the subshape (create one if needed) - if ( subshapes.size() == 0 ) - subshapes.push_back( new TSShapeLoader::Subshape ); + if ( mSubShapes.size() == 0 ) + mSubShapes.push_back( new TSShapeLoader::Subshape ); - subshapes.last()->branches.push_back( node ); + mSubShapes.last()->branches.push_back( node ); return true; } @@ -252,8 +252,8 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (appNode->isBounds()) return; - S32 subShapeNum = shape->subShapeFirstNode.size()-1; - Subshape* subshape = subshapes[subShapeNum]; + S32 subShapeNum = mShape->subShapeFirstNode.size()-1; + Subshape* subshape = mSubShapes[subShapeNum]; // Check if we should collapse this node S32 myIndex; @@ -264,24 +264,24 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu else { // Check that adding this node will not exceed the maximum node count - if (shape->nodes.size() >= MAX_TS_SET_SIZE) + if (mShape->nodes.size() >= MAX_TS_SET_SIZE) return; - myIndex = shape->nodes.size(); - String nodeName = getUniqueName(appNode->getName(), cmpShapeName, shape->names); + myIndex = mShape->nodes.size(); + String nodeName = getUniqueName(appNode->getName(), cmpShapeName, mShape->names); // Create the 3space node - shape->nodes.increment(); - shape->nodes.last().nameIndex = shape->addName(nodeName); - shape->nodes.last().parentIndex = parentIndex; - shape->nodes.last().firstObject = -1; - shape->nodes.last().firstChild = -1; - shape->nodes.last().nextSibling = -1; + mShape->nodes.increment(); + mShape->nodes.last().nameIndex = mShape->addName(nodeName); + mShape->nodes.last().parentIndex = parentIndex; + mShape->nodes.last().firstObject = -1; + mShape->nodes.last().firstChild = -1; + mShape->nodes.last().nextSibling = -1; // Add the AppNode to a matching list (so AppNodes can be accessed using 3space // node indices) - appNodes.push_back(appNode); - appNodes.last()->mParentIndex = parentIndex; + mAppNodes.push_back(appNode); + mAppNodes.last()->mParentIndex = parentIndex; // Check for NULL detail or AutoBillboard nodes (no children or geometry) if ((appNode->getNumChildNodes() == 0) && @@ -292,7 +292,7 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (dStrEqual(dname, "nulldetail") && (size != 0x7FFFFFFF)) { - shape->addDetail("detail", size, subShapeNum); + mShape->addDetail("detail", size, subShapeNum); } else if (appNode->isBillboard() && (size != 0x7FFFFFFF)) { @@ -311,13 +311,13 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu appNode->getInt("BB::DIM", dim); appNode->getBool("BB::INCLUDE_POLES", includePoles); - S32 detIndex = shape->addDetail( "bbDetail", size, -1 ); - shape->details[detIndex].bbEquatorSteps = numEquatorSteps; - shape->details[detIndex].bbPolarSteps = numPolarSteps; - shape->details[detIndex].bbDetailLevel = dl; - shape->details[detIndex].bbDimension = dim; - shape->details[detIndex].bbIncludePoles = includePoles; - shape->details[detIndex].bbPolarAngle = polarAngle; + S32 detIndex = mShape->addDetail( "bbDetail", size, -1 ); + mShape->details[detIndex].bbEquatorSteps = numEquatorSteps; + mShape->details[detIndex].bbPolarSteps = numPolarSteps; + mShape->details[detIndex].bbDetailLevel = dl; + mShape->details[detIndex].bbDimension = dim; + mShape->details[detIndex].bbIncludePoles = includePoles; + mShape->details[detIndex].bbPolarAngle = polarAngle; } } } @@ -343,23 +343,23 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu void TSShapeLoader::generateSubshapes() { - for (U32 iSub = 0; iSub < subshapes.size(); iSub++) + for (U32 iSub = 0; iSub < mSubShapes.size(); iSub++) { - updateProgress(Load_GenerateSubshapes, "Generating subshapes...", subshapes.size(), iSub); + updateProgress(Load_GenerateSubshapes, "Generating subshapes...", mSubShapes.size(), iSub); - Subshape* subshape = subshapes[iSub]; + Subshape* subshape = mSubShapes[iSub]; // Recurse through the node hierarchy, adding 3space nodes and // collecting geometry - S32 firstNode = shape->nodes.size(); - shape->subShapeFirstNode.push_back(firstNode); + S32 firstNode = mShape->nodes.size(); + mShape->subShapeFirstNode.push_back(firstNode); for (U32 iBranch = 0; iBranch < subshape->branches.size(); iBranch++) recurseSubshape(subshape->branches[iBranch], -1, true); - shape->subShapeNumNodes.push_back(shape->nodes.size() - firstNode); + mShape->subShapeNumNodes.push_back(mShape->nodes.size() - firstNode); - if (shape->nodes.size() >= MAX_TS_SET_SIZE) + if (mShape->nodes.size() >= MAX_TS_SET_SIZE) { Con::warnf("Shape exceeds the maximum node count (%d). Ignoring additional nodes.", MAX_TS_SET_SIZE); @@ -386,10 +386,10 @@ bool cmpMeshNameAndSize(const String& key, const Vector& names, void* ar void TSShapeLoader::generateObjects() { - for (S32 iSub = 0; iSub < subshapes.size(); iSub++) + for (S32 iSub = 0; iSub < mSubShapes.size(); iSub++) { - Subshape* subshape = subshapes[iSub]; - shape->subShapeFirstObject.push_back(shape->objects.size()); + Subshape* subshape = mSubShapes[iSub]; + mShape->subShapeFirstObject.push_back(mShape->objects.size()); // Get the names and sizes of the meshes for this subshape Vector meshNames; @@ -450,17 +450,17 @@ void TSShapeLoader::generateObjects() if (!lastName || (meshNames[iMesh] != *lastName)) { - shape->objects.increment(); - shape->objects.last().nameIndex = shape->addName(meshNames[iMesh]); - shape->objects.last().nodeIndex = subshape->objNodes[iMesh]; - shape->objects.last().startMeshIndex = appMeshes.size(); - shape->objects.last().numMeshes = 0; + mShape->objects.increment(); + mShape->objects.last().nameIndex = mShape->addName(meshNames[iMesh]); + mShape->objects.last().nodeIndex = subshape->objNodes[iMesh]; + mShape->objects.last().startMeshIndex = mAppMeshes.size(); + mShape->objects.last().numMeshes = 0; lastName = &meshNames[iMesh]; } // Add this mesh to the object - appMeshes.push_back(mesh); - shape->objects.last().numMeshes++; + mAppMeshes.push_back(mesh); + mShape->objects.last().numMeshes++; // Set mesh flags mesh->mFlags = 0; @@ -483,9 +483,9 @@ void TSShapeLoader::generateObjects() } // Attempt to add the detail (will fail if it already exists) - S32 oldNumDetails = shape->details.size(); - shape->addDetail(detailName, mesh->mDetailSize, iSub); - if (shape->details.size() > oldNumDetails) + S32 oldNumDetails = mShape->details.size(); + mShape->addDetail(detailName, mesh->mDetailSize, iSub); + if (mShape->details.size() > oldNumDetails) { Con::warnf("Object mesh \"%s\" has no matching detail (\"%s%d\" has" " been added automatically)", mesh->getName(false), detailName, mesh->mDetailSize); @@ -493,18 +493,18 @@ void TSShapeLoader::generateObjects() } // Get object count for this subshape - shape->subShapeNumObjects.push_back(shape->objects.size() - shape->subShapeFirstObject.last()); + mShape->subShapeNumObjects.push_back(mShape->objects.size() - mShape->subShapeFirstObject.last()); } } void TSShapeLoader::generateSkins() { Vector skins; - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { - for (S32 iMesh = 0; iMesh < shape->objects[iObject].numMeshes; iMesh++) + for (S32 iMesh = 0; iMesh < mShape->objects[iObject].numMeshes; iMesh++) { - AppMesh* mesh = appMeshes[shape->objects[iObject].startMeshIndex + iMesh]; + AppMesh* mesh = mAppMeshes[mShape->objects[iObject].startMeshIndex + iMesh]; if (mesh->isSkin()) skins.push_back(mesh); } @@ -528,12 +528,12 @@ void TSShapeLoader::generateSkins() { // Find the node that matches this bone skin->mNodeIndex[iBone] = -1; - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { - if (appNodes[iNode]->isEqual(skin->mBones[iBone])) + if (mAppNodes[iNode]->isEqual(skin->mBones[iBone])) { delete skin->mBones[iBone]; - skin->mBones[iBone] = appNodes[iNode]; + skin->mBones[iBone] = mAppNodes[iNode]; skin->mNodeIndex[iBone] = iNode; break; } @@ -551,37 +551,37 @@ void TSShapeLoader::generateSkins() void TSShapeLoader::generateDefaultStates() { // Generate default object states (includes initial geometry) - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { updateProgress(Load_GenerateDefaultStates, "Generating initial mesh and node states...", - shape->objects.size(), iObject); + mShape->objects.size(), iObject); - TSShape::Object& obj = shape->objects[iObject]; + TSShape::Object& obj = mShape->objects[iObject]; // Calculate the objectOffset for each mesh at T=0 for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) { - AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; - AppNode* appNode = obj.nodeIndex >= 0 ? appNodes[obj.nodeIndex] : boundsNode; + AppMesh* appMesh = mAppMeshes[obj.startMeshIndex + iMesh]; + AppNode* appNode = obj.nodeIndex >= 0 ? mAppNodes[obj.nodeIndex] : mBoundsNode; - MatrixF meshMat(appMesh->getMeshTransform(DefaultTime)); - MatrixF nodeMat(appMesh->isSkin() ? meshMat : appNode->getNodeTransform(DefaultTime)); + MatrixF meshMat(appMesh->getMeshTransform(smDefaultTime)); + MatrixF nodeMat(appMesh->isSkin() ? meshMat : appNode->getNodeTransform(smDefaultTime)); zapScale(nodeMat); appMesh->mObjectOffset = nodeMat.inverse() * meshMat; } - generateObjectState(shape->objects[iObject], DefaultTime, true, true); + generateObjectState(mShape->objects[iObject], smDefaultTime, true, true); } // Generate default node transforms - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Determine the default translation and rotation for the node QuatF rot, srot; Point3F trans, scale; - generateNodeTransform(appNodes[iNode], DefaultTime, false, 0, rot, trans, srot, scale); + generateNodeTransform(mAppNodes[iNode], smDefaultTime, false, 0, rot, trans, srot, scale); // Add default node translation and rotation addNodeRotation(rot, true); @@ -591,20 +591,20 @@ void TSShapeLoader::generateDefaultStates() void TSShapeLoader::generateObjectState(TSShape::Object& obj, F32 t, bool addFrame, bool addMatFrame) { - shape->objectStates.increment(); - TSShape::ObjectState& state = shape->objectStates.last(); + mShape->objectStates.increment(); + TSShape::ObjectState& state = mShape->objectStates.last(); state.frameIndex = 0; state.matFrameIndex = 0; - state.vis = mClampF(appMeshes[obj.startMeshIndex]->getVisValue(t), 0.0f, 1.0f); + state.vis = mClampF(mAppMeshes[obj.startMeshIndex]->getVisValue(t), 0.0f, 1.0f); if (addFrame || addMatFrame) { generateFrame(obj, t, addFrame, addMatFrame); // set the frame number for the object state - state.frameIndex = appMeshes[obj.startMeshIndex]->mNumFrames - 1; - state.matFrameIndex = appMeshes[obj.startMeshIndex]->mNumMatFrames - 1; + state.frameIndex = mAppMeshes[obj.startMeshIndex]->mNumFrames - 1; + state.matFrameIndex = mAppMeshes[obj.startMeshIndex]->mNumMatFrames - 1; } } @@ -612,7 +612,7 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo { for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) { - AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; + AppMesh* appMesh = mAppMeshes[obj.startMeshIndex + iMesh]; U32 oldNumPoints = appMesh->mPoints.size(); U32 oldNumUvs = appMesh->mUVs.size(); @@ -689,13 +689,13 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo void TSShapeLoader::generateMaterialList() { // Install the materials into the material list - shape->materialList = new TSMaterialList; + mShape->materialList = new TSMaterialList; for (S32 iMat = 0; iMat < AppMesh::mAppMaterials.size(); iMat++) { updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::mAppMaterials.size(), iMat); AppMaterial* appMat = AppMesh::mAppMaterials[iMat]; - shape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); + mShape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); } } @@ -705,38 +705,38 @@ void TSShapeLoader::generateMaterialList() void TSShapeLoader::generateSequences() { - for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) { - updateProgress(Load_GenerateSequences, "Generating sequences...", appSequences.size(), iSeq); + updateProgress(Load_GenerateSequences, "Generating sequences...", mAppSequences.size(), iSeq); // Initialize the sequence - appSequences[iSeq]->setActive(true); + mAppSequences[iSeq]->setActive(true); - shape->sequences.increment(); - TSShape::Sequence& seq = shape->sequences.last(); + mShape->sequences.increment(); + TSShape::Sequence& seq = mShape->sequences.last(); - seq.nameIndex = shape->addName(appSequences[iSeq]->getName()); - seq.toolBegin = appSequences[iSeq]->getStart(); - seq.priority = appSequences[iSeq]->getPriority(); - seq.flags = appSequences[iSeq]->getFlags(); + seq.nameIndex = mShape->addName(mAppSequences[iSeq]->getName()); + seq.toolBegin = mAppSequences[iSeq]->getStart(); + seq.priority = mAppSequences[iSeq]->getPriority(); + seq.flags = mAppSequences[iSeq]->getFlags(); // Compute duration and number of keyframes (then adjust time between frames to match) - seq.duration = appSequences[iSeq]->getEnd() - appSequences[iSeq]->getStart(); - seq.numKeyframes = (S32)(seq.duration * appSequences[iSeq]->fps + 0.5f) + 1; + seq.duration = mAppSequences[iSeq]->getEnd() - mAppSequences[iSeq]->getStart(); + seq.numKeyframes = (S32)(seq.duration * mAppSequences[iSeq]->fps + 0.5f) + 1; seq.sourceData.start = 0; seq.sourceData.end = seq.numKeyframes-1; seq.sourceData.total = seq.numKeyframes; // Set membership arrays (ie. which nodes and objects are affected by this sequence) - setNodeMembership(seq, appSequences[iSeq]); - setObjectMembership(seq, appSequences[iSeq]); + setNodeMembership(seq, mAppSequences[iSeq]); + setObjectMembership(seq, mAppSequences[iSeq]); // Generate keyframes generateNodeAnimation(seq); - generateObjectAnimation(seq, appSequences[iSeq]); - generateGroundAnimation(seq, appSequences[iSeq]); - generateFrameTriggers(seq, appSequences[iSeq]); + generateObjectAnimation(seq, mAppSequences[iSeq]); + generateGroundAnimation(seq, mAppSequences[iSeq]); + generateFrameTriggers(seq, mAppSequences[iSeq]); // Set sequence flags seq.dirtyFlags = 0; @@ -750,11 +750,11 @@ void TSShapeLoader::generateSequences() seq.dirtyFlags |= TSShapeInstance::MatFrameDirty; // Set shape flags (only the most significant scale type) - U32 curVal = shape->mFlags & TSShape::AnyScale; - shape->mFlags &= ~(TSShape::AnyScale); - shape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards) + U32 curVal = mShape->mFlags & TSShape::AnyScale; + mShape->mFlags &= ~(TSShape::AnyScale); + mShape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards) - appSequences[iSeq]->setActive(false); + mAppSequences[iSeq]->setActive(false); } } @@ -783,16 +783,16 @@ void TSShapeLoader::setNodeMembership(TSShape::Sequence& seq, const AppSequence* void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) { - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Check if any of the node rotations are different to // the default rotation QuatF defaultRot; - shape->defaultRotations[iNode].getQuatF(&defaultRot); + mShape->defaultRotations[iNode].getQuatF(&defaultRot); for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - if (nodeRotCache[iNode][iFrame] != defaultRot) + if (mNodeRotCache[iNode][iFrame] != defaultRot) { seq.rotationMatters.set(iNode); break; @@ -803,15 +803,15 @@ void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) void TSShapeLoader::setTranslationMembership(TSShape::Sequence& seq) { - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Check if any of the node translations are different to // the default translation - Point3F& defaultTrans = shape->defaultTranslations[iNode]; + Point3F& defaultTrans = mShape->defaultTranslations[iNode]; for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - if (!nodeTransCache[iNode][iFrame].equal(defaultTrans)) + if (!mNodeTransCache[iNode][iFrame].equal(defaultTrans)) { seq.translationMatters.set(iNode); break; @@ -828,16 +828,16 @@ void TSShapeLoader::setScaleMembership(TSShape::Sequence& seq) U32 alignedScaleCount = 0; U32 uniformScaleCount = 0; - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Check if any of the node scales are not the unit scale for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - Point3F& scale = nodeScaleCache[iNode][iFrame]; + Point3F& scale = mNodeScaleCache[iNode][iFrame]; if (!unitScale.equal(scale)) { // Determine what type of scale this is - if (!nodeScaleRotCache[iNode][iFrame].isIdentity()) + if (!mNodeScaleRotCache[iNode][iFrame].isIdentity()) arbitraryScaleCount++; else if (scale.x != scale.y || scale.y != scale.z) alignedScaleCount++; @@ -865,12 +865,12 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc seq.frameMatters.clearAll(); // vert animation (morph) (size = objects.size()) seq.matFrameMatters.clearAll(); // UV animation (size = objects.size()) - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { - if (!appMeshes[shape->objects[iObject].startMeshIndex]) + if (!mAppMeshes[mShape->objects[iObject].startMeshIndex]) continue; - if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) + if (mAppMeshes[mShape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) seq.visMatters.set(iObject); // Morph and UV animation has been deprecated //if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesFrame(appSeq)) @@ -883,18 +883,18 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc void TSShapeLoader::clearNodeTransformCache() { // clear out the transform caches - for (S32 i = 0; i < nodeRotCache.size(); i++) - delete [] nodeRotCache[i]; - nodeRotCache.clear(); - for (S32 i = 0; i < nodeTransCache.size(); i++) - delete [] nodeTransCache[i]; - nodeTransCache.clear(); - for (S32 i = 0; i < nodeScaleRotCache.size(); i++) - delete [] nodeScaleRotCache[i]; - nodeScaleRotCache.clear(); - for (S32 i = 0; i < nodeScaleCache.size(); i++) - delete [] nodeScaleCache[i]; - nodeScaleCache.clear(); + for (S32 i = 0; i < mNodeRotCache.size(); i++) + delete [] mNodeRotCache[i]; + mNodeRotCache.clear(); + for (S32 i = 0; i < mNodeTransCache.size(); i++) + delete [] mNodeTransCache[i]; + mNodeTransCache.clear(); + for (S32 i = 0; i < mNodeScaleRotCache.size(); i++) + delete [] mNodeScaleRotCache[i]; + mNodeScaleRotCache.clear(); + for (S32 i = 0; i < mNodeScaleCache.size(); i++) + delete [] mNodeScaleCache[i]; + mNodeScaleCache.clear(); } void TSShapeLoader::fillNodeTransformCache(TSShape::Sequence& seq, const AppSequence* appSeq) @@ -902,28 +902,28 @@ void TSShapeLoader::fillNodeTransformCache(TSShape::Sequence& seq, const AppSequ // clear out the transform caches and set it up for this sequence clearNodeTransformCache(); - nodeRotCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeRotCache.size(); i++) - nodeRotCache[i] = new QuatF[seq.numKeyframes]; - nodeTransCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeTransCache.size(); i++) - nodeTransCache[i] = new Point3F[seq.numKeyframes]; - nodeScaleRotCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeScaleRotCache.size(); i++) - nodeScaleRotCache[i] = new QuatF[seq.numKeyframes]; - nodeScaleCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeScaleCache.size(); i++) - nodeScaleCache[i] = new Point3F[seq.numKeyframes]; + mNodeRotCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeRotCache.size(); i++) + mNodeRotCache[i] = new QuatF[seq.numKeyframes]; + mNodeTransCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeTransCache.size(); i++) + mNodeTransCache[i] = new Point3F[seq.numKeyframes]; + mNodeScaleRotCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeScaleRotCache.size(); i++) + mNodeScaleRotCache[i] = new QuatF[seq.numKeyframes]; + mNodeScaleCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeScaleCache.size(); i++) + mNodeScaleCache[i] = new Point3F[seq.numKeyframes]; // get the node transforms for every frame for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { - generateNodeTransform(appNodes[iNode], time, seq.isBlend(), appSeq->getBlendRefTime(), - nodeRotCache[iNode][iFrame], nodeTransCache[iNode][iFrame], - nodeScaleRotCache[iNode][iFrame], nodeScaleCache[iNode][iFrame]); + generateNodeTransform(mAppNodes[iNode], time, seq.isBlend(), appSeq->getBlendRefTime(), + mNodeRotCache[iNode][iFrame], mNodeTransCache[iNode][iFrame], + mNodeScaleRotCache[iNode][iFrame], mNodeScaleCache[iNode][iFrame]); } } } @@ -934,57 +934,57 @@ void TSShapeLoader::addNodeRotation(QuatF& rot, bool defaultVal) rot16.set(rot); if (!defaultVal) - shape->nodeRotations.push_back(rot16); + mShape->nodeRotations.push_back(rot16); else - shape->defaultRotations.push_back(rot16); + mShape->defaultRotations.push_back(rot16); } void TSShapeLoader::addNodeTranslation(Point3F& trans, bool defaultVal) { if (!defaultVal) - shape->nodeTranslations.push_back(trans); + mShape->nodeTranslations.push_back(trans); else - shape->defaultTranslations.push_back(trans); + mShape->defaultTranslations.push_back(trans); } void TSShapeLoader::addNodeUniformScale(F32 scale) { - shape->nodeUniformScales.push_back(scale); + mShape->nodeUniformScales.push_back(scale); } void TSShapeLoader::addNodeAlignedScale(Point3F& scale) { - shape->nodeAlignedScales.push_back(scale); + mShape->nodeAlignedScales.push_back(scale); } void TSShapeLoader::addNodeArbitraryScale(QuatF& qrot, Point3F& scale) { Quat16 rot16; rot16.set(qrot); - shape->nodeArbitraryScaleRots.push_back(rot16); - shape->nodeArbitraryScaleFactors.push_back(scale); + mShape->nodeArbitraryScaleRots.push_back(rot16); + mShape->nodeArbitraryScaleFactors.push_back(scale); } void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) { - seq.baseRotation = shape->nodeRotations.size(); - seq.baseTranslation = shape->nodeTranslations.size(); - seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? shape->nodeArbitraryScaleRots.size() : - (seq.flags & TSShape::AlignedScale) ? shape->nodeAlignedScales.size() : - shape->nodeUniformScales.size(); + seq.baseRotation = mShape->nodeRotations.size(); + seq.baseTranslation = mShape->nodeTranslations.size(); + seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? mShape->nodeArbitraryScaleRots.size() : + (seq.flags & TSShape::AlignedScale) ? mShape->nodeAlignedScales.size() : + mShape->nodeUniformScales.size(); - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { if (seq.rotationMatters.test(iNode)) - addNodeRotation(nodeRotCache[iNode][iFrame], false); + addNodeRotation(mNodeRotCache[iNode][iFrame], false); if (seq.translationMatters.test(iNode)) - addNodeTranslation(nodeTransCache[iNode][iFrame], false); + addNodeTranslation(mNodeTransCache[iNode][iFrame], false); if (seq.scaleMatters.test(iNode)) { - QuatF& rot = nodeScaleRotCache[iNode][iFrame]; - Point3F scale = nodeScaleCache[iNode][iFrame]; + QuatF& rot = mNodeScaleRotCache[iNode][iFrame]; + Point3F scale = mNodeScaleCache[iNode][iFrame]; if (seq.flags & TSShape::ArbitraryScale) addNodeArbitraryScale(rot, scale); @@ -999,9 +999,9 @@ void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.baseObjectState = shape->objectStates.size(); + seq.baseObjectState = mShape->objectStates.size(); - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { bool visMatters = seq.visMatters.test(iObject); bool frameMatters = seq.frameMatters.test(iObject); @@ -1012,7 +1012,7 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - generateObjectState(shape->objects[iObject], time, frameMatters, matFrameMatters); + generateObjectState(mShape->objects[iObject], time, frameMatters, matFrameMatters); } } } @@ -1020,19 +1020,19 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.firstGroundFrame = shape->groundTranslations.size(); + seq.firstGroundFrame = mShape->groundTranslations.size(); seq.numGroundFrames = 0; - if (!boundsNode) + if (!mBoundsNode) return; // Check if the bounds node is animated by this sequence - seq.numGroundFrames = (S32)((seq.duration + 0.25f/AppGroundFrameRate) * AppGroundFrameRate); + seq.numGroundFrames = (S32)((seq.duration + 0.25f/smAppGroundFrameRate) * smAppGroundFrameRate); seq.flags |= TSShape::MakePath; // Get ground transform at the start of the sequence - MatrixF invStartMat = boundsNode->getNodeTransform(appSeq->getStart()); + MatrixF invStartMat = mBoundsNode->getNodeTransform(appSeq->getStart()); zapScale(invStartMat); invStartMat.inverse(); @@ -1041,22 +1041,22 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numGroundFrames - 1); // Determine delta bounds node transform at 't' - MatrixF mat = boundsNode->getNodeTransform(time); + MatrixF mat = mBoundsNode->getNodeTransform(time); zapScale(mat); mat = invStartMat * mat; // Add ground transform Quat16 rotation; rotation.set(QuatF(mat)); - shape->groundTranslations.push_back(mat.getPosition()); - shape->groundRotations.push_back(rotation); + mShape->groundTranslations.push_back(mat.getPosition()); + mShape->groundRotations.push_back(rotation); } } void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSequence* appSeq) { // Initialize triggers - seq.firstTrigger = shape->triggers.size(); + seq.firstTrigger = mShape->triggers.size(); seq.numTriggers = appSeq->getNumTriggers(); if (!seq.numTriggers) return; @@ -1066,8 +1066,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // Add triggers for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - shape->triggers.increment(); - appSeq->getTrigger(iTrigger, shape->triggers.last()); + mShape->triggers.increment(); + appSeq->getTrigger(iTrigger, mShape->triggers.last()); } // Track the triggers that get turned off by this shape...normally, triggers @@ -1077,7 +1077,7 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque U32 offTriggers = 0; for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - U32 state = shape->triggers[seq.firstTrigger+iTrigger].state; + U32 state = mShape->triggers[seq.firstTrigger+iTrigger].state; if ((state & TSShape::Trigger::StateOn) == 0) offTriggers |= (state & TSShape::Trigger::StateMask); } @@ -1085,8 +1085,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // We now know which states are turned off, set invert on all those (including when turned on) for (int iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - if (shape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) - shape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; + if (mShape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) + mShape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; } } @@ -1098,36 +1098,36 @@ void TSShapeLoader::sortDetails() // Insert NULL meshes where required - for (S32 iSub = 0; iSub < subshapes.size(); iSub++) + for (S32 iSub = 0; iSub < mSubShapes.size(); iSub++) { Vector validDetails; - shape->getSubShapeDetails(iSub, validDetails); + mShape->getSubShapeDetails(iSub, validDetails); for (S32 iDet = 0; iDet < validDetails.size(); iDet++) { - TSShape::Detail &detail = shape->details[validDetails[iDet]]; + TSShape::Detail &detail = mShape->details[validDetails[iDet]]; if (detail.subShapeNum >= 0) detail.objectDetailNum = iDet; - for (S32 iObj = shape->subShapeFirstObject[iSub]; - iObj < (shape->subShapeFirstObject[iSub] + shape->subShapeNumObjects[iSub]); + for (S32 iObj = mShape->subShapeFirstObject[iSub]; + iObj < (mShape->subShapeFirstObject[iSub] + mShape->subShapeNumObjects[iSub]); iObj++) { - TSShape::Object &object = shape->objects[iObj]; + TSShape::Object &object = mShape->objects[iObj]; // Insert a NULL mesh for this detail level if required (ie. if the // object does not already have a mesh with an equal or higher detail) S32 meshIndex = (iDet < object.numMeshes) ? iDet : object.numMeshes-1; - if (appMeshes[object.startMeshIndex + meshIndex]->mDetailSize < shape->details[iDet].size) + if (mAppMeshes[object.startMeshIndex + meshIndex]->mDetailSize < mShape->details[iDet].size) { // Add a NULL mesh - appMeshes.insert(object.startMeshIndex + iDet, NULL); + mAppMeshes.insert(object.startMeshIndex + iDet, NULL); object.numMeshes++; // Fixup the start index for the other objects - for (S32 k = iObj+1; k < shape->objects.size(); k++) - shape->objects[k].startMeshIndex++; + for (S32 k = iObj+1; k < mShape->objects.size(); k++) + mShape->objects[k].startMeshIndex++; } } } @@ -1142,76 +1142,76 @@ void TSShapeLoader::install() { // Arrays that are filled in by ts shape init, but need // to be allocated beforehand. - shape->subShapeFirstTranslucentObject.setSize(shape->subShapeFirstObject.size()); + mShape->subShapeFirstTranslucentObject.setSize(mShape->subShapeFirstObject.size()); // Construct TS sub-meshes - shape->meshes.setSize(appMeshes.size()); - for (U32 m = 0; m < appMeshes.size(); m++) - shape->meshes[m] = appMeshes[m] ? appMeshes[m]->constructTSMesh() : NULL; + mShape->meshes.setSize(mAppMeshes.size()); + for (U32 m = 0; m < mAppMeshes.size(); m++) + mShape->meshes[m] = mAppMeshes[m] ? mAppMeshes[m]->constructTSMesh() : NULL; // Remove empty meshes and objects - for (S32 iObj = shape->objects.size()-1; iObj >= 0; iObj--) + for (S32 iObj = mShape->objects.size()-1; iObj >= 0; iObj--) { - TSShape::Object& obj = shape->objects[iObj]; + TSShape::Object& obj = mShape->objects[iObj]; for (S32 iMesh = obj.numMeshes-1; iMesh >= 0; iMesh--) { - TSMesh *mesh = shape->meshes[obj.startMeshIndex + iMesh]; + TSMesh *mesh = mShape->meshes[obj.startMeshIndex + iMesh]; if (mesh && !mesh->primitives.size()) { S32 oldMeshCount = obj.numMeshes; destructInPlace(mesh); - shape->removeMeshFromObject(iObj, iMesh); + mShape->removeMeshFromObject(iObj, iMesh); iMesh -= (oldMeshCount - obj.numMeshes - 1); // handle when more than one mesh is removed } } if (!obj.numMeshes) - shape->removeObject(shape->getName(obj.nameIndex)); + mShape->removeObject(mShape->getName(obj.nameIndex)); } // Add a dummy object if needed so the shape loads and renders ok - if (!shape->details.size()) + if (!mShape->details.size()) { - shape->addDetail("detail", 2, 0); - shape->subShapeNumObjects.last() = 1; + mShape->addDetail("detail", 2, 0); + mShape->subShapeNumObjects.last() = 1; - shape->meshes.push_back(NULL); + mShape->meshes.push_back(NULL); - shape->objects.increment(); - shape->objects.last().nameIndex = shape->addName("dummy"); - shape->objects.last().nodeIndex = 0; - shape->objects.last().startMeshIndex = 0; - shape->objects.last().numMeshes = 1; + mShape->objects.increment(); + mShape->objects.last().nameIndex = mShape->addName("dummy"); + mShape->objects.last().nodeIndex = 0; + mShape->objects.last().startMeshIndex = 0; + mShape->objects.last().numMeshes = 1; - shape->objectStates.increment(); - shape->objectStates.last().frameIndex = 0; - shape->objectStates.last().matFrameIndex = 0; - shape->objectStates.last().vis = 1.0f; + mShape->objectStates.increment(); + mShape->objectStates.last().frameIndex = 0; + mShape->objectStates.last().matFrameIndex = 0; + mShape->objectStates.last().vis = 1.0f; } // Update smallest visible detail - shape->mSmallestVisibleDL = -1; - shape->mSmallestVisibleSize = 999999; - for (S32 i = 0; i < shape->details.size(); i++) + mShape->mSmallestVisibleDL = -1; + mShape->mSmallestVisibleSize = 999999; + for (S32 i = 0; i < mShape->details.size(); i++) { - if ((shape->details[i].size >= 0) && - (shape->details[i].size < shape->mSmallestVisibleSize)) + if ((mShape->details[i].size >= 0) && + (mShape->details[i].size < mShape->mSmallestVisibleSize)) { - shape->mSmallestVisibleDL = i; - shape->mSmallestVisibleSize = shape->details[i].size; + mShape->mSmallestVisibleDL = i; + mShape->mSmallestVisibleSize = mShape->details[i].size; } } - computeBounds(shape->bounds); - if (!shape->bounds.isValidBox()) - shape->bounds = Box3F(1.0f); + computeBounds(mShape->bounds); + if (!mShape->bounds.isValidBox()) + mShape->bounds = Box3F(1.0f); - shape->bounds.getCenter(&shape->center); - shape->radius = (shape->bounds.maxExtents - shape->center).len(); - shape->tubeRadius = shape->radius; + mShape->bounds.getCenter(&mShape->center); + mShape->radius = (mShape->bounds.maxExtents - mShape->center).len(); + mShape->tubeRadius = mShape->radius; - shape->init(); + mShape->init(); } void TSShapeLoader::computeBounds(Box3F& bounds) @@ -1220,11 +1220,11 @@ void TSShapeLoader::computeBounds(Box3F& bounds) bounds = Box3F::Invalid; // Use bounds node geometry if present - if ( boundsNode && boundsNode->getNumMesh() ) + if ( mBoundsNode && mBoundsNode->getNumMesh() ) { - for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) + for (S32 iMesh = 0; iMesh < mBoundsNode->getNumMesh(); iMesh++) { - AppMesh* mesh = boundsNode->getMesh( iMesh ); + AppMesh* mesh = mBoundsNode->getMesh( iMesh ); if ( !mesh ) continue; @@ -1237,9 +1237,9 @@ void TSShapeLoader::computeBounds(Box3F& bounds) else { // Compute bounds based on all geometry in the model - for (S32 iMesh = 0; iMesh < appMeshes.size(); iMesh++) + for (S32 iMesh = 0; iMesh < mAppMeshes.size(); iMesh++) { - AppMesh* mesh = appMeshes[iMesh]; + AppMesh* mesh = mAppMeshes[iMesh]; if ( !mesh ) continue; @@ -1261,12 +1261,12 @@ TSShapeLoader::~TSShapeLoader() AppMesh::mAppMaterials.clear(); // Delete Subshapes - delete boundsNode; - for (S32 iSub = 0; iSub < subshapes.size(); iSub++) - delete subshapes[iSub]; + delete mBoundsNode; + for (S32 iSub = 0; iSub < mSubShapes.size(); iSub++) + delete mSubShapes[iSub]; // Delete AppSequences - for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) - delete appSequences[iSeq]; - appSequences.clear(); + for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) + delete mAppSequences[iSeq]; + mAppSequences.clear(); } diff --git a/Engine/source/ts/loader/tsShapeLoader.h b/Engine/source/ts/loader/tsShapeLoader.h index 2c76ffbb2..425aa5e26 100644 --- a/Engine/source/ts/loader/tsShapeLoader.h +++ b/Engine/source/ts/loader/tsShapeLoader.h @@ -81,31 +81,31 @@ protected: }; public: - static const F32 DefaultTime; - static const F64 MinFrameRate; - static const F64 MaxFrameRate; - static const F64 AppGroundFrameRate; + static const F32 smDefaultTime; + static const F64 smMinFrameRate; + static const F64 smMaxFrameRate; + static const F64 smAppGroundFrameRate; protected: // Variables used during loading that must be held until the shape is deleted - TSShape* shape; - Vector appMeshes; + TSShape* mShape; + Vector mAppMeshes; // Variables used during loading, but that can be discarded afterwards - static Torque::Path shapePath; + static Torque::Path smShapePath; - AppNode* boundsNode; - Vector appNodes; ///< Nodes in the loaded shape - Vector appSequences; + AppNode* mBoundsNode; + Vector mAppNodes; ///< Nodes in the loaded shape + Vector mAppSequences; - Vector subshapes; + Vector mSubShapes; - Vector nodeRotCache; - Vector nodeTransCache; - Vector nodeScaleRotCache; - Vector nodeScaleCache; + Vector mNodeRotCache; + Vector mNodeTransCache; + Vector mNodeScaleRotCache; + Vector mNodeScaleCache; - Point3F shapeOffset; ///< Offset used to translate the shape origin + Point3F mShapeOffset; ///< Offset used to translate the shape origin //-------------------------------------------------------------------------- @@ -170,10 +170,10 @@ protected: void install(); public: - TSShapeLoader() : boundsNode(0) { } + TSShapeLoader() : mBoundsNode(0) { } virtual ~TSShapeLoader(); - static const Torque::Path& getShapePath() { return shapePath; } + static const Torque::Path& getShapePath() { return smShapePath; } static void zapScale(MatrixF& mat); From e2545c359c850ccdcd2310a75b9b506a17179f0f Mon Sep 17 00:00:00 2001 From: bank Date: Tue, 13 May 2014 12:43:01 +0400 Subject: [PATCH 12/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSMesh --- .../source/gui/editor/guiShapeEdPreview.cpp | 6 +- Engine/source/ts/loader/appMesh.cpp | 24 +- Engine/source/ts/loader/tsShapeLoader.cpp | 2 +- Engine/source/ts/tsCollision.cpp | 30 +- Engine/source/ts/tsMesh.cpp | 530 +++++++++--------- Engine/source/ts/tsMesh.h | 48 +- Engine/source/ts/tsMeshFit.cpp | 86 +-- Engine/source/ts/tsShape.cpp | 36 +- Engine/source/ts/tsShapeConstruct.cpp | 8 +- Engine/source/ts/tsShapeEdit.cpp | 34 +- Engine/source/ts/tsSortedMesh.cpp | 6 +- Engine/source/ts/tsSortedMesh.h | 2 +- 12 files changed, 406 insertions(+), 406 deletions(-) diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 098ff38f3..6d0841d7f 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -1228,9 +1228,9 @@ void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state) continue; // Count the number of draw calls and materials - mNumDrawCalls += mesh->primitives.size(); - for ( S32 iPrim = 0; iPrim < mesh->primitives.size(); iPrim++ ) - usedMaterials.push_back_unique( mesh->primitives[iPrim].matIndex & TSDrawPrimitive::MaterialMask ); + mNumDrawCalls += mesh->mPrimitives.size(); + for ( S32 iPrim = 0; iPrim < mesh->mPrimitives.size(); iPrim++ ) + usedMaterials.push_back_unique( mesh->mPrimitives[iPrim].matIndex & TSDrawPrimitive::MaterialMask ); // For skinned meshes, count the number of bones and weights if ( mesh->getMeshType() == TSMesh::SkinMeshType ) diff --git a/Engine/source/ts/loader/appMesh.cpp b/Engine/source/ts/loader/appMesh.cpp index d7a5088ea..404d81bdb 100644 --- a/Engine/source/ts/loader/appMesh.cpp +++ b/Engine/source/ts/loader/appMesh.cpp @@ -147,22 +147,22 @@ TSMesh* AppMesh::constructTSMesh() } // Copy mesh elements - tsmesh->verts = mPoints; - tsmesh->norms = mNormals; - tsmesh->tverts = mUVs; - tsmesh->primitives = mPrimitives; - tsmesh->indices = mIndices; - tsmesh->colors = mColors; - tsmesh->tverts2 = mUV2s; + tsmesh->mVerts = mPoints; + tsmesh->mNorms = mNormals; + tsmesh->mTVerts = mUVs; + tsmesh->mPrimitives = mPrimitives; + tsmesh->mIndices = mIndices; + tsmesh->mColors = mColors; + tsmesh->mTVerts2 = mUV2s; // Finish initializing the shape tsmesh->setFlags(mFlags); tsmesh->computeBounds(); - tsmesh->numFrames = mNumFrames; - tsmesh->numMatFrames = mNumMatFrames; - tsmesh->vertsPerFrame = mVertsPerFrame; - tsmesh->createTangents(tsmesh->verts, tsmesh->norms); - tsmesh->encodedNorms.set(NULL,0); + tsmesh->mNumFrames = mNumFrames; + tsmesh->mNumMatFrames = mNumMatFrames; + tsmesh->mVertsPerFrame = mVertsPerFrame; + tsmesh->createTangents(tsmesh->mVerts, tsmesh->mNorms); + tsmesh->mEncodedNorms.set(NULL,0); return tsmesh; } diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 464de6a5d..542c23530 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -1157,7 +1157,7 @@ void TSShapeLoader::install() { TSMesh *mesh = mShape->meshes[obj.startMeshIndex + iMesh]; - if (mesh && !mesh->primitives.size()) + if (mesh && !mesh->mPrimitives.size()) { S32 oldMeshCount = obj.numMeshes; destructInPlace(mesh); diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index bb57bf1c5..47cf594ed 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1364,9 +1364,9 @@ void TSMesh::prepOpcodeCollision() // Figure out how many triangles we have... U32 triCount = 0; const U32 base = 0; - for ( U32 i = 0; i < primitives.size(); i++ ) + for ( U32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; const U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -1377,16 +1377,16 @@ void TSMesh::prepOpcodeCollision() else { // Have to walk the tristrip to get a count... may have degenerates - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -1396,7 +1396,7 @@ void TSMesh::prepOpcodeCollision() } // Just do the first trilist for now. - mi->SetNbVertices( mVertexData.isReady() ? mNumVerts : verts.size() ); + mi->SetNbVertices( mVertexData.isReady() ? mNumVerts : mVerts.size() ); mi->SetNbTriangles( triCount ); // Stuff everything into appropriate arrays. @@ -1407,9 +1407,9 @@ void TSMesh::prepOpcodeCollision() mOpPoints = pts; // add the polys... - for ( U32 i = 0; i < primitives.size(); i++ ) + for ( U32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; const U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -1421,9 +1421,9 @@ void TSMesh::prepOpcodeCollision() { for ( S32 j = 0; j < draw.numElements; ) { - curIts->mVRef[2] = base + indices[start + j + 0]; - curIts->mVRef[1] = base + indices[start + j + 1]; - curIts->mVRef[0] = base + indices[start + j + 2]; + curIts->mVRef[2] = base + mIndices[start + j + 0]; + curIts->mVRef[1] = base + mIndices[start + j + 1]; + curIts->mVRef[0] = base + mIndices[start + j + 2]; curIts->mMatIdx = matIndex; curIts++; @@ -1434,16 +1434,16 @@ void TSMesh::prepOpcodeCollision() { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -1462,7 +1462,7 @@ void TSMesh::prepOpcodeCollision() if( mVertexData.isReady() ) pts[i].Set( mVertexData[i].vert().x, mVertexData[i].vert().y, mVertexData[i].vert().z ); else - pts[i].Set( verts[i].x, verts[i].y, verts[i].z ); + pts[i].Set( mVerts[i].x, mVerts[i].y, mVerts[i].z ); mi->SetPointers( its, pts ); diff --git a/Engine/source/ts/tsMesh.cpp b/Engine/source/ts/tsMesh.cpp index f1af288f1..c5d5e9f3a 100644 --- a/Engine/source/ts/tsMesh.cpp +++ b/Engine/source/ts/tsMesh.cpp @@ -126,7 +126,7 @@ void TSMesh::innerRender( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb GFX->setVertexBuffer( vb ); GFX->setPrimitiveBuffer( pb ); - for( U32 p = 0; p < primitives.size(); p++ ) + for( U32 p = 0; p < mPrimitives.size(); p++ ) GFX->drawPrimitive( p ); } @@ -152,7 +152,7 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata, { PROFILE_SCOPE( TSMesh_InnerRender ); - if( vertsPerFrame <= 0 ) + if( mVertsPerFrame <= 0 ) return; F32 meshVisibility = rdata.getFadeOverride() * mVisibility; @@ -213,9 +213,9 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata, // NOTICE: SFXBB is removed and refraction is disabled! //coreRI->backBuffTex = GFX->getSfxBackBuffer(); - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - const TSDrawPrimitive &draw = primitives[i]; + const TSDrawPrimitive &draw = mPrimitives[i]; // We need to have a material. if ( draw.matIndex & TSDrawPrimitive::NoMaterial ) @@ -242,7 +242,7 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata, #ifndef TORQUE_OS_MAC // Get the instancing material if this mesh qualifies. - if ( meshType != SkinMeshType && pb->mPrimitiveArray[i].numVertices < smMaxInstancingVerts ) + if ( mMeshType != SkinMeshType && pb->mPrimitiveArray[i].numVertices < smMaxInstancingVerts ) matInst = InstancingMaterialHook::getInstancingMat( matInst ); #endif @@ -280,14 +280,14 @@ const Point3F * TSMesh::getNormals( S32 firstVert ) { if ( getFlags( UseEncodedNormals ) ) { - gNormalStore.setSize( vertsPerFrame ); - for ( S32 i = 0; i < encodedNorms.size(); i++ ) - gNormalStore[i] = decodeNormal( encodedNorms[ i + firstVert ] ); + gNormalStore.setSize( mVertsPerFrame ); + for ( S32 i = 0; i < mEncodedNorms.size(); i++ ) + gNormalStore[i] = decodeNormal( mEncodedNorms[ i + firstVert ] ); return gNormalStore.address(); } - return &norms[firstVert]; + return &mNorms[firstVert]; } //----------------------------------------------------- @@ -296,10 +296,10 @@ const Point3F * TSMesh::getNormals( S32 firstVert ) bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceKey, TSMaterialList *materials ) { - S32 firstVert = vertsPerFrame * frame, i, base = 0; + S32 firstVert = mVertsPerFrame * frame, i, base = 0; // add the verts... - if ( vertsPerFrame ) + if ( mVertsPerFrame ) { if ( mVertexData.isReady() ) { @@ -307,7 +307,7 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK if ( opList ) { base = opList->mVertexList.size(); - for ( i = 0; i < vertsPerFrame; i++ ) + for ( i = 0; i < mVertsPerFrame; i++ ) { // Don't use vertex() method as we want to retain the original indices OptimizedPolyList::VertIndex vert; @@ -323,7 +323,7 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK else { base = polyList->addPointAndNormal( mVertexData[firstVert].vert(), mVertexData[firstVert].normal() ); - for ( i = 1; i < vertsPerFrame; i++ ) + for ( i = 1; i < mVertsPerFrame; i++ ) { polyList->addPointAndNormal( mVertexData[ i + firstVert ].vert(), mVertexData[ i + firstVert ].normal() ); } @@ -335,32 +335,32 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK if ( opList ) { base = opList->mVertexList.size(); - for ( i = 0; i < vertsPerFrame; i++ ) + for ( i = 0; i < mVertsPerFrame; i++ ) { // Don't use vertex() method as we want to retain the original indices OptimizedPolyList::VertIndex vert; - vert.vertIdx = opList->insertPoint( verts[ i + firstVert ] ); - vert.normalIdx = opList->insertNormal( norms[ i + firstVert ] ); - vert.uv0Idx = opList->insertUV0( tverts[ i + firstVert ] ); + vert.vertIdx = opList->insertPoint( mVerts[ i + firstVert ] ); + vert.normalIdx = opList->insertNormal( mNorms[ i + firstVert ] ); + vert.uv0Idx = opList->insertUV0( mTVerts[ i + firstVert ] ); if ( mHasTVert2 ) - vert.uv1Idx = opList->insertUV1( tverts2[ i + firstVert ] ); + vert.uv1Idx = opList->insertUV1( mTVerts2[ i + firstVert ] ); opList->mVertexList.push_back( vert ); } } else { - base = polyList->addPointAndNormal( verts[firstVert], norms[firstVert] ); - for ( i = 1; i < vertsPerFrame; i++ ) - polyList->addPointAndNormal( verts[ i + firstVert ], norms[ i + firstVert ] ); + base = polyList->addPointAndNormal( mVerts[firstVert], mNorms[firstVert] ); + for ( i = 1; i < mVertsPerFrame; i++ ) + polyList->addPointAndNormal( mVerts[ i + firstVert ], mNorms[ i + firstVert ] ); } } } // add the polys... - for ( i = 0; i < primitives.size(); i++ ) + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -373,9 +373,9 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { for ( S32 j = 0; j < draw.numElements; ) { - U32 idx0 = base + indices[start + j + 0]; - U32 idx1 = base + indices[start + j + 1]; - U32 idx2 = base + indices[start + j + 2]; + U32 idx0 = base + mIndices[start + j + 0]; + U32 idx1 = base + mIndices[start + j + 1]; + U32 idx2 = base + mIndices[start + j + 2]; polyList->begin(material,surfaceKey++); polyList->vertex( idx0 ); polyList->vertex( idx1 ); @@ -389,16 +389,16 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -416,20 +416,20 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexFeature* cf, U32& ) { - S32 firstVert = vertsPerFrame * frame; + S32 firstVert = mVertsPerFrame * frame; S32 i; S32 base = cf->mVertexList.size(); - for ( i = 0; i < vertsPerFrame; i++ ) + for ( i = 0; i < mVertsPerFrame; i++ ) { cf->mVertexList.increment(); mat.mulP( mVertexData[firstVert + i].vert(), &cf->mVertexList.last() ); } // add the polys... - for ( i = 0; i < primitives.size(); i++ ) + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -439,22 +439,22 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF { for ( S32 j = 0; j < draw.numElements; j += 3 ) { - PlaneF plane( cf->mVertexList[base + indices[start + j + 0]], - cf->mVertexList[base + indices[start + j + 1]], - cf->mVertexList[base + indices[start + j + 2]]); + PlaneF plane( cf->mVertexList[base + mIndices[start + j + 0]], + cf->mVertexList[base + mIndices[start + j + 1]], + cf->mVertexList[base + mIndices[start + j + 2]]); cf->mFaceList.increment(); cf->mFaceList.last().normal = plane; - cf->mFaceList.last().vertex[0] = base + indices[start + j + 0]; - cf->mFaceList.last().vertex[1] = base + indices[start + j + 1]; - cf->mFaceList.last().vertex[2] = base + indices[start + j + 2]; + cf->mFaceList.last().vertex[0] = base + mIndices[start + j + 0]; + cf->mFaceList.last().vertex[1] = base + mIndices[start + j + 1]; + cf->mFaceList.last().vertex[2] = base + mIndices[start + j + 2]; for ( U32 l = 0; l < 3; l++ ) { U32 newEdge0, newEdge1; - U32 zero = base + indices[start + j + l]; - U32 one = base + indices[start + j + ((l+1)%3)]; + U32 zero = base + mIndices[start + j + l]; + U32 one = base + mIndices[start + j + ((l+1)%3)]; newEdge0 = getMin( zero, one ); newEdge1 = getMax( zero, one ); bool found = false; @@ -481,15 +481,15 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -575,23 +575,23 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF void TSMesh::support( S32 frame, const Point3F &v, F32 *currMaxDP, Point3F *currSupport ) { - if ( vertsPerFrame == 0 ) + if ( mVertsPerFrame == 0 ) return; U32 waterMark = FrameAllocator::getWaterMark(); - F32* pDots = (F32*)FrameAllocator::alloc( sizeof(F32) * vertsPerFrame ); + F32* pDots = (F32*)FrameAllocator::alloc( sizeof(F32) * mVertsPerFrame ); - S32 firstVert = vertsPerFrame * frame; + S32 firstVert = mVertsPerFrame * frame; m_point3F_bulk_dot( &v.x, &mVertexData[firstVert].vert().x, - vertsPerFrame, + mVertsPerFrame, mVertexData.vertSize(), pDots ); F32 localdp = *currMaxDP; S32 index = -1; - for ( S32 i = 0; i < vertsPerFrame; i++ ) + for ( S32 i = 0; i < mVertsPerFrame; i++ ) { if ( pDots[i] > localdp ) { @@ -611,7 +611,7 @@ void TSMesh::support( S32 frame, const Point3F &v, F32 *currMaxDP, Point3F *curr bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList* materials ) { - if ( planeNormals.empty() ) + if ( mPlaneNormals.empty() ) buildConvexHull(); // if haven't done it yet... // Keep track of startTime and endTime. They start out at just under 0 and just over 1, respectively. @@ -641,15 +641,15 @@ bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, Ray S32 * pplane = &curPlane; bool * pfound = &found; - S32 startPlane = frame * planesPerFrame; - for ( S32 i = startPlane; i < startPlane + planesPerFrame; i++ ) + S32 startPlane = frame * mPlanesPerFrame; + for ( S32 i = startPlane; i < startPlane + mPlanesPerFrame; i++ ) { // if start & end outside, no collision // if start & end inside, continue // if start outside, end inside, or visa versa, find intersection of line with plane // then update intersection of line with hull (using startTime and endTime) - F32 dot1 = mDot( planeNormals[i], start ) - planeConstants[i]; - F32 dot2 = mDot( planeNormals[i], end) - planeConstants[i]; + F32 dot1 = mDot( mPlaneNormals[i], start ) - mPlaneConstants[i]; + F32 dot2 = mDot( mPlaneNormals[i], end) - mPlaneConstants[i]; if ( dot1 * dot2 > 0.0f ) { // same side of the plane...which side -- dot==0 considered inside @@ -731,10 +731,10 @@ bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, Ray // setup rayInfo if ( found && rayInfo ) { - curMaterial = planeMaterials[ curPlane - startPlane ]; + curMaterial = mPlaneMaterials[ curPlane - startPlane ]; rayInfo->t = (F32)startNum/(F32)startDen; // finally divide... - rayInfo->normal = planeNormals[curPlane]; + rayInfo->normal = mPlaneNormals[curPlane]; if (materials && materials->size() > 0) rayInfo->material = materials->getMaterialInst( curMaterial ); @@ -755,13 +755,13 @@ bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, Ray bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList* materials ) { - if( vertsPerFrame <= 0 ) + if( mVertsPerFrame <= 0 ) return false; if( mNumVerts == 0 ) return false; - S32 firstVert = vertsPerFrame * frame; + S32 firstVert = mVertsPerFrame * frame; bool found = false; F32 best_t = F32_MAX; @@ -769,9 +769,9 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & BaseMatInstance* bestMaterial = NULL; Point3F dir = end - start; - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 drawStart = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::castRayRendered (1)" ); @@ -786,9 +786,9 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & { for ( S32 j = 0; j < draw.numElements-2; j++) { - idx0 = indices[drawStart + j + 0]; - idx1 = indices[drawStart + j + 1]; - idx2 = indices[drawStart + j + 2]; + idx0 = mIndices[drawStart + j + 0]; + idx1 = mIndices[drawStart + j + 1]; + idx2 = mIndices[drawStart + j + 2]; F32 cur_t = 0; Point2F b; @@ -812,15 +812,15 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::castRayRendered (2)" ); - idx0 = indices[drawStart + 0]; - idx2 = indices[drawStart + 1]; + idx0 = mIndices[drawStart + 0]; + idx2 = mIndices[drawStart + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = indices[drawStart + j]; + idx2 = mIndices[drawStart + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -905,35 +905,35 @@ bool TSMesh::addToHull( U32 idx0, U32 idx1, U32 idx2 ) normal.normalize(); F32 k = mDot( normal, mVertexData[idx0].vert() ); - for ( S32 i = 0; i < planeNormals.size(); i++ ) + for ( S32 i = 0; i < mPlaneNormals.size(); i++ ) { - if ( mDot( planeNormals[i], normal ) > 0.99f && mFabs( k-planeConstants[i] ) < 0.01f ) + if ( mDot( mPlaneNormals[i], normal ) > 0.99f && mFabs( k-mPlaneConstants[i] ) < 0.01f ) return false; // this is a repeat... } // new plane, add it to the list... - planeNormals.push_back( normal ); - planeConstants.push_back( k ); + mPlaneNormals.push_back( normal ); + mPlaneConstants.push_back( k ); return true; } bool TSMesh::buildConvexHull() { // already done, return without error - if ( planeNormals.size() ) + if ( mPlaneNormals.size() ) return true; bool error = false; // should probably only have 1 frame, but just in case... - planesPerFrame = 0; + mPlanesPerFrame = 0; S32 frame, i, j; - for ( frame = 0; frame < numFrames; frame++ ) + for ( frame = 0; frame < mNumFrames; frame++ ) { - S32 firstVert = vertsPerFrame * frame; - S32 firstPlane = planeNormals.size(); - for ( i = 0; i < primitives.size(); i++ ) + S32 firstVert = mVertsPerFrame * frame; + S32 firstPlane = mPlaneNormals.size(); + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildConvexHull (1)" ); @@ -942,71 +942,71 @@ bool TSMesh::buildConvexHull() if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { for ( j = 0; j < draw.numElements; j += 3 ) - if ( addToHull( indices[start + j + 0] + firstVert, - indices[start + j + 1] + firstVert, - indices[start + j + 2] + firstVert ) && frame == 0 ) - planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); + if ( addToHull( mIndices[start + j + 0] + firstVert, + mIndices[start + j + 1] + firstVert, + mIndices[start + j + 2] + firstVert ) && frame == 0 ) + mPlaneMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } else { AssertFatal( (draw.matIndex&TSDrawPrimitive::Strip) == TSDrawPrimitive::Strip,"TSMesh::buildConvexHull (2)" ); - U32 idx0 = indices[start + 0] + firstVert; + U32 idx0 = mIndices[start + 0] + firstVert; U32 idx1; - U32 idx2 = indices[start + 1] + firstVert; + U32 idx2 = mIndices[start + 1] + firstVert; U32 * nextIdx = &idx1; for ( j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1 ); - idx2 = indices[start + j] + firstVert; + idx2 = mIndices[start + j] + firstVert; if ( addToHull( idx0, idx1, idx2 ) && frame == 0 ) - planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); + mPlaneMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } } } // make sure all the verts on this frame are inside all the planes - for ( i = 0; i < vertsPerFrame; i++ ) - for ( j = firstPlane; j < planeNormals.size(); j++ ) - if ( mDot( mVertexData[firstVert + i].vert(), planeNormals[j] ) - planeConstants[j] < 0.01 ) // .01 == a little slack + for ( i = 0; i < mVertsPerFrame; i++ ) + for ( j = firstPlane; j < mPlaneNormals.size(); j++ ) + if ( mDot( mVertexData[firstVert + i].vert(), mPlaneNormals[j] ) - mPlaneConstants[j] < 0.01 ) // .01 == a little slack error = true; if ( frame == 0 ) - planesPerFrame = planeNormals.size(); + mPlanesPerFrame = mPlaneNormals.size(); - if ( (frame + 1) * planesPerFrame != planeNormals.size() ) + if ( (frame + 1) * mPlanesPerFrame != mPlaneNormals.size() ) { // eek, not all frames have same number of planes... - while ( (frame + 1) * planesPerFrame > planeNormals.size() ) + while ( (frame + 1) * mPlanesPerFrame > mPlaneNormals.size() ) { // we're short, duplicate last plane till we match - U32 sz = planeNormals.size(); - planeNormals.increment(); - planeNormals.last() = planeNormals[sz-1]; - planeConstants.increment(); - planeConstants.last() = planeConstants[sz-1]; + U32 sz = mPlaneNormals.size(); + mPlaneNormals.increment(); + mPlaneNormals.last() = mPlaneNormals[sz-1]; + mPlaneConstants.increment(); + mPlaneConstants.last() = mPlaneConstants[sz-1]; } - while ( (frame + 1) * planesPerFrame < planeNormals.size() ) + while ( (frame + 1) * mPlanesPerFrame < mPlaneNormals.size() ) { // harsh -- last frame has more than other frames // duplicate last plane in each frame for ( S32 k = frame - 1; k >= 0; k-- ) { - planeNormals.insert( k * planesPerFrame + planesPerFrame ); - planeNormals[k * planesPerFrame + planesPerFrame] = planeNormals[k * planesPerFrame + planesPerFrame - 1]; - planeConstants.insert( k * planesPerFrame + planesPerFrame ); - planeConstants[k * planesPerFrame + planesPerFrame] = planeConstants[k * planesPerFrame + planesPerFrame - 1]; + mPlaneNormals.insert( k * mPlanesPerFrame + mPlanesPerFrame ); + mPlaneNormals[k * mPlanesPerFrame + mPlanesPerFrame] = mPlaneNormals[k * mPlanesPerFrame + mPlanesPerFrame - 1]; + mPlaneConstants.insert( k * mPlanesPerFrame + mPlanesPerFrame ); + mPlaneConstants[k * mPlanesPerFrame + mPlanesPerFrame] = mPlaneConstants[k * mPlanesPerFrame + mPlanesPerFrame - 1]; if ( k == 0 ) { - planeMaterials.increment(); - planeMaterials.last() = planeMaterials[planeMaterials.size() - 2]; + mPlaneMaterials.increment(); + mPlaneMaterials.last() = mPlaneMaterials[mPlaneMaterials.size() - 2]; } } - planesPerFrame++; + mPlanesPerFrame++; } } - AssertFatal( (frame + 1) * planesPerFrame == planeNormals.size(),"TSMesh::buildConvexHull (3)" ); + AssertFatal( (frame + 1) * mPlanesPerFrame == mPlaneNormals.size(),"TSMesh::buildConvexHull (3)" ); } return !error; } @@ -1036,21 +1036,21 @@ void TSMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 frame, numVerts = mNumVerts; else { - baseVert = &mVertexData[frame * vertsPerFrame].vert(); - numVerts = vertsPerFrame; + baseVert = &mVertexData[frame * mVertsPerFrame].vert(); + numVerts = mVertsPerFrame; } } else { - baseVert = verts.address(); + baseVert = mVerts.address(); stride = sizeof(Point3F); if ( frame < 0 ) - numVerts = verts.size(); + numVerts = mVerts.size(); else { - baseVert += frame * vertsPerFrame; - numVerts = vertsPerFrame; + baseVert += frame * mVertsPerFrame; + numVerts = mVertsPerFrame; } } computeBounds( baseVert, numVerts, stride, transform, bounds, center, radius ); @@ -1107,27 +1107,27 @@ void TSMesh::computeBounds( const Point3F *v, S32 numVerts, S32 stride, const Ma S32 TSMesh::getNumPolys() const { S32 count = 0; - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - switch (primitives[i].matIndex & TSDrawPrimitive::TypeMask) + switch (mPrimitives[i].matIndex & TSDrawPrimitive::TypeMask) { case TSDrawPrimitive::Triangles: - count += primitives[i].numElements / 3; + count += mPrimitives[i].numElements / 3; break; case TSDrawPrimitive::Fan: - count += primitives[i].numElements - 2; + count += mPrimitives[i].numElements - 2; break; case TSDrawPrimitive::Strip: // Don't count degenerate triangles - for ( S32 j = primitives[i].start; - j < primitives[i].start+primitives[i].numElements-2; + for ( S32 j = mPrimitives[i].start; + j < mPrimitives[i].start+mPrimitives[i].numElements-2; j++ ) { - if ((indices[j] != indices[j+1]) && - (indices[j] != indices[j+2]) && - (indices[j+1] != indices[j+2])) + if ((mIndices[j] != mIndices[j+1]) && + (mIndices[j] != mIndices[j+2]) && + (mIndices[j+1] != mIndices[j+2])) count++; } break; @@ -1138,12 +1138,12 @@ S32 TSMesh::getNumPolys() const //----------------------------------------------------- -TSMesh::TSMesh() : meshType( StandardMeshType ) +TSMesh::TSMesh() : mMeshType( StandardMeshType ) { - VECTOR_SET_ASSOCIATION( planeNormals ); - VECTOR_SET_ASSOCIATION( planeConstants ); - VECTOR_SET_ASSOCIATION( planeMaterials ); - parentMesh = -1; + VECTOR_SET_ASSOCIATION( mPlaneNormals ); + VECTOR_SET_ASSOCIATION( mPlaneConstants ); + VECTOR_SET_ASSOCIATION( mPlaneMaterials ); + mParentMesh = -1; mOptTree = NULL; mOpMeshInterface = NULL; @@ -1184,17 +1184,17 @@ void TSSkinMesh::updateSkin( const Vector &transforms, TSVertexBufferHa // set arrays #if defined(TORQUE_MAX_LIB) - verts.setSize(batchData.initialVerts.size()); - norms.setSize(batchData.initialNorms.size()); + mVerts.setSize(batchData.initialVerts.size()); + mNorms.setSize(batchData.initialNorms.size()); #else - if ( !batchDataInitialized && encodedNorms.size() ) + if ( !batchDataInitialized && mEncodedNorms.size() ) { // we co-opt responsibility for updating encoded normals from mesh - gNormalStore.setSize( vertsPerFrame ); - for ( S32 i = 0; i < vertsPerFrame; i++ ) - gNormalStore[i] = decodeNormal( encodedNorms[i] ); + gNormalStore.setSize( mVertsPerFrame ); + for ( S32 i = 0; i < mVertsPerFrame; i++ ) + gNormalStore[i] = decodeNormal( mEncodedNorms[i] ); - batchData.initialNorms.set( gNormalStore.address(), vertsPerFrame ); + batchData.initialNorms.set( gNormalStore.address(), mVertsPerFrame ); } #endif @@ -1497,7 +1497,7 @@ void TSSkinMesh::render( TSMaterialList *materials, createBatchData(); const bool vertsChanged = vertexBuffer.isNull() || vertexBuffer->mNumVerts != mNumVerts; - const bool primsChanged = primitiveBuffer.isNull() || primitiveBuffer->mIndexCount != indices.size(); + const bool primsChanged = primitiveBuffer.isNull() || primitiveBuffer->mIndexCount != mIndices.size(); if ( primsChanged || vertsChanged || isSkinDirty ) { @@ -2406,17 +2406,17 @@ void TSMesh::_createVBIB( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb } #endif - const bool primsChanged = ( pb.isValid() && pb->mIndexCount != indices.size() ); + const bool primsChanged = ( pb.isValid() && pb->mIndexCount != mIndices.size() ); if( primsChanged || pb.isNull() ) { // go through and create PrimitiveInfo array Vector piArray; GFXPrimitive pInfo; - U32 primitivesSize = primitives.size(); + U32 primitivesSize = mPrimitives.size(); for ( U32 i = 0; i < primitivesSize; i++ ) { - const TSDrawPrimitive & draw = primitives[i]; + const TSDrawPrimitive & draw = mPrimitives[i]; GFXPrimitiveType drawType = getDrawType( draw.matIndex >> 30 ); @@ -2427,7 +2427,7 @@ void TSMesh::_createVBIB( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb pInfo.numPrimitives = draw.numElements / 3; pInfo.startIndex = draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = indices[draw.start] & 0xFFFF0000; + pInfo.startVertex = mIndices[draw.start] & 0xFFFF0000; pInfo.minIndex = pInfo.startVertex; pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex); break; @@ -2438,7 +2438,7 @@ void TSMesh::_createVBIB( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb pInfo.numPrimitives = draw.numElements - 2; pInfo.startIndex = draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = indices[draw.start] & 0xFFFF0000; + pInfo.startVertex = mIndices[draw.start] & 0xFFFF0000; pInfo.minIndex = pInfo.startVertex; pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex); break; @@ -2450,13 +2450,13 @@ void TSMesh::_createVBIB( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb piArray.push_back( pInfo ); } - pb.set( GFX, indices.size(), piArray.size(), GFXBufferTypeStatic ); + pb.set( GFX, mIndices.size(), piArray.size(), GFXBufferTypeStatic ); U16 *ibIndices = NULL; GFXPrimitive *piInput = NULL; pb.lock( &ibIndices, &piInput ); - dCopyArray( ibIndices, indices.address(), indices.size() ); + dCopyArray( ibIndices, mIndices.address(), mIndices.size() ); dMemcpy( piInput, piArray.address(), piArray.size() * sizeof(GFXPrimitive) ); pb.unlock(); @@ -2467,59 +2467,59 @@ void TSMesh::assemble( bool skip ) { tsalloc.checkGuard(); - numFrames = tsalloc.get32(); - numMatFrames = tsalloc.get32(); - parentMesh = tsalloc.get32(); + mNumFrames = tsalloc.get32(); + mNumMatFrames = tsalloc.get32(); + mParentMesh = tsalloc.get32(); tsalloc.get32( (S32*)&mBounds, 6 ); tsalloc.get32( (S32*)&mCenter, 3 ); mRadius = (F32)tsalloc.get32(); S32 numVerts = tsalloc.get32(); - S32 *ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); - verts.set( (Point3F*)ptr32, numVerts ); + S32 *ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); + mVerts.set( (Point3F*)ptr32, numVerts ); S32 numTVerts = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); - tverts.set( (Point2F*)ptr32, numTVerts ); + ptr32 = getSharedData32( mParentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); + mTVerts.set( (Point2F*)ptr32, numTVerts ); if ( TSShape::smReadVersion > 25 ) { numTVerts = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); - tverts2.set( (Point2F*)ptr32, numTVerts ); + ptr32 = getSharedData32( mParentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); + mTVerts2.set( (Point2F*)ptr32, numTVerts ); S32 numVColors = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, numVColors, (S32**)smColorsList.address(), skip ); - colors.set( (ColorI*)ptr32, numVColors ); + ptr32 = getSharedData32( mParentMesh, numVColors, (S32**)smColorsList.address(), skip ); + mColors.set( (ColorI*)ptr32, numVColors ); } S8 *ptr8; if ( TSShape::smReadVersion > 21 && TSMesh::smUseEncodedNormals) { // we have encoded normals and we want to use them... - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) tsalloc.getPointer32( numVerts * 3 ); // advance past norms, don't use - norms.set( NULL, 0 ); + mNorms.set( NULL, 0 ); - ptr8 = getSharedData8( parentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); - encodedNorms.set( ptr8, numVerts ); + ptr8 = getSharedData8( mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); + mEncodedNorms.set( ptr8, numVerts ); } else if ( TSShape::smReadVersion > 21 ) { // we have encoded normals but we don't want to use them... - ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - norms.set( (Point3F*)ptr32, numVerts ); + ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + mNorms.set( (Point3F*)ptr32, numVerts ); - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) tsalloc.getPointer8( numVerts ); // advance past encoded normls, don't use - encodedNorms.set( NULL, 0 ); + mEncodedNorms.set( NULL, 0 ); } else { // no encoded normals... - ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - norms.set( (Point3F*)ptr32, numVerts ); - encodedNorms.set( NULL, 0 ); + ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + mNorms.set( (Point3F*)ptr32, numVerts ); + mEncodedNorms.set( NULL, 0 ); } // copy the primitives and indices...how we do this depends on what @@ -2593,8 +2593,8 @@ void TSMesh::assemble( bool skip ) AssertFatal(chkPrim==szPrimOut && chkInd==szIndOut,"TSMesh::primitive conversion"); // store output - primitives.set(primOut, szPrimOut); - indices.set(indOut, szIndOut); + mPrimitives.set(primOut, szPrimOut); + mIndices.set(indOut, szIndOut); // delete temporary arrays if necessary if (deleteInputArrays) @@ -2607,9 +2607,9 @@ void TSMesh::assemble( bool skip ) tsalloc.getPointer16( sz ); // skip deprecated merge indices tsalloc.align32(); - vertsPerFrame = tsalloc.get32(); + mVertsPerFrame = tsalloc.get32(); U32 flags = (U32)tsalloc.get32(); - if ( encodedNorms.size() ) + if ( mEncodedNorms.size() ) flags |= UseEncodedNormals; setFlags( flags ); @@ -2620,16 +2620,16 @@ void TSMesh::assemble( bool skip ) computeBounds(); // only do this if we copied the data... if(getMeshType() != SkinMeshType) - createTangents(verts, norms); + createTangents(mVerts, mNorms); } void TSMesh::disassemble() { tsalloc.setGuard(); - tsalloc.set32( numFrames ); - tsalloc.set32( numMatFrames ); - tsalloc.set32( parentMesh ); + tsalloc.set32( mNumFrames ); + tsalloc.set32( mNumMatFrames ); + tsalloc.set32( mParentMesh ); tsalloc.copyToBuffer32( (S32*)&mBounds, 6 ); tsalloc.copyToBuffer32( (S32*)&mCenter, 3 ); tsalloc.set32( (S32)mRadius ); @@ -2637,81 +2637,81 @@ void TSMesh::disassemble() // Re-create the vectors if(mVertexData.isReady()) { - verts.setSize(mNumVerts); - tverts.setSize(mNumVerts); - norms.setSize(mNumVerts); + mVerts.setSize(mNumVerts); + mTVerts.setSize(mNumVerts); + mNorms.setSize(mNumVerts); if(mHasColor) - colors.setSize(mNumVerts); + mColors.setSize(mNumVerts); if(mHasTVert2) - tverts2.setSize(mNumVerts); + mTVerts2.setSize(mNumVerts); // Fill arrays for(U32 i = 0; i < mNumVerts; i++) { const __TSMeshVertexBase &cv = mVertexData[i]; - verts[i] = cv.vert(); - tverts[i] = cv.tvert(); - norms[i] = cv.normal(); + mVerts[i] = cv.vert(); + mTVerts[i] = cv.tvert(); + mNorms[i] = cv.normal(); if(mHasColor) - cv.color().getColor(&colors[i]); + cv.color().getColor(&mColors[i]); if(mHasTVert2) - tverts2[i] = cv.tvert2(); + mTVerts2[i] = cv.tvert2(); } } // verts... - tsalloc.set32( verts.size() ); - if ( parentMesh < 0 ) - tsalloc.copyToBuffer32( (S32*)verts.address(), 3 * verts.size() ); // if no parent mesh, then save off our verts + tsalloc.set32( mVerts.size() ); + if ( mParentMesh < 0 ) + tsalloc.copyToBuffer32( (S32*)mVerts.address(), 3 * mVerts.size() ); // if no parent mesh, then save off our verts // tverts... - tsalloc.set32( tverts.size() ); - if ( parentMesh < 0 ) - tsalloc.copyToBuffer32( (S32*)tverts.address(), 2 * tverts.size() ); // if no parent mesh, then save off our tverts + tsalloc.set32( mTVerts.size() ); + if ( mParentMesh < 0 ) + tsalloc.copyToBuffer32( (S32*)mTVerts.address(), 2 * mTVerts.size() ); // if no parent mesh, then save off our tverts if (TSShape::smVersion > 25) { // tverts2... - tsalloc.set32( tverts2.size() ); - if ( parentMesh < 0 ) - tsalloc.copyToBuffer32( (S32*)tverts2.address(), 2 * tverts2.size() ); // if no parent mesh, then save off our tverts + tsalloc.set32( mTVerts2.size() ); + if ( mParentMesh < 0 ) + tsalloc.copyToBuffer32( (S32*)mTVerts2.address(), 2 * mTVerts2.size() ); // if no parent mesh, then save off our tverts // colors - tsalloc.set32( colors.size() ); - if ( parentMesh < 0 ) - tsalloc.copyToBuffer32( (S32*)colors.address(), colors.size() ); // if no parent mesh, then save off our tverts + tsalloc.set32( mColors.size() ); + if ( mParentMesh < 0 ) + tsalloc.copyToBuffer32( (S32*)mColors.address(), mColors.size() ); // if no parent mesh, then save off our tverts } // norms... - if ( parentMesh < 0 ) // if no parent mesh, then save off our norms - tsalloc.copyToBuffer32( (S32*)norms.address(), 3 * norms.size() ); // norms.size()==verts.size() or error... + if ( mParentMesh < 0 ) // if no parent mesh, then save off our norms + tsalloc.copyToBuffer32( (S32*)mNorms.address(), 3 * mNorms.size() ); // norms.size()==verts.size() or error... // encoded norms... - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) { // if no parent mesh, compute encoded normals and copy over - for ( S32 i = 0; i < norms.size(); i++ ) + for ( S32 i = 0; i < mNorms.size(); i++ ) { - U8 normIdx = encodedNorms.size() ? encodedNorms[i] : encodeNormal( norms[i] ); + U8 normIdx = mEncodedNorms.size() ? mEncodedNorms[i] : encodeNormal( mNorms[i] ); tsalloc.copyToBuffer8( (S8*)&normIdx, 1 ); } } // optimize triangle draw order during disassemble { - FrameTemp tmpIdxs(indices.size()); - for ( S32 i = 0; i < primitives.size(); i++ ) + FrameTemp tmpIdxs(mIndices.size()); + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - const TSDrawPrimitive& prim = primitives[i]; + const TSDrawPrimitive& prim = mPrimitives[i]; // only optimize triangle lists (strips and fans are assumed to be already optimized) if ( (prim.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { - TriListOpt::OptimizeTriangleOrdering(verts.size(), prim.numElements, - indices.address() + prim.start, tmpIdxs.address()); - dCopyArray(indices.address() + prim.start, tmpIdxs.address(), + TriListOpt::OptimizeTriangleOrdering(mVerts.size(), prim.numElements, + mIndices.address() + prim.start, tmpIdxs.address()); + dCopyArray(mIndices.address() + prim.start, tmpIdxs.address(), prim.numElements); } } @@ -2720,32 +2720,32 @@ void TSMesh::disassemble() if (TSShape::smVersion > 25) { // primitives... - tsalloc.set32( primitives.size() ); - tsalloc.copyToBuffer32((S32*)primitives.address(),3*primitives.size()); + tsalloc.set32( mPrimitives.size() ); + tsalloc.copyToBuffer32((S32*)mPrimitives.address(),3*mPrimitives.size()); // indices... - tsalloc.set32(indices.size()); - tsalloc.copyToBuffer32((S32*)indices.address(),indices.size()); + tsalloc.set32(mIndices.size()); + tsalloc.copyToBuffer32((S32*)mIndices.address(),mIndices.size()); } else { // primitives - tsalloc.set32( primitives.size() ); - for (S32 i=0; i s16_indices(indices.size()); - for (S32 i=0; i s16_indices(mIndices.size()); + for (S32 i=0; i21 && TSMesh::smUseEncodedNormals ) { // we have encoded normals and we want to use them... - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) tsalloc.getPointer32( numVerts * 3 ); // advance past norms, don't use batchData.initialNorms.set( NULL, 0 ); - ptr8 = getSharedData8( parentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); - encodedNorms.set( ptr8, numVerts ); + ptr8 = getSharedData8( mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); + mEncodedNorms.set( ptr8, numVerts ); // Note: we don't set the encoded normals flag because we handle them in updateSkin and // hide the fact that we are using them from base class (TSMesh) } else if ( TSShape::smReadVersion > 21 ) { // we have encoded normals but we don't want to use them... - ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); batchData.initialNorms.set( (Point3F*)ptr32, numVerts ); - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) tsalloc.getPointer8( numVerts ); // advance past encoded normls, don't use - encodedNorms.set( NULL, 0 ); + mEncodedNorms.set( NULL, 0 ); } else { // no encoded normals... - ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); batchData.initialNorms.set( (Point3F*)ptr32, numVerts ); - encodedNorms.set( NULL, 0 ); + mEncodedNorms.set( NULL, 0 ); } sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 16 * sz, (S32**)smInitTransformList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, 16 * sz, (S32**)smInitTransformList.address(), skip ); batchData.initialTransforms.set( ptr32, sz ); sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smVertexIndexList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, sz, (S32**)smVertexIndexList.address(), skip ); vertexIndex.set( ptr32, sz ); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smBoneIndexList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, sz, (S32**)smBoneIndexList.address(), skip ); boneIndex.set( ptr32, sz ); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smWeightList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, sz, (S32**)smWeightList.address(), skip ); weight.set( (F32*)ptr32, sz ); sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smNodeIndexList.address(), skip ); + ptr32 = getSharedData32( mParentMesh, sz, (S32**)smNodeIndexList.address(), skip ); batchData.nodeIndex.set( ptr32, sz ); tsalloc.checkGuard(); @@ -2841,7 +2841,7 @@ void TSSkinMesh::disassemble() tsalloc.set32( batchData.initialVerts.size() ); // if we have no parent mesh, then save off our verts & norms - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) { tsalloc.copyToBuffer32( (S32*)batchData.initialVerts.address(), 3 * batchData.initialVerts.size() ); @@ -2851,17 +2851,17 @@ void TSSkinMesh::disassemble() // if no parent mesh, compute encoded normals and copy over for ( S32 i = 0; i < batchData.initialNorms.size(); i++ ) { - U8 normIdx = encodedNorms.size() ? encodedNorms[i] : encodeNormal( batchData.initialNorms[i] ); + U8 normIdx = mEncodedNorms.size() ? mEncodedNorms[i] : encodeNormal( batchData.initialNorms[i] ); tsalloc.copyToBuffer8( (S8*)&normIdx, 1 ); } } tsalloc.set32( batchData.initialTransforms.size() ); - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) tsalloc.copyToBuffer32( (S32*)batchData.initialTransforms.address(), batchData.initialTransforms.size() * 16 ); tsalloc.set32( vertexIndex.size() ); - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) { tsalloc.copyToBuffer32( (S32*)vertexIndex.address(), vertexIndex.size() ); @@ -2871,7 +2871,7 @@ void TSSkinMesh::disassemble() } tsalloc.set32( batchData.nodeIndex.size() ); - if ( parentMesh < 0 ) + if ( mParentMesh < 0 ) tsalloc.copyToBuffer32( (S32*)batchData.nodeIndex.address(), batchData.nodeIndex.size() ); tsalloc.setGuard(); @@ -2879,7 +2879,7 @@ void TSSkinMesh::disassemble() TSSkinMesh::TSSkinMesh() { - meshType = SkinMeshType; + mMeshType = SkinMeshType; mDynamic = true; batchDataInitialized = false; } @@ -2898,9 +2898,9 @@ inline void TSMesh::findTangent( U32 index1, const Point3F &v2 = _verts[index2]; const Point3F &v3 = _verts[index3]; - const Point2F &w1 = tverts[index1]; - const Point2F &w2 = tverts[index2]; - const Point2F &w3 = tverts[index3]; + const Point2F &w1 = mTVerts[index1]; + const Point2F &w2 = mTVerts[index2]; + const Point2F &w3 = mTVerts[index3]; F32 x1 = v2.x - v1.x; F32 x2 = v3.x - v1.x; @@ -2958,17 +2958,17 @@ void TSMesh::createTangents(const Vector &_verts, const Vector Point3F *tan1 = tan0.address() + numVerts; dMemset( tan0.address(), 0, sizeof(Point3F) * 2 * numVerts ); - U32 numPrimatives = primitives.size(); + U32 numPrimatives = mPrimitives.size(); for (S32 i = 0; i < numPrimatives; i++ ) { - const TSDrawPrimitive & draw = primitives[i]; + const TSDrawPrimitive & draw = mPrimitives[i]; GFXPrimitiveType drawType = getDrawType( draw.matIndex >> 30 ); U32 p1Index = 0; U32 p2Index = 0; - U32 *baseIdx = &indices[draw.start]; + U32 *baseIdx = &mIndices[draw.start]; const U32 numElements = (U32)draw.numElements; @@ -3010,7 +3010,7 @@ void TSMesh::createTangents(const Vector &_verts, const Vector } } - tangents.setSize( numVerts ); + mTangents.setSize( numVerts ); // fill out final info from accumulated basis data for( U32 i = 0; i < numVerts; i++ ) @@ -3021,19 +3021,19 @@ void TSMesh::createTangents(const Vector &_verts, const Vector Point3F tempPt = t - n * mDot( n, t ); tempPt.normalize(); - tangents[i] = tempPt; + mTangents[i] = tempPt; Point3F cp; mCross( n, t, &cp ); - tangents[i].w = (mDot( cp, b ) < 0.0f) ? -1.0f : 1.0f; + mTangents[i].w = (mDot( cp, b ) < 0.0f) ? -1.0f : 1.0f; } } void TSMesh::convertToAlignedMeshData() { if(!mVertexData.isReady()) - _convertToAlignedMeshData(mVertexData, verts, norms); + _convertToAlignedMeshData(mVertexData, mVerts, mNorms); } @@ -3071,7 +3071,7 @@ void TSMesh::_convertToAlignedMeshData( TSMeshVertexArray &vertexData, const Vec AssertFatal(!vertexData.isReady(), "Mesh already converted to aligned data! Re-check code!"); AssertFatal(_verts.size() == _norms.size() && - _verts.size() == tangents.size(), + _verts.size() == mTangents.size(), "Vectors: verts, norms, tangents must all be the same size"); mNumVerts = _verts.size(); @@ -3082,11 +3082,11 @@ void TSMesh::_convertToAlignedMeshData( TSMeshVertexArray &vertexData, const Vec if(mNumVerts == 0) return; - mHasColor = !colors.empty(); - AssertFatal(!mHasColor || colors.size() == _verts.size(), "Vector of color elements should be the same size as other vectors"); + mHasColor = !mColors.empty(); + AssertFatal(!mHasColor || mColors.size() == _verts.size(), "Vector of color elements should be the same size as other vectors"); - mHasTVert2 = !tverts2.empty(); - AssertFatal(!mHasTVert2 || tverts2.size() == _verts.size(), "Vector of tvert2 elements should be the same size as other vectors"); + mHasTVert2 = !mTVerts2.empty(); + AssertFatal(!mHasTVert2 || mTVerts2.size() == _verts.size(), "Vector of tvert2 elements should be the same size as other vectors"); // Create the proper array type void *aligned_mem = dMalloc_aligned(mVertSize * mNumVerts, 16); @@ -3100,21 +3100,21 @@ void TSMesh::_convertToAlignedMeshData( TSMeshVertexArray &vertexData, const Vec __TSMeshVertexBase &v = vertexData[i]; v.vert(_verts[i]); v.normal(_norms[i]); - v.tangent(tangents[i]); + v.tangent(mTangents[i]); - if(i < tverts.size()) - v.tvert(tverts[i]); - if(mHasTVert2 && i < tverts2.size()) - v.tvert2(tverts2[i]); - if(mHasColor && i < colors.size()) - v.color(colors[i]); + if(i < mTVerts.size()) + v.tvert(mTVerts[i]); + if(mHasTVert2 && i < mTVerts2.size()) + v.tvert2(mTVerts2[i]); + if(mHasColor && i < mColors.size()) + v.color(mColors[i]); } // Now that the data is in the aligned struct, free the Vector memory - verts.free_memory(); - norms.free_memory(); - tangents.free_memory(); - tverts.free_memory(); - tverts2.free_memory(); - colors.free_memory(); + mVerts.free_memory(); + mNorms.free_memory(); + mTangents.free_memory(); + mTVerts.free_memory(); + mTVerts2.free_memory(); + mColors.free_memory(); } \ No newline at end of file diff --git a/Engine/source/ts/tsMesh.h b/Engine/source/ts/tsMesh.h index d2ac79087..ff47f84b8 100644 --- a/Engine/source/ts/tsMesh.h +++ b/Engine/source/ts/tsMesh.h @@ -105,7 +105,7 @@ class TSMesh struct TSMeshVertexArray; protected: - U32 meshType; + U32 mMeshType; Box3F mBounds; Point3F mCenter; F32 mRadius; @@ -140,17 +140,17 @@ class TSMesh FlagMask = Billboard|BillboardZAxis|HasDetailTexture|UseEncodedNormals }; - U32 getMeshType() const { return meshType & TypeMask; } - void setFlags(U32 flag) { meshType |= flag; } - void clearFlags(U32 flag) { meshType &= ~flag; } - U32 getFlags( U32 flag = 0xFFFFFFFF ) const { return meshType & flag; } + U32 getMeshType() const { return mMeshType & TypeMask; } + void setFlags(U32 flag) { mMeshType |= flag; } + void clearFlags(U32 flag) { mMeshType &= ~flag; } + U32 getFlags( U32 flag = 0xFFFFFFFF ) const { return mMeshType & flag; } const Point3F* getNormals( S32 firstVert ); - S32 parentMesh; ///< index into shapes mesh list - S32 numFrames; - S32 numMatFrames; - S32 vertsPerFrame; + S32 mParentMesh; ///< index into shapes mesh list + S32 mNumFrames; + S32 mNumMatFrames; + S32 mVertsPerFrame; /// @name Aligned Vertex Data /// @{ @@ -244,34 +244,34 @@ class TSMesh FreeableVector& operator=(const FreeableVector& p) { Vector::operator=(p); return *this; } }; - FreeableVector verts; - FreeableVector norms; - FreeableVector tverts; - FreeableVector tangents; + FreeableVector mVerts; + FreeableVector mNorms; + FreeableVector mTVerts; + FreeableVector mTangents; // Optional second texture uvs. - FreeableVector tverts2; + FreeableVector mTVerts2; // Optional vertex colors data. - FreeableVector colors; + FreeableVector mColors; /// @} - Vector primitives; - Vector encodedNorms; - Vector indices; + Vector mPrimitives; + Vector mEncodedNorms; + Vector mIndices; /// billboard data - Point3F billboardAxis; + Point3F mBillboardAxis; /// @name Convex Hull Data /// Convex hulls are convex (no angles >= 180º) meshes used for collision /// @{ - Vector planeNormals; - Vector planeConstants; - Vector planeMaterials; - S32 planesPerFrame; - U32 mergeBufferStart; + Vector mPlaneNormals; + Vector mPlaneConstants; + Vector mPlaneMaterials; + S32 mPlanesPerFrame; + U32 mMergeBufferStart; /// @} /// @name Render Methods diff --git a/Engine/source/ts/tsMeshFit.cpp b/Engine/source/ts/tsMeshFit.cpp index f82b079f4..9c07cceab 100644 --- a/Engine/source/ts/tsMeshFit.cpp +++ b/Engine/source/ts/tsMeshFit.cpp @@ -246,24 +246,24 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) { // Add indices S32 indicesBase = mIndices.size(); - for ( S32 i = 0; i < mesh->primitives.size(); i++ ) + for ( S32 i = 0; i < mesh->mPrimitives.size(); i++ ) { - const TSDrawPrimitive& draw = mesh->primitives[i]; + const TSDrawPrimitive& draw = mesh->mPrimitives[i]; if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { - mIndices.merge( &mesh->indices[draw.start], draw.numElements ); + mIndices.merge( &mesh->mIndices[draw.start], draw.numElements ); } else { - U32 idx0 = mesh->indices[draw.start + 0]; + U32 idx0 = mesh->mIndices[draw.start + 0]; U32 idx1; - U32 idx2 = mesh->indices[draw.start + 1]; + U32 idx2 = mesh->mIndices[draw.start + 1]; U32 *nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = mesh->indices[draw.start + j]; + idx2 = mesh->mIndices[draw.start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -290,9 +290,9 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) } else { - count = mesh->verts.size(); + count = mesh->mVerts.size(); stride = sizeof(Point3F); - pVert = (U8*)mesh->verts.address(); + pVert = (U8*)mesh->mVerts.address(); } MatrixF objMat; @@ -323,69 +323,69 @@ TSMesh* MeshFit::initMeshFromFile( const String& filename ) const TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numTris ) const { TSMesh* mesh = mShape->copyMesh( NULL ); - mesh->numFrames = 1; - mesh->numMatFrames = 1; - mesh->vertsPerFrame = numVerts; + mesh->mNumFrames = 1; + mesh->mNumMatFrames = 1; + mesh->mVertsPerFrame = numVerts; mesh->setFlags(0); mesh->mHasColor = false; mesh->mHasTVert2 = false; mesh->mNumVerts = numVerts; - mesh->indices.reserve( numTris * 3 ); + mesh->mIndices.reserve( numTris * 3 ); for ( S32 i = 0; i < numTris; i++ ) { - mesh->indices.push_back( indices[i*3 + 0] ); - mesh->indices.push_back( indices[i*3 + 2] ); - mesh->indices.push_back( indices[i*3 + 1] ); + mesh->mIndices.push_back( indices[i*3 + 0] ); + mesh->mIndices.push_back( indices[i*3 + 2] ); + mesh->mIndices.push_back( indices[i*3 + 1] ); } - mesh->verts.set( verts, numVerts ); + mesh->mVerts.set( verts, numVerts ); // Compute mesh normals - mesh->norms.setSize( mesh->verts.size() ); - for (S32 iNorm = 0; iNorm < mesh->norms.size(); iNorm++) - mesh->norms[iNorm] = Point3F::Zero; + mesh->mNorms.setSize( mesh->mVerts.size() ); + for (S32 iNorm = 0; iNorm < mesh->mNorms.size(); iNorm++) + mesh->mNorms[iNorm] = Point3F::Zero; // Sum triangle normals for each vertex - for (S32 iInd = 0; iInd < mesh->indices.size(); iInd += 3) + for (S32 iInd = 0; iInd < mesh->mIndices.size(); iInd += 3) { // Compute the normal for this triangle - S32 idx0 = mesh->indices[iInd + 0]; - S32 idx1 = mesh->indices[iInd + 1]; - S32 idx2 = mesh->indices[iInd + 2]; + S32 idx0 = mesh->mIndices[iInd + 0]; + S32 idx1 = mesh->mIndices[iInd + 1]; + S32 idx2 = mesh->mIndices[iInd + 2]; - const Point3F& v0 = mesh->verts[idx0]; - const Point3F& v1 = mesh->verts[idx1]; - const Point3F& v2 = mesh->verts[idx2]; + const Point3F& v0 = mesh->mVerts[idx0]; + const Point3F& v1 = mesh->mVerts[idx1]; + const Point3F& v2 = mesh->mVerts[idx2]; Point3F n; mCross(v2 - v0, v1 - v0, &n); n.normalize(); // remove this to use 'weighted' normals (large triangles will have more effect) - mesh->norms[idx0] += n; - mesh->norms[idx1] += n; - mesh->norms[idx2] += n; + mesh->mNorms[idx0] += n; + mesh->mNorms[idx1] += n; + mesh->mNorms[idx2] += n; } // Normalize the vertex normals (this takes care of averaging the triangle normals) - for (S32 iNorm = 0; iNorm < mesh->norms.size(); iNorm++) - mesh->norms[iNorm].normalize(); + for (S32 iNorm = 0; iNorm < mesh->mNorms.size(); iNorm++) + mesh->mNorms[iNorm].normalize(); // Set some dummy UVs - mesh->tverts.setSize( numVerts ); - for ( S32 j = 0; j < mesh->tverts.size(); j++ ) - mesh->tverts[j].set( 0, 0 ); + mesh->mTVerts.setSize( numVerts ); + for ( S32 j = 0; j < mesh->mTVerts.size(); j++ ) + mesh->mTVerts[j].set( 0, 0 ); // Add a single triangle-list primitive - mesh->primitives.increment(); - mesh->primitives.last().start = 0; - mesh->primitives.last().numElements = mesh->indices.size(); - mesh->primitives.last().matIndex = TSDrawPrimitive::Triangles | + mesh->mPrimitives.increment(); + mesh->mPrimitives.last().start = 0; + mesh->mPrimitives.last().numElements = mesh->mIndices.size(); + mesh->mPrimitives.last().matIndex = TSDrawPrimitive::Triangles | TSDrawPrimitive::Indexed | TSDrawPrimitive::NoMaterial; - mesh->createTangents( mesh->verts, mesh->norms ); - mesh->encodedNorms.set( NULL,0 ); + mesh->createTangents( mesh->mVerts, mesh->mNorms ); + mesh->mEncodedNorms.set( NULL,0 ); return mesh; } @@ -792,10 +792,10 @@ DefineTSShapeConstructorMethod( addPrimitive, bool, ( const char* meshName, cons } else { - for (S32 i = 0; i < mesh->verts.size(); i++) + for (S32 i = 0; i < mesh->mVerts.size(); i++) { - Point3F v(mesh->verts[i]); - mat.mulP( v, &mesh->verts[i] ); + Point3F v(mesh->mVerts[i]); + mat.mulP( v, &mesh->mVerts[i] ); } } diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index 726efabff..c17036b3b 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -569,8 +569,8 @@ void TSShape::initVertexFeatures() } else { - hasColors |= !mesh->colors.empty(); - hasTexcoord2 |= !mesh->tverts2.empty(); + hasColors |= !mesh->mColors.empty(); + hasTexcoord2 |= !mesh->mTVerts2.empty(); } } } @@ -676,11 +676,11 @@ void TSShape::initMaterialList() mHasSkinMesh |= mesh->getMeshType() == TSMesh::SkinMeshType; - for (k=0; kprimitives.size(); k++) + for (k=0; kmPrimitives.size(); k++) { - if (mesh->primitives[k].matIndex & TSDrawPrimitive::NoMaterial) + if (mesh->mPrimitives[k].matIndex & TSDrawPrimitive::NoMaterial) continue; - S32 flags = materialList->getFlags(mesh->primitives[k].matIndex & TSDrawPrimitive::MaterialMask); + S32 flags = materialList->getFlags(mesh->mPrimitives[k].matIndex & TSDrawPrimitive::MaterialMask); if (flags & TSMaterialList::AuxiliaryMap) continue; if (flags & TSMaterialList::Translucent) @@ -690,7 +690,7 @@ void TSShape::initMaterialList() break; } } - if (k!=mesh->primitives.size()) + if (k!=mesh->mPrimitives.size()) break; } if (j!=obj.numMeshes) @@ -1175,15 +1175,15 @@ void TSShape::assembleShape() // fill in location of verts, tverts, and normals for detail levels if (mesh && meshType!=TSMesh::DecalMeshType) { - TSMesh::smVertsList[i] = mesh->verts.address(); - TSMesh::smTVertsList[i] = mesh->tverts.address(); + TSMesh::smVertsList[i] = mesh->mVerts.address(); + TSMesh::smTVertsList[i] = mesh->mTVerts.address(); if (smReadVersion >= 26) { - TSMesh::smTVerts2List[i] = mesh->tverts2.address(); - TSMesh::smColorsList[i] = mesh->colors.address(); + TSMesh::smTVerts2List[i] = mesh->mTVerts2.address(); + TSMesh::smColorsList[i] = mesh->mColors.address(); } - TSMesh::smNormsList[i] = mesh->norms.address(); - TSMesh::smEncodedNormsList[i] = mesh->encodedNorms.address(); + TSMesh::smNormsList[i] = mesh->mNorms.address(); + TSMesh::smEncodedNormsList[i] = mesh->mEncodedNorms.address(); TSMesh::smDataCopied[i] = !skip; // as long as we didn't skip this mesh, the data should be in shape now if (meshType==TSMesh::SkinMeshType) { @@ -1271,9 +1271,9 @@ void TSShape::assembleShape() if (skin) { TSMesh::smVertsList[i] = skin->batchData.initialVerts.address(); - TSMesh::smTVertsList[i] = skin->tverts.address(); + TSMesh::smTVertsList[i] = skin->mTVerts.address(); TSMesh::smNormsList[i] = skin->batchData.initialNorms.address(); - TSMesh::smEncodedNormsList[i] = skin->encodedNorms.address(); + TSMesh::smEncodedNormsList[i] = skin->mEncodedNorms.address(); TSMesh::smDataCopied[i] = !skip; // as long as we didn't skip this mesh, the data should be in shape now TSSkinMesh::smInitTransformList[i] = skin->batchData.initialTransforms.address(); TSSkinMesh::smVertexIndexList[i] = skin->vertexIndex.address(); @@ -1448,15 +1448,15 @@ bool TSShape::canWriteOldFormat() const continue; // Cannot use old format if using the new functionality (COLORs, 2nd UV set) - if (meshes[i]->tverts2.size() || meshes[i]->colors.size()) + if (meshes[i]->mTVerts2.size() || meshes[i]->mColors.size()) return false; // Cannot use old format if any primitive has too many triangles // (ie. cannot fit in a S16) - for (S32 j = 0; j < meshes[i]->primitives.size(); j++) + for (S32 j = 0; j < meshes[i]->mPrimitives.size(); j++) { - if ((meshes[i]->primitives[j].start + - meshes[i]->primitives[j].numElements) >= (1 << 15)) + if ((meshes[i]->mPrimitives[j].start + + meshes[i]->mPrimitives[j].numElements) >= (1 << 15)) { return false; } diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 54e288850..0590b4fe9 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -1326,7 +1326,7 @@ DefineTSShapeConstructorMethod( getMeshMaterial, const char*, ( const char* name GET_MESH( getMeshMaterial, mesh, name, "" ); // Return the name of the first material attached to this mesh - S32 matIndex = mesh->primitives[0].matIndex & TSDrawPrimitive::MaterialMask; + S32 matIndex = mesh->mPrimitives[0].matIndex & TSDrawPrimitive::MaterialMask; if ((matIndex >= 0) && (matIndex < mShape->materialList->size())) return mShape->materialList->getMaterialName( matIndex ); else @@ -1363,10 +1363,10 @@ DefineTSShapeConstructorMethod( setMeshMaterial, bool, ( const char* meshName, c } // Set this material for all primitives in the mesh - for ( S32 i = 0; i < mesh->primitives.size(); i++ ) + for ( S32 i = 0; i < mesh->mPrimitives.size(); i++ ) { - U32 matType = mesh->primitives[i].matIndex & ( TSDrawPrimitive::TypeMask | TSDrawPrimitive::Indexed ); - mesh->primitives[i].matIndex = ( matType | matIndex ); + U32 matType = mesh->mPrimitives[i].matIndex & ( TSDrawPrimitive::TypeMask | TSDrawPrimitive::Indexed ); + mesh->mPrimitives[i].matIndex = ( matType | matIndex ); } ADD_TO_CHANGE_SET(); diff --git a/Engine/source/ts/tsShapeEdit.cpp b/Engine/source/ts/tsShapeEdit.cpp index 8d585022f..ba3c99a51 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -900,11 +900,11 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const return mesh; // return an empty mesh // Copy mesh elements - mesh->indices = srcMesh->indices; - mesh->primitives = srcMesh->primitives; - mesh->numFrames = srcMesh->numFrames; - mesh->numMatFrames = srcMesh->numMatFrames; - mesh->vertsPerFrame = srcMesh->vertsPerFrame; + mesh->mIndices = srcMesh->mIndices; + mesh->mPrimitives = srcMesh->mPrimitives; + mesh->mNumFrames = srcMesh->mNumFrames; + mesh->mNumMatFrames = srcMesh->mNumMatFrames; + mesh->mVertsPerFrame = srcMesh->mVertsPerFrame; mesh->setFlags(srcMesh->getFlags()); mesh->mHasColor = srcMesh->mHasColor; mesh->mHasTVert2 = srcMesh->mHasTVert2; @@ -936,14 +936,14 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const } else { - mesh->verts = srcMesh->verts; - mesh->tverts = srcMesh->tverts; - mesh->tverts2 = srcMesh->tverts2; - mesh->colors = srcMesh->colors; - mesh->norms = srcMesh->norms; + mesh->mVerts = srcMesh->mVerts; + mesh->mTVerts = srcMesh->mTVerts; + mesh->mTVerts2 = srcMesh->mTVerts2; + mesh->mColors = srcMesh->mColors; + mesh->mNorms = srcMesh->mNorms; - mesh->createTangents(mesh->verts, mesh->norms); - mesh->encodedNorms.set(NULL,0); + mesh->createTangents(mesh->mVerts, mesh->mNorms); + mesh->mEncodedNorms.set(NULL,0); mesh->convertToAlignedMeshData(); } @@ -1103,12 +1103,12 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String // Copy materials used by the source mesh (only if from a different shape) if (srcShape != this) { - for (S32 i = 0; i < mesh->primitives.size(); i++) + for (S32 i = 0; i < mesh->mPrimitives.size(); i++) { - if (!(mesh->primitives[i].matIndex & TSDrawPrimitive::NoMaterial)) + if (!(mesh->mPrimitives[i].matIndex & TSDrawPrimitive::NoMaterial)) { - S32 drawType = (mesh->primitives[i].matIndex & (~TSDrawPrimitive::MaterialMask)); - S32 srcMatIndex = mesh->primitives[i].matIndex & TSDrawPrimitive::MaterialMask; + S32 drawType = (mesh->mPrimitives[i].matIndex & (~TSDrawPrimitive::MaterialMask)); + S32 srcMatIndex = mesh->mPrimitives[i].matIndex & TSDrawPrimitive::MaterialMask; const String& matName = srcShape->materialList->getMaterialName(srcMatIndex); // Add the material if it does not already exist @@ -1119,7 +1119,7 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String materialList->push_back(matName, srcShape->materialList->getFlags(srcMatIndex)); } - mesh->primitives[i].matIndex = drawType | destMatIndex; + mesh->mPrimitives[i].matIndex = drawType | destMatIndex; } } } diff --git a/Engine/source/ts/tsSortedMesh.cpp b/Engine/source/ts/tsSortedMesh.cpp index e2c5b489c..8a88ff319 100644 --- a/Engine/source/ts/tsSortedMesh.cpp +++ b/Engine/source/ts/tsSortedMesh.cpp @@ -86,10 +86,10 @@ S32 TSSortedMesh::getNumPolys() Cluster & cluster = clusters[cIdx]; for (S32 i=cluster.startPrimitive; i Date: Tue, 13 May 2014 12:45:42 +0400 Subject: [PATCH 13/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSSkinMesh --- .../source/gui/editor/guiShapeEdPreview.cpp | 4 +- Engine/source/ts/loader/appMesh.cpp | 14 +- Engine/source/ts/tsMesh.cpp | 124 +++++++++--------- Engine/source/ts/tsMesh.h | 10 +- Engine/source/ts/tsShape.cpp | 28 ++-- Engine/source/ts/tsShapeEdit.cpp | 40 +++--- 6 files changed, 110 insertions(+), 110 deletions(-) diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 6d0841d7f..7b3afdedc 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -1236,8 +1236,8 @@ void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state) if ( mesh->getMeshType() == TSMesh::SkinMeshType ) { const TSSkinMesh* skin = dynamic_cast(mesh); - mNumBones += skin->batchData.initialTransforms.size(); - mNumWeights += skin->weight.size(); + mNumBones += skin->mBatchData.initialTransforms.size(); + mNumWeights += skin->mWeight.size(); } } diff --git a/Engine/source/ts/loader/appMesh.cpp b/Engine/source/ts/loader/appMesh.cpp index 404d81bdb..f21dc9d0b 100644 --- a/Engine/source/ts/loader/appMesh.cpp +++ b/Engine/source/ts/loader/appMesh.cpp @@ -133,13 +133,13 @@ TSMesh* AppMesh::constructTSMesh() tsmesh = tsskin; // Copy skin elements - tsskin->weight = mWeight; - tsskin->boneIndex = mBoneIndex; - tsskin->vertexIndex = mVertexIndex; - tsskin->batchData.nodeIndex = mNodeIndex; - tsskin->batchData.initialTransforms = mInitialTransforms; - tsskin->batchData.initialVerts = mInitialVerts; - tsskin->batchData.initialNorms = mInitialNorms; + tsskin->mWeight = mWeight; + tsskin->mBoneIndex = mBoneIndex; + tsskin->mVertexIndex = mVertexIndex; + tsskin->mBatchData.nodeIndex = mNodeIndex; + tsskin->mBatchData.initialTransforms = mInitialTransforms; + tsskin->mBatchData.initialVerts = mInitialVerts; + tsskin->mBatchData.initialNorms = mInitialNorms; } else { diff --git a/Engine/source/ts/tsMesh.cpp b/Engine/source/ts/tsMesh.cpp index c5d5e9f3a..8626fc09a 100644 --- a/Engine/source/ts/tsMesh.cpp +++ b/Engine/source/ts/tsMesh.cpp @@ -1180,53 +1180,53 @@ void TSSkinMesh::updateSkin( const Vector &transforms, TSVertexBufferHa { PROFILE_SCOPE( TSSkinMesh_UpdateSkin ); - AssertFatal(batchDataInitialized, "Batch data not initialized. Call createBatchData() before any skin update is called."); + AssertFatal(mBatchDataInitialized, "Batch data not initialized. Call createBatchData() before any skin update is called."); // set arrays #if defined(TORQUE_MAX_LIB) - mVerts.setSize(batchData.initialVerts.size()); - mNorms.setSize(batchData.initialNorms.size()); + mVerts.setSize(mBatchData.initialVerts.size()); + mNorms.setSize(mBatchData.initialNorms.size()); #else - if ( !batchDataInitialized && mEncodedNorms.size() ) + if ( !mBatchDataInitialized && mEncodedNorms.size() ) { // we co-opt responsibility for updating encoded normals from mesh gNormalStore.setSize( mVertsPerFrame ); for ( S32 i = 0; i < mVertsPerFrame; i++ ) gNormalStore[i] = decodeNormal( mEncodedNorms[i] ); - batchData.initialNorms.set( gNormalStore.address(), mVertsPerFrame ); + mBatchData.initialNorms.set( gNormalStore.address(), mVertsPerFrame ); } #endif static Vector sBoneTransforms; - sBoneTransforms.setSize( batchData.nodeIndex.size() ); + sBoneTransforms.setSize( mBatchData.nodeIndex.size() ); // set up bone transforms PROFILE_START(TSSkinMesh_UpdateTransforms); - for( S32 i=0; i::const_iterator itr = batchData.vertexBatchOperations.begin(); - itr != batchData.vertexBatchOperations.end(); itr++ ) + for( Vector::const_iterator itr = mBatchData.vertexBatchOperations.begin(); + itr != mBatchData.vertexBatchOperations.end(); itr++ ) { const BatchData::BatchedVertex &curVert = *itr; @@ -1275,11 +1275,11 @@ void TSSkinMesh::updateSkin( const Vector &transforms, TSVertexBufferHa zero_vert_normal_bulk(mNumVerts, outPtr, outStride); // Iterate over transforms, and perform batch transform x skin_vert - for(Vector::const_iterator itr = batchData.transformKeys.begin(); - itr != batchData.transformKeys.end(); itr++) + for(Vector::const_iterator itr = mBatchData.transformKeys.begin(); + itr != mBatchData.transformKeys.end(); itr++) { const S32 boneXfmIdx = *itr; - const BatchData::BatchedTransform &curTransform = *batchData.transformBatchOperations.retreive(boneXfmIdx); + const BatchData::BatchedTransform &curTransform = *mBatchData.transformBatchOperations.retreive(boneXfmIdx); const MatrixF &curBoneMat = matrices[boneXfmIdx]; const S32 numVerts = curTransform.numElements; @@ -1307,14 +1307,14 @@ S32 QSORT_CALLBACK _sort_BatchedVertWeight( const void *a, const void *b ) void TSSkinMesh::createBatchData() { - if(batchDataInitialized) + if(mBatchDataInitialized) return; - batchDataInitialized = true; - S32 * curVtx = vertexIndex.begin(); - S32 * curBone = boneIndex.begin(); - F32 * curWeight = weight.begin(); - const S32 * endVtx = vertexIndex.end(); + mBatchDataInitialized = true; + S32 * curVtx = mVertexIndex.begin(); + S32 * curBone = mBoneIndex.begin(); + F32 * curWeight = mWeight.begin(); + const S32 * endVtx = mVertexIndex.end(); // Temp vector to build batch operations Vector batchOperations; @@ -1408,7 +1408,7 @@ void TSSkinMesh::createBatchData() #ifdef _BATCH_BY_VERTEX // Copy data to member, and be done - batchData.vertexBatchOperations.set(batchOperations.address(), batchOperations.size()); + mBatchData.vertexBatchOperations.set(batchOperations.address(), batchOperations.size()); // Convert to batch-by-transform, which is better for CPU skinning, // where-as GPU skinning would data for batch-by-vertex operation @@ -1424,18 +1424,18 @@ void TSSkinMesh::createBatchData() // Find the proper batched transform, and add this vertex/weight to the // list of verts affected by the transform - BatchData::BatchedTransform *bt = batchData.transformBatchOperations.retreive(transformOp.transformIndex); + BatchData::BatchedTransform *bt = mBatchData.transformBatchOperations.retreive(transformOp.transformIndex); if(!bt) { bt = new BatchData::BatchedTransform; - batchData.transformBatchOperations.insert(bt, transformOp.transformIndex); + mBatchData.transformBatchOperations.insert(bt, transformOp.transformIndex); bt->_tmpVec = new Vector; - batchData.transformKeys.push_back(transformOp.transformIndex); + mBatchData.transformKeys.push_back(transformOp.transformIndex); } bt->_tmpVec->increment(); - bt->_tmpVec->last().vert = batchData.initialVerts[curTransform.vertexIndex]; - bt->_tmpVec->last().normal = batchData.initialNorms[curTransform.vertexIndex]; + bt->_tmpVec->last().vert = mBatchData.initialVerts[curTransform.vertexIndex]; + bt->_tmpVec->last().normal = mBatchData.initialNorms[curTransform.vertexIndex]; bt->_tmpVec->last().weight = transformOp.weight; bt->_tmpVec->last().vidx = curTransform.vertexIndex; } @@ -1443,10 +1443,10 @@ void TSSkinMesh::createBatchData() // Now iterate the resulting operations and convert the vectors to aligned // memory locations - const S32 numBatchOps = batchData.transformKeys.size(); + const S32 numBatchOps = mBatchData.transformKeys.size(); for(S32 i = 0; i < numBatchOps; i++) { - BatchData::BatchedTransform &curTransform = *batchData.transformBatchOperations.retreive(batchData.transformKeys[i]); + BatchData::BatchedTransform &curTransform = *mBatchData.transformBatchOperations.retreive(mBatchData.transformKeys[i]); const S32 numVerts = curTransform._tmpVec->size(); // Allocate a chunk of aligned memory and copy in values @@ -1464,7 +1464,7 @@ void TSSkinMesh::createBatchData() // Now sort the batch data so that the skin function writes close to linear output for(S32 i = 0; i < numBatchOps; i++) { - BatchData::BatchedTransform &curTransform = *batchData.transformBatchOperations.retreive(batchData.transformKeys[i]); + BatchData::BatchedTransform &curTransform = *mBatchData.transformBatchOperations.retreive(mBatchData.transformKeys[i]); dQsort(curTransform.alignedMem, curTransform.numElements, sizeof(BatchData::BatchedVertWeight), _sort_BatchedVertWeight); } #endif @@ -1489,11 +1489,11 @@ void TSSkinMesh::render( TSMaterialList *materials, // Initialize the vertex data if it needs it if(!mVertexData.isReady() ) - _convertToAlignedMeshData(mVertexData, batchData.initialVerts, batchData.initialNorms); + _convertToAlignedMeshData(mVertexData, mBatchData.initialVerts, mBatchData.initialNorms); AssertFatal(mVertexData.size() == mNumVerts, "Vert # mismatch"); // Initialize the skin batch if that isn't ready - if(!batchDataInitialized) + if(!mBatchDataInitialized) createBatchData(); const bool vertsChanged = vertexBuffer.isNull() || vertexBuffer->mNumVerts != mNumVerts; @@ -1550,7 +1550,7 @@ void TSSkinMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 fra if (frame < 0) { // Use unskinned verts - TSMesh::computeBounds( batchData.initialVerts.address(), batchData.initialVerts.size(), sizeof(Point3F), transform, bounds, center, radius ); + TSMesh::computeBounds( mBatchData.initialVerts.address(), mBatchData.initialVerts.size(), sizeof(Point3F), transform, bounds, center, radius ); } else { @@ -2765,14 +2765,14 @@ void TSMesh::disassemble() void TSSkinMesh::assemble( bool skip ) { // avoid a crash on computeBounds... - batchData.initialVerts.set( NULL, 0 ); + mBatchData.initialVerts.set( NULL, 0 ); TSMesh::assemble( skip ); S32 sz = tsalloc.get32(); S32 numVerts = sz; S32 * ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); - batchData.initialVerts.set( (Point3F*)ptr32, sz ); + mBatchData.initialVerts.set( (Point3F*)ptr32, sz ); S8 * ptr8; if ( TSShape::smReadVersion>21 && TSMesh::smUseEncodedNormals ) @@ -2780,7 +2780,7 @@ void TSSkinMesh::assemble( bool skip ) // we have encoded normals and we want to use them... if ( mParentMesh < 0 ) tsalloc.getPointer32( numVerts * 3 ); // advance past norms, don't use - batchData.initialNorms.set( NULL, 0 ); + mBatchData.initialNorms.set( NULL, 0 ); ptr8 = getSharedData8( mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); mEncodedNorms.set( ptr8, numVerts ); @@ -2791,7 +2791,7 @@ void TSSkinMesh::assemble( bool skip ) { // we have encoded normals but we don't want to use them... ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - batchData.initialNorms.set( (Point3F*)ptr32, numVerts ); + mBatchData.initialNorms.set( (Point3F*)ptr32, numVerts ); if ( mParentMesh < 0 ) tsalloc.getPointer8( numVerts ); // advance past encoded normls, don't use @@ -2802,34 +2802,34 @@ void TSSkinMesh::assemble( bool skip ) { // no encoded normals... ptr32 = getSharedData32( mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - batchData.initialNorms.set( (Point3F*)ptr32, numVerts ); + mBatchData.initialNorms.set( (Point3F*)ptr32, numVerts ); mEncodedNorms.set( NULL, 0 ); } sz = tsalloc.get32(); ptr32 = getSharedData32( mParentMesh, 16 * sz, (S32**)smInitTransformList.address(), skip ); - batchData.initialTransforms.set( ptr32, sz ); + mBatchData.initialTransforms.set( ptr32, sz ); sz = tsalloc.get32(); ptr32 = getSharedData32( mParentMesh, sz, (S32**)smVertexIndexList.address(), skip ); - vertexIndex.set( ptr32, sz ); + mVertexIndex.set( ptr32, sz ); ptr32 = getSharedData32( mParentMesh, sz, (S32**)smBoneIndexList.address(), skip ); - boneIndex.set( ptr32, sz ); + mBoneIndex.set( ptr32, sz ); ptr32 = getSharedData32( mParentMesh, sz, (S32**)smWeightList.address(), skip ); - weight.set( (F32*)ptr32, sz ); + mWeight.set( (F32*)ptr32, sz ); sz = tsalloc.get32(); ptr32 = getSharedData32( mParentMesh, sz, (S32**)smNodeIndexList.address(), skip ); - batchData.nodeIndex.set( ptr32, sz ); + mBatchData.nodeIndex.set( ptr32, sz ); tsalloc.checkGuard(); if ( tsalloc.allocShape32( 0 ) && TSShape::smReadVersion < 19 ) TSMesh::computeBounds(); // only do this if we copied the data... - createTangents(batchData.initialVerts, batchData.initialNorms); + createTangents(mBatchData.initialVerts, mBatchData.initialNorms); } //----------------------------------------------------------------------------- @@ -2839,40 +2839,40 @@ void TSSkinMesh::disassemble() { TSMesh::disassemble(); - tsalloc.set32( batchData.initialVerts.size() ); + tsalloc.set32( mBatchData.initialVerts.size() ); // if we have no parent mesh, then save off our verts & norms if ( mParentMesh < 0 ) { - tsalloc.copyToBuffer32( (S32*)batchData.initialVerts.address(), 3 * batchData.initialVerts.size() ); + tsalloc.copyToBuffer32( (S32*)mBatchData.initialVerts.address(), 3 * mBatchData.initialVerts.size() ); // no longer do this here...let tsmesh handle this - tsalloc.copyToBuffer32( (S32*)batchData.initialNorms.address(), 3 * batchData.initialNorms.size() ); + tsalloc.copyToBuffer32( (S32*)mBatchData.initialNorms.address(), 3 * mBatchData.initialNorms.size() ); // if no parent mesh, compute encoded normals and copy over - for ( S32 i = 0; i < batchData.initialNorms.size(); i++ ) + for ( S32 i = 0; i < mBatchData.initialNorms.size(); i++ ) { - U8 normIdx = mEncodedNorms.size() ? mEncodedNorms[i] : encodeNormal( batchData.initialNorms[i] ); + U8 normIdx = mEncodedNorms.size() ? mEncodedNorms[i] : encodeNormal( mBatchData.initialNorms[i] ); tsalloc.copyToBuffer8( (S8*)&normIdx, 1 ); } } - tsalloc.set32( batchData.initialTransforms.size() ); + tsalloc.set32( mBatchData.initialTransforms.size() ); if ( mParentMesh < 0 ) - tsalloc.copyToBuffer32( (S32*)batchData.initialTransforms.address(), batchData.initialTransforms.size() * 16 ); + tsalloc.copyToBuffer32( (S32*)mBatchData.initialTransforms.address(), mBatchData.initialTransforms.size() * 16 ); - tsalloc.set32( vertexIndex.size() ); + tsalloc.set32( mVertexIndex.size() ); if ( mParentMesh < 0 ) { - tsalloc.copyToBuffer32( (S32*)vertexIndex.address(), vertexIndex.size() ); + tsalloc.copyToBuffer32( (S32*)mVertexIndex.address(), mVertexIndex.size() ); - tsalloc.copyToBuffer32( (S32*)boneIndex.address(), boneIndex.size() ); + tsalloc.copyToBuffer32( (S32*)mBoneIndex.address(), mBoneIndex.size() ); - tsalloc.copyToBuffer32( (S32*)weight.address(), weight.size() ); + tsalloc.copyToBuffer32( (S32*)mWeight.address(), mWeight.size() ); } - tsalloc.set32( batchData.nodeIndex.size() ); + tsalloc.set32( mBatchData.nodeIndex.size() ); if ( mParentMesh < 0 ) - tsalloc.copyToBuffer32( (S32*)batchData.nodeIndex.address(), batchData.nodeIndex.size() ); + tsalloc.copyToBuffer32( (S32*)mBatchData.nodeIndex.address(), mBatchData.nodeIndex.size() ); tsalloc.setGuard(); } @@ -2881,7 +2881,7 @@ TSSkinMesh::TSSkinMesh() { mMeshType = SkinMeshType; mDynamic = true; - batchDataInitialized = false; + mBatchDataInitialized = false; } //----------------------------------------------------------------------------- @@ -3040,7 +3040,7 @@ void TSMesh::convertToAlignedMeshData() void TSSkinMesh::convertToAlignedMeshData() { if(!mVertexData.isReady()) - _convertToAlignedMeshData(mVertexData, batchData.initialVerts, batchData.initialNorms); + _convertToAlignedMeshData(mVertexData, mBatchData.initialVerts, mBatchData.initialNorms); } void TSMesh::_convertToAlignedMeshData( TSMeshVertexArray &vertexData, const Vector &_verts, const Vector &_norms ) diff --git a/Engine/source/ts/tsMesh.h b/Engine/source/ts/tsMesh.h index ff47f84b8..e9099cd09 100644 --- a/Engine/source/ts/tsMesh.h +++ b/Engine/source/ts/tsMesh.h @@ -501,13 +501,13 @@ public: typedef TSMesh Parent; /// Structure containing data needed to batch skinning - BatchData batchData; - bool batchDataInitialized; + BatchData mBatchData; + bool mBatchDataInitialized; /// vectors that define the vertex, weight, bone tuples - Vector weight; - Vector boneIndex; - Vector vertexIndex; + Vector mWeight; + Vector mBoneIndex; + Vector mVertexIndex; /// set verts and normals... void updateSkin( const Vector &transforms, TSVertexBufferHandle &instanceVB, GFXPrimitiveBufferHandle &instancePB ); diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index c17036b3b..f4fadf815 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -1188,13 +1188,13 @@ void TSShape::assembleShape() if (meshType==TSMesh::SkinMeshType) { TSSkinMesh * skin = (TSSkinMesh*)mesh; - TSMesh::smVertsList[i] = skin->batchData.initialVerts.address(); - TSMesh::smNormsList[i] = skin->batchData.initialNorms.address(); - TSSkinMesh::smInitTransformList[i] = skin->batchData.initialTransforms.address(); - TSSkinMesh::smVertexIndexList[i] = skin->vertexIndex.address(); - TSSkinMesh::smBoneIndexList[i] = skin->boneIndex.address(); - TSSkinMesh::smWeightList[i] = skin->weight.address(); - TSSkinMesh::smNodeIndexList[i] = skin->batchData.nodeIndex.address(); + TSMesh::smVertsList[i] = skin->mBatchData.initialVerts.address(); + TSMesh::smNormsList[i] = skin->mBatchData.initialNorms.address(); + TSSkinMesh::smInitTransformList[i] = skin->mBatchData.initialTransforms.address(); + TSSkinMesh::smVertexIndexList[i] = skin->mVertexIndex.address(); + TSSkinMesh::smBoneIndexList[i] = skin->mBoneIndex.address(); + TSSkinMesh::smWeightList[i] = skin->mWeight.address(); + TSSkinMesh::smNodeIndexList[i] = skin->mBatchData.nodeIndex.address(); } } } @@ -1270,16 +1270,16 @@ void TSShape::assembleShape() // fill in location of verts, tverts, and normals for shared detail levels if (skin) { - TSMesh::smVertsList[i] = skin->batchData.initialVerts.address(); + TSMesh::smVertsList[i] = skin->mBatchData.initialVerts.address(); TSMesh::smTVertsList[i] = skin->mTVerts.address(); - TSMesh::smNormsList[i] = skin->batchData.initialNorms.address(); + TSMesh::smNormsList[i] = skin->mBatchData.initialNorms.address(); TSMesh::smEncodedNormsList[i] = skin->mEncodedNorms.address(); TSMesh::smDataCopied[i] = !skip; // as long as we didn't skip this mesh, the data should be in shape now - TSSkinMesh::smInitTransformList[i] = skin->batchData.initialTransforms.address(); - TSSkinMesh::smVertexIndexList[i] = skin->vertexIndex.address(); - TSSkinMesh::smBoneIndexList[i] = skin->boneIndex.address(); - TSSkinMesh::smWeightList[i] = skin->weight.address(); - TSSkinMesh::smNodeIndexList[i] = skin->batchData.nodeIndex.address(); + TSSkinMesh::smInitTransformList[i] = skin->mBatchData.initialTransforms.address(); + TSSkinMesh::smVertexIndexList[i] = skin->mVertexIndex.address(); + TSSkinMesh::smBoneIndexList[i] = skin->mBoneIndex.address(); + TSSkinMesh::smWeightList[i] = skin->mWeight.address(); + TSSkinMesh::smNodeIndexList[i] = skin->mBatchData.nodeIndex.address(); } } diff --git a/Engine/source/ts/tsShapeEdit.cpp b/Engine/source/ts/tsShapeEdit.cpp index ba3c99a51..4eac3c3f6 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -485,10 +485,10 @@ bool TSShape::addNode(const String& name, const String& parentName, const Point3 if (meshes[i] && (meshes[i]->getMeshType() == TSMesh::SkinMeshType)) { TSSkinMesh* skin = dynamic_cast(meshes[i]); - for (S32 j = 0; j < skin->batchData.nodeIndex.size(); j++) + for (S32 j = 0; j < skin->mBatchData.nodeIndex.size(); j++) { - if (skin->batchData.nodeIndex[j] >= nodeIndex) - skin->batchData.nodeIndex[j]++; + if (skin->mBatchData.nodeIndex[j] >= nodeIndex) + skin->mBatchData.nodeIndex[j]++; } } } @@ -613,12 +613,12 @@ bool TSShape::removeNode(const String& name) if (meshes[i] && (meshes[i]->getMeshType() == TSMesh::SkinMeshType)) { TSSkinMesh* skin = dynamic_cast(meshes[i]); - for (S32 j = 0; j < skin->batchData.nodeIndex.size(); j++) + for (S32 j = 0; j < skin->mBatchData.nodeIndex.size(); j++) { - if (skin->batchData.nodeIndex[j] == nodeIndex) - skin->batchData.nodeIndex[j] = nodeParentIndex; - if (skin->batchData.nodeIndex[j] > nodeIndex) - skin->batchData.nodeIndex[j]--; + if (skin->mBatchData.nodeIndex[j] == nodeIndex) + skin->mBatchData.nodeIndex[j] = nodeParentIndex; + if (skin->mBatchData.nodeIndex[j] > nodeIndex) + skin->mBatchData.nodeIndex[j]--; } } } @@ -876,14 +876,14 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const // Copy skin elements const TSSkinMesh *srcSkin = dynamic_cast(srcMesh); - skin->weight = srcSkin->weight; - skin->vertexIndex = srcSkin->vertexIndex; - skin->boneIndex = srcSkin->boneIndex; + skin->mWeight = srcSkin->mWeight; + skin->mVertexIndex = srcSkin->mVertexIndex; + skin->mBoneIndex = srcSkin->mBoneIndex; - skin->batchData.nodeIndex = srcSkin->batchData.nodeIndex; - skin->batchData.initialTransforms = srcSkin->batchData.initialTransforms; - skin->batchData.initialVerts = srcSkin->batchData.initialVerts; - skin->batchData.initialNorms = srcSkin->batchData.initialNorms; + skin->mBatchData.nodeIndex = srcSkin->mBatchData.nodeIndex; + skin->mBatchData.initialTransforms = srcSkin->mBatchData.initialTransforms; + skin->mBatchData.initialVerts = srcSkin->mBatchData.initialVerts; + skin->mBatchData.initialNorms = srcSkin->mBatchData.initialNorms; mesh = static_cast(skin); } @@ -1073,9 +1073,9 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String for (S32 i = 0; i < srcShape->nodes.size(); i++) nodeMap.push_back( findNode( srcShape->getName(srcShape->nodes[i].nameIndex) ) ); - for (S32 i = 0; i < srcSkin->boneIndex.size(); i++) + for (S32 i = 0; i < srcSkin->mBoneIndex.size(); i++) { - S32 srcNode = srcSkin->boneIndex[i]; + S32 srcNode = srcSkin->mBoneIndex[i]; if (nodeMap[srcNode] == -1) { const char* name = srcShape->getName(srcShape->nodes[srcNode].nameIndex).c_str(); @@ -1088,9 +1088,9 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String TSSkinMesh *skin = dynamic_cast(mesh); // Remap node indices - skin->batchData.nodeIndex = srcSkin->batchData.nodeIndex; - for (S32 i = 0; i < skin->batchData.nodeIndex.size(); i++) - skin->batchData.nodeIndex[i] = nodeMap[skin->batchData.nodeIndex[i]]; + skin->mBatchData.nodeIndex = srcSkin->mBatchData.nodeIndex; + for (S32 i = 0; i < skin->mBatchData.nodeIndex.size(); i++) + skin->mBatchData.nodeIndex[i] = nodeMap[skin->mBatchData.nodeIndex[i]]; } // Add the copied mesh to the shape From 69dbaf5b8547aae75f8b771225fae9f9d10be754 Mon Sep 17 00:00:00 2001 From: bank Date: Tue, 13 May 2014 14:08:42 +0400 Subject: [PATCH 14/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSShape --- Engine/source/T3D/debris.cpp | 2 +- .../T3D/examples/renderShapeExample.cpp | 2 +- Engine/source/T3D/fx/explosion.cpp | 2 +- Engine/source/T3D/fx/groundCover.cpp | 2 +- Engine/source/T3D/guiMaterialPreview.cpp | 6 +- Engine/source/T3D/guiObjectView.cpp | 8 +- Engine/source/T3D/physics/physicsDebris.cpp | 12 +- Engine/source/T3D/physics/physicsShape.cpp | 2 +- Engine/source/T3D/player.cpp | 6 +- Engine/source/T3D/projectile.cpp | 2 +- Engine/source/T3D/shapeBase.cpp | 52 +- Engine/source/T3D/shapeImage.cpp | 4 +- Engine/source/T3D/tsStatic.cpp | 12 +- Engine/source/T3D/turret/turretShape.cpp | 16 +- Engine/source/T3D/vehicles/wheeledVehicle.cpp | 6 +- Engine/source/forest/ts/tsForestItemData.cpp | 16 +- Engine/source/forest/ts/tsForestItemData.h | 2 +- .../source/gui/editor/guiShapeEdPreview.cpp | 78 +- Engine/source/lighting/common/blobShadow.cpp | 6 +- .../source/ts/collada/colladaShapeLoader.cpp | 10 +- Engine/source/ts/loader/tsShapeLoader.cpp | 216 ++--- Engine/source/ts/tsAnimate.cpp | 66 +- Engine/source/ts/tsCollision.cpp | 116 +-- Engine/source/ts/tsDump.cpp | 52 +- Engine/source/ts/tsLastDetail.cpp | 4 +- Engine/source/ts/tsMeshFit.cpp | 20 +- Engine/source/ts/tsPartInstance.cpp | 16 +- Engine/source/ts/tsShape.cpp | 788 +++++++++--------- Engine/source/ts/tsShape.h | 82 +- Engine/source/ts/tsShapeConstruct.cpp | 96 +-- Engine/source/ts/tsShapeEdit.cpp | 654 +++++++-------- Engine/source/ts/tsShapeInstance.cpp | 52 +- Engine/source/ts/tsShapeInstance.h | 4 +- Engine/source/ts/tsShapeOldRead.cpp | 298 +++---- Engine/source/ts/tsThread.cpp | 44 +- 35 files changed, 1377 insertions(+), 1377 deletions(-) diff --git a/Engine/source/T3D/debris.cpp b/Engine/source/T3D/debris.cpp index 8b07154ec..4b6f5c993 100644 --- a/Engine/source/T3D/debris.cpp +++ b/Engine/source/T3D/debris.cpp @@ -568,7 +568,7 @@ bool Debris::onAdd() // Setup our bounding box if( mDataBlock->shape ) { - mObjBox = mDataBlock->shape->bounds; + mObjBox = mDataBlock->shape->mBounds; } else { diff --git a/Engine/source/T3D/examples/renderShapeExample.cpp b/Engine/source/T3D/examples/renderShapeExample.cpp index 0e60c3801..5f0847b90 100644 --- a/Engine/source/T3D/examples/renderShapeExample.cpp +++ b/Engine/source/T3D/examples/renderShapeExample.cpp @@ -213,7 +213,7 @@ void RenderShapeExample::createShape() } // Update the bounding box - mObjBox = mShape->bounds; + mObjBox = mShape->mBounds; resetWorldBox(); setRenderTransform(mObjToWorld); diff --git a/Engine/source/T3D/fx/explosion.cpp b/Engine/source/T3D/fx/explosion.cpp index 2acfa8487..7ee5fc1fb 100644 --- a/Engine/source/T3D/fx/explosion.cpp +++ b/Engine/source/T3D/fx/explosion.cpp @@ -1246,7 +1246,7 @@ bool Explosion::explode() mEndingMS = U32(mExplosionInstance->getScaledDuration(mExplosionThread) * 1000.0f); mObjScale.convolve(mDataBlock->explosionScale); - mObjBox = mDataBlock->explosionShape->bounds; + mObjBox = mDataBlock->explosionShape->mBounds; resetWorldBox(); } diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index bfc2f7737..248031635 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -1142,7 +1142,7 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index, const F32 typeMaxElevation = mMaxElevation[type]; const F32 typeMinElevation = mMinElevation[type]; const bool typeIsShape = mShapeInstances[ type ] != NULL; - const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->bounds : Box3F(); + const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->mBounds : Box3F(); const F32 typeWindScale = mWindScale[type]; StringTableEntry typeLayer = mLayer[type]; const bool typeInvertLayer = mInvertLayer[type]; diff --git a/Engine/source/T3D/guiMaterialPreview.cpp b/Engine/source/T3D/guiMaterialPreview.cpp index 1229956e6..1392f9186 100644 --- a/Engine/source/T3D/guiMaterialPreview.cpp +++ b/Engine/source/T3D/guiMaterialPreview.cpp @@ -268,8 +268,8 @@ void GuiMaterialPreview::setObjectModel(const char* modelName) AssertFatal(mModel, avar("GuiMaterialPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName)); // Initialize camera values: - mOrbitPos = mModel->getShape()->center; - mMinOrbitDist = mModel->getShape()->radius; + mOrbitPos = mModel->getShape()->mCenter; + mMinOrbitDist = mModel->getShape()->mRadius; lastRenderTime = Platform::getVirtualMilliseconds(); } @@ -434,7 +434,7 @@ void GuiMaterialPreview::resetViewport() mCameraRot.set( mDegToRad(30.0f), 0, mDegToRad(-30.0f) ); mCameraPos.set(0.0f, 1.75f, 1.25f); mOrbitDist = 5.0f; - mOrbitPos = mModel->getShape()->center; + mOrbitPos = mModel->getShape()->mCenter; // Reset the viewport's lighting. GuiMaterialPreview::mFakeSun->setColor( ColorF( 1.0f, 1.0f, 1.0f ) ); diff --git a/Engine/source/T3D/guiObjectView.cpp b/Engine/source/T3D/guiObjectView.cpp index 00e5de0df..35b4ad936 100644 --- a/Engine/source/T3D/guiObjectView.cpp +++ b/Engine/source/T3D/guiObjectView.cpp @@ -366,8 +366,8 @@ void GuiObjectView::setObjectModel( const String& modelName ) // Initialize camera values. - mOrbitPos = mModel->getShape()->center; - mMinOrbitDist = mModel->getShape()->radius; + mOrbitPos = mModel->getShape()->mCenter; + mMinOrbitDist = mModel->getShape()->mRadius; // Initialize animation. @@ -645,7 +645,7 @@ void GuiObjectView::_initAnimation() if( mAnimationSeq != -1 ) { - if( mAnimationSeq >= mModel->getShape()->sequences.size() ) + if( mAnimationSeq >= mModel->getShape()->mSequences.size() ) { Con::errorf( "GuiObjectView::_initAnimation - Sequence '%i' out of range for model '%s'", mAnimationSeq, @@ -694,7 +694,7 @@ void GuiObjectView::_initMount() // Make sure mount node is valid. - if( mMountNode != -1 && mMountNode >= mModel->getShape()->nodes.size() ) + if( mMountNode != -1 && mMountNode >= mModel->getShape()->mNodes.size() ) { Con::errorf( "GuiObjectView::_initMount - Mount node index '%i' out of range for '%s'", mMountNode, diff --git a/Engine/source/T3D/physics/physicsDebris.cpp b/Engine/source/T3D/physics/physicsDebris.cpp index 38549980a..195b2f2ae 100644 --- a/Engine/source/T3D/physics/physicsDebris.cpp +++ b/Engine/source/T3D/physics/physicsDebris.cpp @@ -350,7 +350,7 @@ bool PhysicsDebris::onAdd() } // Setup our bounding box - mObjBox = mDataBlock->shape->bounds; + mObjBox = mDataBlock->shape->mBounds; resetWorldBox(); // Add it to the client scene. @@ -688,20 +688,20 @@ void PhysicsDebris::_findNodes( U32 colNode, Vector &nodeIds ) // 2. Collision node is a child of its visible mesh node TSShape *shape = mDataBlock->shape; - S32 itr = shape->nodes[colNode].parentIndex; - itr = shape->nodes[itr].firstChild; + S32 itr = shape->mNodes[colNode].parentIndex; + itr = shape->mNodes[itr].firstChild; while ( itr != -1 ) { if ( itr != colNode ) nodeIds.push_back(itr); - itr = shape->nodes[itr].nextSibling; + itr = shape->mNodes[itr].nextSibling; } // If we didn't find any siblings of the collision node we assume // it is case #2 and the collision nodes direct parent is the visible mesh. - if ( nodeIds.size() == 0 && shape->nodes[colNode].parentIndex != -1 ) - nodeIds.push_back( shape->nodes[colNode].parentIndex ); + if ( nodeIds.size() == 0 && shape->mNodes[colNode].parentIndex != -1 ) + nodeIds.push_back( shape->mNodes[colNode].parentIndex ); } extern bool gEditingMission; diff --git a/Engine/source/T3D/physics/physicsShape.cpp b/Engine/source/T3D/physics/physicsShape.cpp index 660db0791..9fccc505a 100644 --- a/Engine/source/T3D/physics/physicsShape.cpp +++ b/Engine/source/T3D/physics/physicsShape.cpp @@ -698,7 +698,7 @@ bool PhysicsShape::_createShape() return false; // Set the world box. - mObjBox = db->shape->bounds; + mObjBox = db->shape->mBounds; resetWorldBox(); // If this is the server and its a client only simulation diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 1440f2d71..0646b71cb 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -492,12 +492,12 @@ bool PlayerData::preload(bool server, String &errorStr) if (dStricmp(sp->name, "jet") != 0) AssertWarn(dp->sequence != -1, avar("PlayerData::preload - Unable to find named animation sequence '%s'!", sp->name)); } - for (S32 b = 0; b < mShape->sequences.size(); b++) + for (S32 b = 0; b < mShape->mSequences.size(); b++) { if (!isTableSequence(b)) { dp->sequence = b; - dp->name = mShape->getName(mShape->sequences[b].nameIndex); + dp->name = mShape->getName(mShape->mSequences[b].nameIndex); dp->velocityScale = false; getGroundInfo(si,thread,dp++); } @@ -614,7 +614,7 @@ void PlayerData::getGroundInfo(TSShapeInstance* si, TSThread* thread,ActionAnima dp->dir.set(0.0f, 0.0f, 0.0f); // Death animations MUST define ground transforms, so add dummy ones if required - if (si->getShape()->sequences[dp->sequence].numGroundFrames == 0) + if (si->getShape()->mSequences[dp->sequence].numGroundFrames == 0) si->getShape()->setSequenceGroundSpeed(dp->name, Point3F(0, 0, 0), Point3F(0, 0, 0)); } else diff --git a/Engine/source/T3D/projectile.cpp b/Engine/source/T3D/projectile.cpp index 86886c2b5..51875ff95 100644 --- a/Engine/source/T3D/projectile.cpp +++ b/Engine/source/T3D/projectile.cpp @@ -764,7 +764,7 @@ bool Projectile::onAdd() // Setup our bounding box if (bool(mDataBlock->projectileShape) == true) - mObjBox = mDataBlock->projectileShape->bounds; + mObjBox = mDataBlock->projectileShape->mBounds; else mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0)); diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 6661eb74c..1e8188246 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -319,9 +319,9 @@ bool ShapeBaseData::preload(bool server, String &errorStr) // Resolve details and camera node indexes. static const String sCollisionStr( "collision-" ); - for (i = 0; i < mShape->details.size(); i++) + for (i = 0; i < mShape->mDetails.size(); i++) { - const String &name = mShape->names[mShape->details[i].nameIndex]; + const String &name = mShape->mNames[mShape->mDetails[i].nameIndex]; if (name.compare( sCollisionStr, sCollisionStr.length(), String::NoCase ) == 0) { @@ -331,15 +331,15 @@ bool ShapeBaseData::preload(bool server, String &errorStr) mShape->computeBounds(collisionDetails.last(), collisionBounds.last()); mShape->getAccelerator(collisionDetails.last()); - if (!mShape->bounds.isContained(collisionBounds.last())) + if (!mShape->mBounds.isContained(collisionBounds.last())) { Con::warnf("Warning: shape %s collision detail %d (Collision-%d) bounds exceed that of shape.", shapeName, collisionDetails.size() - 1, collisionDetails.last()); - collisionBounds.last() = mShape->bounds; + collisionBounds.last() = mShape->mBounds; } else if (collisionBounds.last().isValidBox() == false) { Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", shapeName, collisionDetails.size() - 1, collisionDetails.last()); - collisionBounds.last() = mShape->bounds; + collisionBounds.last() = mShape->mBounds; } // The way LOS works is that it will check to see if there is a LOS detail that matches @@ -360,9 +360,9 @@ bool ShapeBaseData::preload(bool server, String &errorStr) // Snag any "unmatched" LOS details static const String sLOSStr( "LOS-" ); - for (i = 0; i < mShape->details.size(); i++) + for (i = 0; i < mShape->mDetails.size(); i++) { - const String &name = mShape->names[mShape->details[i].nameIndex]; + const String &name = mShape->mNames[mShape->mDetails[i].nameIndex]; if (name.compare( sLOSStr, sLOSStr.length(), String::NoCase ) == 0) { @@ -406,7 +406,7 @@ bool ShapeBaseData::preload(bool server, String &errorStr) damageSequence = mShape->findSequence("Damage"); // - F32 w = mShape->bounds.len_y() / 2; + F32 w = mShape->mBounds.len_y() / 2; if (cameraMaxDist < w) cameraMaxDist = w; } @@ -602,7 +602,7 @@ DefineEngineMethod( ShapeBaseData, checkDeployPos, bool, ( TransformF txfm ),, MatrixF mat = txfm.getMatrix(); - Box3F objBox = object->mShape->bounds; + Box3F objBox = object->mShape->mBounds; Point3F boxCenter = (objBox.minExtents + objBox.maxExtents) * 0.5f; objBox.minExtents = boxCenter + (objBox.minExtents - boxCenter) * 0.9f; objBox.maxExtents = boxCenter + (objBox.maxExtents - boxCenter) * 0.9f; @@ -1104,11 +1104,11 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) if (isClientObject()) mShapeInstance->cloneMaterialList(); - mObjBox = mDataBlock->mShape->bounds; + mObjBox = mDataBlock->mShape->mBounds; resetWorldBox(); // Set the initial mesh hidden state. - mMeshHidden.setSize( mDataBlock->mShape->objects.size() ); + mMeshHidden.setSize( mDataBlock->mShape->mObjects.size() ); mMeshHidden.clear(); // Initialize the threads @@ -1133,8 +1133,8 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) AssertFatal( prevDB != NULL, "ShapeBase::onNewDataBlock - how did you have a sequence playing without a prior datablock?" ); const TSShape *prevShape = prevDB->mShape; - const TSShape::Sequence &prevSeq = prevShape->sequences[st.sequence]; - const String &prevSeqName = prevShape->names[prevSeq.nameIndex]; + const TSShape::Sequence &prevSeq = prevShape->mSequences[st.sequence]; + const String &prevSeqName = prevShape->mNames[prevSeq.nameIndex]; st.sequence = mDataBlock->mShape->findSequence( prevSeqName ); @@ -2130,7 +2130,7 @@ const char *ShapeBase::getThreadSequenceName( U32 slot ) } // Name Index - const U32 nameIndex = getShape()->sequences[st.sequence].nameIndex; + const U32 nameIndex = getShape()->mSequences[st.sequence].nameIndex; // Return Name. return getShape()->getName( nameIndex ); @@ -2343,7 +2343,7 @@ void ShapeBase::advanceThreads(F32 dt) for (U32 i = 0; i < MaxScriptThreads; i++) { Thread& st = mScriptThread[i]; if (st.thread) { - if (!mShapeInstance->getShape()->sequences[st.sequence].isCyclic() && !st.atEnd && + if (!mShapeInstance->getShape()->mSequences[st.sequence].isCyclic() && !st.atEnd && ( ( st.timescale > 0.f )? mShapeInstance->getPos(st.thread) >= 1.0: mShapeInstance->getPos(st.thread) <= 0)) { st.atEnd = true; @@ -2622,7 +2622,7 @@ void ShapeBase::_renderBoundingBox( ObjectRenderInst *ri, SceneRenderState *stat MatrixF mat; getRenderImageTransform( ri->objectIndex, &mat ); - const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->bounds; + const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->mBounds; drawer->drawCube( desc, objBox, ColorI( 255, 255, 255 ), &mat ); } @@ -3341,17 +3341,17 @@ void ShapeBaseConvex::findNodeTransform() TSShapeInstance* si = pShapeBase->getShapeInstance(); TSShape* shape = si->getShape(); - const TSShape::Detail* detail = &shape->details[dl]; + const TSShape::Detail* detail = &shape->mDetails[dl]; const S32 subs = detail->subShapeNum; - const S32 start = shape->subShapeFirstObject[subs]; - const S32 end = start + shape->subShapeNumObjects[subs]; + const S32 start = shape->mSubShapeFirstObject[subs]; + const S32 end = start + shape->mSubShapeNumObjects[subs]; // Find the first object that contains a mesh for this // detail level. There should only be one mesh per // collision detail level. for (S32 i = start; i < end; i++) { - const TSShape::Object* obj = &shape->objects[i]; + const TSShape::Object* obj = &shape->mObjects[i]; if (obj->numMeshes && detail->objectDetailNum < obj->numMeshes) { nodeTransform = &si->mNodeTransforms[obj->nodeIndex]; @@ -4921,7 +4921,7 @@ DefineEngineMethod( ShapeBase, changeMaterial, void, ( const char* mapTo, Materi ShapeBase *clientObj = dynamic_cast< ShapeBase* > ( object->getClientObject() ); // Check the mapTo name exists for this shape - S32 matIndex = serverObj->getShape()->materialList->getMaterialNameList().find_next(String(mapTo)); + S32 matIndex = serverObj->getShape()->mMaterialList->getMaterialNameList().find_next(String(mapTo)); if (matIndex < 0) { Con::errorf("ShapeBase::changeMaterial failed: Invalid mapTo name '%s'", mapTo); @@ -4940,19 +4940,19 @@ DefineEngineMethod( ShapeBase, changeMaterial, void, ( const char* mapTo, Materi // Replace instances with the new material being traded in. For ShapeBase // class we have to update the server/client objects separately so both // represent our changes - delete serverObj->getShape()->materialList->mMatInstList[matIndex]; - serverObj->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance(); + delete serverObj->getShape()->mMaterialList->mMatInstList[matIndex]; + serverObj->getShape()->mMaterialList->mMatInstList[matIndex] = newMat->createMatInstance(); if (clientObj) { - delete clientObj->getShape()->materialList->mMatInstList[matIndex]; - clientObj->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance(); + delete clientObj->getShape()->mMaterialList->mMatInstList[matIndex]; + clientObj->getShape()->mMaterialList->mMatInstList[matIndex] = newMat->createMatInstance(); } // Finish up preparing the material instances for rendering const GFXVertexFormat *flags = getGFXVertexFormat(); FeatureSet features = MATMGR->getDefaultFeatures(); - serverObj->getShape()->materialList->getMaterialInst(matIndex)->init( features, flags ); + serverObj->getShape()->mMaterialList->getMaterialInst(matIndex)->init( features, flags ); if (clientObj) clientObj->getShapeInstance()->mMaterialList->getMaterialInst(matIndex)->init( features, flags ); } diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index f49b44ba9..494b70249 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -490,9 +490,9 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr) do { MatrixF nmat; QuatF q; - TSTransform::setMatrix(shape[i]->defaultRotations[node].getQuatF(&q),shape[i]->defaultTranslations[node],&nmat); + TSTransform::setMatrix(shape[i]->mDefaultRotations[node].getQuatF(&q),shape[i]->mDefaultTranslations[node],&nmat); total.mul(nmat); - node = shape[i]->nodes[node].parentIndex; + node = shape[i]->mNodes[node].parentIndex; } while(node != -1); total.inverse(); diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 1474bf96d..74911db79 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -314,7 +314,7 @@ bool TSStatic::_createShape() NetConnection::filesWereDownloaded() ) return false; - mObjBox = mShape->bounds; + mObjBox = mShape->mBounds; resetWorldBox(); mShapeInstance = new TSShapeInstance( mShape, isClientObject() ); @@ -371,7 +371,7 @@ void TSStatic::_updatePhysics() if ( mCollisionType == Bounds ) { MatrixF offset( true ); - offset.setPosition( mShape->center ); + offset.setPosition( mShape->mCenter ); colShape = PHYSICSMGR->createCollision(); colShape->addBox( getObjBox().getExtents() * 0.5f * mObjScale, offset ); } @@ -1109,7 +1109,7 @@ DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Materia } // Check the mapTo name exists for this shape - S32 matIndex = object->getShape()->materialList->getMaterialNameList().find_next(String(mapTo)); + S32 matIndex = object->getShape()->mMaterialList->getMaterialNameList().find_next(String(mapTo)); if (matIndex < 0) { Con::errorf("TSShape::changeMaterial failed: Invalid mapTo name '%s'", mapTo); @@ -1127,13 +1127,13 @@ DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Materia // Replace instances with the new material being traded in. Lets make sure that we only // target the specific targets per inst, this is actually doing more than we thought - delete object->getShape()->materialList->mMatInstList[matIndex]; - object->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance(); + delete object->getShape()->mMaterialList->mMatInstList[matIndex]; + object->getShape()->mMaterialList->mMatInstList[matIndex] = newMat->createMatInstance(); // Finish up preparing the material instances for rendering const GFXVertexFormat *flags = getGFXVertexFormat(); FeatureSet features = MATMGR->getDefaultFeatures(); - object->getShape()->materialList->getMaterialInst(matIndex)->init( features, flags ); + object->getShape()->mMaterialList->getMaterialInst(matIndex)->init( features, flags ); } DefineEngineMethod( TSStatic, getModelFile, const char *, (),, diff --git a/Engine/source/T3D/turret/turretShape.cpp b/Engine/source/T3D/turret/turretShape.cpp index 5d53fabe8..63165cafa 100644 --- a/Engine/source/T3D/turret/turretShape.cpp +++ b/Engine/source/T3D/turret/turretShape.cpp @@ -823,8 +823,8 @@ void TurretShape::_updateNodes(const Point3F& rot) if (node != -1) { MatrixF* mat = &mShapeInstance->mNodeTransforms[node]; - Point3F defaultPos = mShapeInstance->getShape()->defaultTranslations[node]; - Quat16 defaultRot = mShapeInstance->getShape()->defaultRotations[node]; + Point3F defaultPos = mShapeInstance->getShape()->mDefaultTranslations[node]; + Quat16 defaultRot = mShapeInstance->getShape()->mDefaultRotations[node]; QuatF qrot(zRot); qrot *= defaultRot.getQuatF(); @@ -837,8 +837,8 @@ void TurretShape::_updateNodes(const Point3F& rot) if (node != -1) { MatrixF* mat = &mShapeInstance->mNodeTransforms[node]; - Point3F defaultPos = mShapeInstance->getShape()->defaultTranslations[node]; - Quat16 defaultRot = mShapeInstance->getShape()->defaultRotations[node]; + Point3F defaultPos = mShapeInstance->getShape()->mDefaultTranslations[node]; + Quat16 defaultRot = mShapeInstance->getShape()->mDefaultRotations[node]; QuatF qrot(xRot); qrot *= defaultRot.getQuatF(); @@ -853,8 +853,8 @@ void TurretShape::_updateNodes(const Point3F& rot) if (node != -1) { MatrixF* mat = &mShapeInstance->mNodeTransforms[node]; - Point3F defaultPos = mShapeInstance->getShape()->defaultTranslations[node]; - Quat16 defaultRot = mShapeInstance->getShape()->defaultRotations[node]; + Point3F defaultPos = mShapeInstance->getShape()->mDefaultTranslations[node]; + Quat16 defaultRot = mShapeInstance->getShape()->mDefaultRotations[node]; QuatF qrot(xRot); qrot *= defaultRot.getQuatF(); @@ -866,8 +866,8 @@ void TurretShape::_updateNodes(const Point3F& rot) if (node != -1) { MatrixF* mat = &mShapeInstance->mNodeTransforms[node]; - Point3F defaultPos = mShapeInstance->getShape()->defaultTranslations[node]; - Quat16 defaultRot = mShapeInstance->getShape()->defaultRotations[node]; + Point3F defaultPos = mShapeInstance->getShape()->mDefaultTranslations[node]; + Quat16 defaultRot = mShapeInstance->getShape()->mDefaultRotations[node]; QuatF qrot(zRot); qrot *= defaultRot.getQuatF(); diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index 39556168c..49bf0146b 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -111,7 +111,7 @@ bool WheeledVehicleTire::preload(bool server, String &errorStr) // Determinw wheel radius from the shape's bounding box. // The tire should be built with it's hub axis along the // object's Y axis. - radius = shape->bounds.len_z() / 2; + radius = shape->mBounds.len_z() / 2; } return true; @@ -399,8 +399,8 @@ bool WheeledVehicleData::preload(bool server, String &errorStr) if (collisionDetails[0] != -1) { MatrixF imat(1); SphereF sphere; - sphere.center = mShape->center; - sphere.radius = mShape->radius; + sphere.center = mShape->mCenter; + sphere.radius = mShape->mRadius; PlaneExtractorPolyList polyList; polyList.mPlaneList = &rigidBody.mPlaneList; polyList.setTransform(&imat, Point3F(1,1,1)); diff --git a/Engine/source/forest/ts/tsForestItemData.cpp b/Engine/source/forest/ts/tsForestItemData.cpp index d5574587d..31435c310 100644 --- a/Engine/source/forest/ts/tsForestItemData.cpp +++ b/Engine/source/forest/ts/tsForestItemData.cpp @@ -154,7 +154,7 @@ TSShapeInstance* TSForestItemData::_getShapeInstance() const void TSForestItemData::_checkLastDetail() { const S32 dl = mShape->mSmallestVisibleDL; - const TSDetail *detail = &mShape->details[dl]; + const TSDetail *detail = &mShape->mDetails[dl]; // TODO: Expose some real parameters to the datablock maybe? if ( detail->subShapeNum != -1 ) @@ -162,8 +162,8 @@ void TSForestItemData::_checkLastDetail() mShape->addImposter( mShapeFile, 10, 4, 0, 0, 256, 0, 0 ); // HACK: If i don't do this it crashes! - while ( mShape->detailCollisionAccelerators.size() < mShape->details.size() ) - mShape->detailCollisionAccelerators.push_back( NULL ); + while ( mShape->mDetailCollisionAccelerators.size() < mShape->mDetails.size() ) + mShape->mDetailCollisionAccelerators.push_back( NULL ); } } @@ -174,12 +174,12 @@ TSLastDetail* TSForestItemData::getLastDetail() const return NULL; const S32 dl = mShape->mSmallestVisibleDL; - const TSDetail* detail = &mShape->details[dl]; + const TSDetail* detail = &mShape->mDetails[dl]; if ( detail->subShapeNum >= 0 || - mShape->billboardDetails.size() <= dl ) + mShape->mBillboardDetails.size() <= dl ) return NULL; - return mShape->billboardDetails[dl]; + return mShape->mBillboardDetails[dl]; } ForestCellBatch* TSForestItemData::allocateBatch() const @@ -207,8 +207,8 @@ bool TSForestItemData::canBillboard( const SceneRenderState *state, const Forest if ( dl < 0 ) return true; - const TSDetail *detail = &mShape->details[dl]; - if ( detail->subShapeNum < 0 && dl < mShape->billboardDetails.size() ) + const TSDetail *detail = &mShape->mDetails[dl]; + if ( detail->subShapeNum < 0 && dl < mShape->mBillboardDetails.size() ) return true; return false; diff --git a/Engine/source/forest/ts/tsForestItemData.h b/Engine/source/forest/ts/tsForestItemData.h index 197069c9f..80316447c 100644 --- a/Engine/source/forest/ts/tsForestItemData.h +++ b/Engine/source/forest/ts/tsForestItemData.h @@ -88,7 +88,7 @@ public: const Vector& getLOSDetails() const { return mLOSDetails; } // ForestItemData - const Box3F& getObjBox() const { return mShape ? mShape->bounds : Box3F::Invalid; } + const Box3F& getObjBox() const { return mShape ? mShape->mBounds : Box3F::Invalid; } bool render( TSRenderState *rdata, const ForestItem& item ) const; ForestCellBatch* allocateBatch() const; bool canBillboard( const SceneRenderState *state, const ForestItem &item, F32 distToCamera ) const; diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 7b3afdedc..3394aa991 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -331,7 +331,7 @@ void GuiShapeEdPreview::setCurrentDetail(S32 dl) if ( mModel ) { S32 smallest = mModel->getShape()->mSmallestVisibleDL; - mModel->getShape()->mSmallestVisibleDL = mModel->getShape()->details.size()-1; + mModel->getShape()->mSmallestVisibleDL = mModel->getShape()->mDetails.size()-1; mModel->setCurrentDetail( dl ); mModel->getShape()->mSmallestVisibleDL = smallest; @@ -360,18 +360,18 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName) AssertFatal( mModel, avar("GuiShapeEdPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName )); // Initialize camera values: - mOrbitPos = mModel->getShape()->center; + mOrbitPos = mModel->getShape()->mCenter; // Set camera move and zoom speed according to model size - mMoveSpeed = mModel->getShape()->radius / sMoveScaler; - mZoomSpeed = mModel->getShape()->radius / sZoomScaler; + mMoveSpeed = mModel->getShape()->mRadius / sMoveScaler; + mZoomSpeed = mModel->getShape()->mRadius / sZoomScaler; // Reset node selection mHoverNode = -1; mSelectedNode = -1; mSelectedObject = -1; mSelectedObjDetail = 0; - mProjectedNodes.setSize( mModel->getShape()->nodes.size() ); + mProjectedNodes.setSize( mModel->getShape()->mNodes.size() ); // Reset detail stats mCurrentDL = 0; @@ -683,9 +683,9 @@ void GuiShapeEdPreview::refreshShape() mModel->initNodeTransforms(); mModel->initMeshObjects(); - mProjectedNodes.setSize( mModel->getShape()->nodes.size() ); + mProjectedNodes.setSize( mModel->getShape()->mNodes.size() ); - if ( mSelectedObject >= mModel->getShape()->objects.size() ) + if ( mSelectedObject >= mModel->getShape()->mObjects.size() ) { mSelectedObject = -1; mSelectedObjDetail = 0; @@ -694,9 +694,9 @@ void GuiShapeEdPreview::refreshShape() // Re-compute the collision mesh stats mColMeshes = 0; mColPolys = 0; - for ( S32 i = 0; i < mModel->getShape()->details.size(); i++ ) + for ( S32 i = 0; i < mModel->getShape()->mDetails.size(); i++ ) { - const TSShape::Detail& det = mModel->getShape()->details[i]; + const TSShape::Detail& det = mModel->getShape()->mDetails[i]; const String& detName = mModel->getShape()->getName( det.nameIndex ); if ( ( det.subShapeNum < 0 ) || !detName.startsWith( "collision-" ) ) continue; @@ -704,12 +704,12 @@ void GuiShapeEdPreview::refreshShape() mColPolys += det.polyCount; S32 od = det.objectDetailNum; - S32 start = mModel->getShape()->subShapeFirstObject[det.subShapeNum]; - S32 end = start + mModel->getShape()->subShapeNumObjects[det.subShapeNum]; + S32 start = mModel->getShape()->mSubShapeFirstObject[det.subShapeNum]; + S32 end = start + mModel->getShape()->mSubShapeNumObjects[det.subShapeNum]; for ( S32 j = start; j < end; j++ ) { - const TSShape::Object &obj = mModel->getShape()->objects[j]; - const TSMesh* mesh = ( od < obj.numMeshes ) ? mModel->getShape()->meshes[obj.startMeshIndex + od] : NULL; + const TSShape::Object &obj = mModel->getShape()->mObjects[j]; + const TSMesh* mesh = ( od < obj.numMeshes ) ? mModel->getShape()->mMeshes[obj.startMeshIndex + od] : NULL; if ( mesh ) mColMeshes++; } @@ -850,7 +850,7 @@ void GuiShapeEdPreview::exportToCollada( const String& path ) if ( mModel ) { MatrixF orientation( true ); - orientation.setPosition( mModel->getShape()->bounds.getCenter() ); + orientation.setPosition( mModel->getShape()->mBounds.getCenter() ); orientation.inverse(); OptimizedPolyList polyList; @@ -1135,8 +1135,8 @@ bool GuiShapeEdPreview::getCameraTransform(MatrixF* cameraMatrix) cameraMatrix->identity(); if ( mModel ) { - Point3F camPos = mModel->getShape()->bounds.getCenter(); - F32 offset = mModel->getShape()->bounds.len(); + Point3F camPos = mModel->getShape()->mBounds.getCenter(); + F32 offset = mModel->getShape()->mBounds.len(); switch (mDisplayType) { @@ -1166,11 +1166,11 @@ void GuiShapeEdPreview::computeSceneBounds(Box3F& bounds) void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state) { // Make sure current detail is valid - if ( !mModel->getShape()->details.size() ) + if ( !mModel->getShape()->mDetails.size() ) return; - if ( mModel->getCurrentDetail() >= mModel->getShape()->details.size() ) - setCurrentDetail( mModel->getShape()->details.size() - 1 ); + if ( mModel->getCurrentDetail() >= mModel->getShape()->mDetails.size() ) + setCurrentDetail( mModel->getShape()->mDetails.size() - 1 ); // Convert between FOV and distance so zoom is consistent between Perspective // and Orthographic views (conversion factor found by trial and error) @@ -1193,7 +1193,7 @@ void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state) setCurrentDetail( 0 ); currentDetail = mModel->getCurrentDetail(); - const TSShape::Detail& det = mModel->getShape()->details[ currentDetail ]; + const TSShape::Detail& det = mModel->getShape()->mDetails[ currentDetail ]; mDetailPolys = det.polyCount; mDetailSize = det.size; @@ -1213,17 +1213,17 @@ void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state) { Vector usedMaterials; - S32 start = mModel->getShape()->subShapeFirstObject[det.subShapeNum]; - S32 end = start + mModel->getShape()->subShapeNumObjects[det.subShapeNum]; + S32 start = mModel->getShape()->mSubShapeFirstObject[det.subShapeNum]; + S32 end = start + mModel->getShape()->mSubShapeNumObjects[det.subShapeNum]; for ( S32 iObj = start; iObj < end; iObj++ ) { - const TSShape::Object& obj = mModel->getShape()->objects[iObj]; + const TSShape::Object& obj = mModel->getShape()->mObjects[iObj]; if ( obj.numMeshes <= currentDetail ) continue; - const TSMesh* mesh = mModel->getShape()->meshes[ obj.startMeshIndex + currentDetail ]; + const TSMesh* mesh = mModel->getShape()->mMeshes[ obj.startMeshIndex + currentDetail ]; if ( !mesh ) continue; @@ -1262,7 +1262,7 @@ void GuiShapeEdPreview::updateThreads(F32 delta) continue; // Make sure thread priority matches sequence priority (which may have changed) - mModel->setPriority( thread.key, mModel->getShape()->sequences[mModel->getSequence( thread.key )].priority ); + mModel->setPriority( thread.key, mModel->getShape()->mSequences[mModel->getSequence( thread.key )].priority ); // Handle ping-pong if ( thread.pingpong && !mModel->isInTransition( thread.key ) ) @@ -1426,18 +1426,18 @@ void GuiShapeEdPreview::renderWorld(const RectI &updateRect) // Render the shape bounding box if ( mRenderBounds ) { - Point3F boxSize = mModel->getShape()->bounds.maxExtents - mModel->getShape()->bounds.minExtents; + Point3F boxSize = mModel->getShape()->mBounds.maxExtents - mModel->getShape()->mBounds.minExtents; GFXStateBlockDesc desc; desc.fillMode = GFXFillWireframe; - GFX->getDrawUtil()->drawCube( desc, boxSize, mModel->getShape()->center, ColorF::WHITE ); + GFX->getDrawUtil()->drawCube( desc, boxSize, mModel->getShape()->mCenter, ColorF::WHITE ); } // Render the selected object bounding box if ( mRenderObjBox && ( mSelectedObject != -1 ) ) { - const TSShape::Object& obj = mModel->getShape()->objects[mSelectedObject]; - const TSMesh* mesh = ( mCurrentDL < obj.numMeshes ) ? mModel->getShape()->meshes[obj.startMeshIndex + mSelectedObjDetail] : NULL; + const TSShape::Object& obj = mModel->getShape()->mObjects[mSelectedObject]; + const TSMesh* mesh = ( mCurrentDL < obj.numMeshes ) ? mModel->getShape()->mMeshes[obj.startMeshIndex + mSelectedObjDetail] : NULL; if ( mesh ) { GFX->pushWorldMatrix(); @@ -1528,7 +1528,7 @@ void GuiShapeEdPreview::renderSunDirection() const { // Render four arrows aiming in the direction of the sun's light ColorI color( mFakeSun->getColor() ); - F32 length = mModel->getShape()->bounds.len() * 0.8f; + F32 length = mModel->getShape()->mBounds.len() * 0.8f; // Get the sun's vectors Point3F fwd = mFakeSun->getTransform().getForwardVector(); @@ -1536,8 +1536,8 @@ void GuiShapeEdPreview::renderSunDirection() const Point3F right = mFakeSun->getTransform().getRightVector() * length / 8; // Calculate the start and end points of the first arrow (bottom left) - Point3F start = mModel->getShape()->center - fwd * length - up/2 - right/2; - Point3F end = mModel->getShape()->center - fwd * length / 3 - up/2 - right/2; + Point3F start = mModel->getShape()->mCenter - fwd * length - up/2 - right/2; + Point3F end = mModel->getShape()->mCenter - fwd * length / 3 - up/2 - right/2; GFXStateBlockDesc desc; desc.setZReadWrite( true, true ); @@ -1560,10 +1560,10 @@ void GuiShapeEdPreview::renderNodes() const GFX->setStateBlockByDesc( desc ); PrimBuild::color( ColorI::WHITE ); - PrimBuild::begin( GFXLineList, mModel->getShape()->nodes.size() * 2 ); - for ( S32 i = 0; i < mModel->getShape()->nodes.size(); i++) + PrimBuild::begin( GFXLineList, mModel->getShape()->mNodes.size() * 2 ); + for ( S32 i = 0; i < mModel->getShape()->mNodes.size(); i++) { - const TSShape::Node& node = mModel->getShape()->nodes[i]; + const TSShape::Node& node = mModel->getShape()->mNodes[i]; if (node.parentIndex >= 0) { Point3F start(mModel->mNodeTransforms[i].getPosition()); @@ -1576,7 +1576,7 @@ void GuiShapeEdPreview::renderNodes() const PrimBuild::end(); // Render the node axes - for ( S32 i = 0; i < mModel->getShape()->nodes.size(); i++) + for ( S32 i = 0; i < mModel->getShape()->mNodes.size(); i++) { // Render the selected and hover nodes last (so they are on top) if ( ( i == mSelectedNode ) || ( i == mHoverNode ) ) @@ -1626,7 +1626,7 @@ void GuiShapeEdPreview::renderNodeAxes(S32 index, const ColorF& nodeColor) const void GuiShapeEdPreview::renderNodeName(S32 index, const ColorF& textColor) const { - const TSShape::Node& node = mModel->getShape()->nodes[index]; + const TSShape::Node& node = mModel->getShape()->mNodes[index]; const String& nodeName = mModel->getShape()->getName( node.nameIndex ); Point2I pos( mProjectedNodes[index].x, mProjectedNodes[index].y + sNodeRectSize + 6 ); @@ -1641,9 +1641,9 @@ void GuiShapeEdPreview::renderCollisionMeshes() const { ConcretePolyList polylist; polylist.setTransform( &MatrixF::Identity, Point3F::One ); - for ( S32 iDet = 0; iDet < mModel->getShape()->details.size(); iDet++ ) + for ( S32 iDet = 0; iDet < mModel->getShape()->mDetails.size(); iDet++ ) { - const TSShape::Detail& det = mModel->getShape()->details[iDet]; + const TSShape::Detail& det = mModel->getShape()->mDetails[iDet]; const String& detName = mModel->getShape()->getName( det.nameIndex ); // Ignore non-collision details diff --git a/Engine/source/lighting/common/blobShadow.cpp b/Engine/source/lighting/common/blobShadow.cpp index 0dfce8b15..9e72d97ec 100644 --- a/Engine/source/lighting/common/blobShadow.cpp +++ b/Engine/source/lighting/common/blobShadow.cpp @@ -95,8 +95,8 @@ bool BlobShadow::shouldRender(F32 camDist) if (mShapeBase && mShapeBase->getFadeVal() < TSMesh::VISIBILITY_EPSILON) return false; - F32 shadowLen = 10.0f * mShapeInstance->getShape()->radius; - Point3F pos = mShapeInstance->getShape()->center; + F32 shadowLen = 10.0f * mShapeInstance->getShape()->mRadius; + Point3F pos = mShapeInstance->getShape()->mCenter; // this is a bit of a hack...move generic shadows towards feet/base of shape pos *= 0.5f; @@ -182,7 +182,7 @@ void BlobShadow::setRadius(F32 radius) void BlobShadow::setRadius(TSShapeInstance * shapeInstance, const Point3F & scale) { - const Box3F & bounds = shapeInstance->getShape()->bounds; + const Box3F & bounds = shapeInstance->getShape()->mBounds; F32 dx = 0.5f * (bounds.maxExtents.x-bounds.minExtents.x) * scale.x; F32 dy = 0.5f * (bounds.maxExtents.y-bounds.minExtents.y) * scale.y; F32 dz = 0.5f * (bounds.maxExtents.z-bounds.minExtents.z) * scale.z; diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index 8461b5954..e58dd050e 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -359,24 +359,24 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) bounds.maxExtents += shapeOffset; // Now adjust all positions for root level nodes (nodes with no parent) - for (S32 iNode = 0; iNode < mShape->nodes.size(); iNode++) + for (S32 iNode = 0; iNode < mShape->mNodes.size(); iNode++) { if ( !mAppNodes[iNode]->isParentRoot() ) continue; // Adjust default translation - mShape->defaultTranslations[iNode] += shapeOffset; + mShape->mDefaultTranslations[iNode] += shapeOffset; // Adjust animated translations - for (S32 iSeq = 0; iSeq < mShape->sequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < mShape->mSequences.size(); iSeq++) { - const TSShape::Sequence& seq = mShape->sequences[iSeq]; + const TSShape::Sequence& seq = mShape->mSequences[iSeq]; if ( seq.translationMatters.test(iNode) ) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame; - mShape->nodeTranslations[index] += shapeOffset; + mShape->mNodeTranslations[index] += shapeOffset; } } } diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 542c23530..8831fbbd1 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -252,7 +252,7 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (appNode->isBounds()) return; - S32 subShapeNum = mShape->subShapeFirstNode.size()-1; + S32 subShapeNum = mShape->mSubShapeFirstNode.size()-1; Subshape* subshape = mSubShapes[subShapeNum]; // Check if we should collapse this node @@ -264,19 +264,19 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu else { // Check that adding this node will not exceed the maximum node count - if (mShape->nodes.size() >= MAX_TS_SET_SIZE) + if (mShape->mNodes.size() >= MAX_TS_SET_SIZE) return; - myIndex = mShape->nodes.size(); - String nodeName = getUniqueName(appNode->getName(), cmpShapeName, mShape->names); + myIndex = mShape->mNodes.size(); + String nodeName = getUniqueName(appNode->getName(), cmpShapeName, mShape->mNames); // Create the 3space node - mShape->nodes.increment(); - mShape->nodes.last().nameIndex = mShape->addName(nodeName); - mShape->nodes.last().parentIndex = parentIndex; - mShape->nodes.last().firstObject = -1; - mShape->nodes.last().firstChild = -1; - mShape->nodes.last().nextSibling = -1; + mShape->mNodes.increment(); + mShape->mNodes.last().nameIndex = mShape->addName(nodeName); + mShape->mNodes.last().parentIndex = parentIndex; + mShape->mNodes.last().firstObject = -1; + mShape->mNodes.last().firstChild = -1; + mShape->mNodes.last().nextSibling = -1; // Add the AppNode to a matching list (so AppNodes can be accessed using 3space // node indices) @@ -312,12 +312,12 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu appNode->getBool("BB::INCLUDE_POLES", includePoles); S32 detIndex = mShape->addDetail( "bbDetail", size, -1 ); - mShape->details[detIndex].bbEquatorSteps = numEquatorSteps; - mShape->details[detIndex].bbPolarSteps = numPolarSteps; - mShape->details[detIndex].bbDetailLevel = dl; - mShape->details[detIndex].bbDimension = dim; - mShape->details[detIndex].bbIncludePoles = includePoles; - mShape->details[detIndex].bbPolarAngle = polarAngle; + mShape->mDetails[detIndex].bbEquatorSteps = numEquatorSteps; + mShape->mDetails[detIndex].bbPolarSteps = numPolarSteps; + mShape->mDetails[detIndex].bbDetailLevel = dl; + mShape->mDetails[detIndex].bbDimension = dim; + mShape->mDetails[detIndex].bbIncludePoles = includePoles; + mShape->mDetails[detIndex].bbPolarAngle = polarAngle; } } } @@ -351,15 +351,15 @@ void TSShapeLoader::generateSubshapes() // Recurse through the node hierarchy, adding 3space nodes and // collecting geometry - S32 firstNode = mShape->nodes.size(); - mShape->subShapeFirstNode.push_back(firstNode); + S32 firstNode = mShape->mNodes.size(); + mShape->mSubShapeFirstNode.push_back(firstNode); for (U32 iBranch = 0; iBranch < subshape->branches.size(); iBranch++) recurseSubshape(subshape->branches[iBranch], -1, true); - mShape->subShapeNumNodes.push_back(mShape->nodes.size() - firstNode); + mShape->mSubShapeNumNodes.push_back(mShape->mNodes.size() - firstNode); - if (mShape->nodes.size() >= MAX_TS_SET_SIZE) + if (mShape->mNodes.size() >= MAX_TS_SET_SIZE) { Con::warnf("Shape exceeds the maximum node count (%d). Ignoring additional nodes.", MAX_TS_SET_SIZE); @@ -389,7 +389,7 @@ void TSShapeLoader::generateObjects() for (S32 iSub = 0; iSub < mSubShapes.size(); iSub++) { Subshape* subshape = mSubShapes[iSub]; - mShape->subShapeFirstObject.push_back(mShape->objects.size()); + mShape->mSubShapeFirstObject.push_back(mShape->mObjects.size()); // Get the names and sizes of the meshes for this subshape Vector meshNames; @@ -450,17 +450,17 @@ void TSShapeLoader::generateObjects() if (!lastName || (meshNames[iMesh] != *lastName)) { - mShape->objects.increment(); - mShape->objects.last().nameIndex = mShape->addName(meshNames[iMesh]); - mShape->objects.last().nodeIndex = subshape->objNodes[iMesh]; - mShape->objects.last().startMeshIndex = mAppMeshes.size(); - mShape->objects.last().numMeshes = 0; + mShape->mObjects.increment(); + mShape->mObjects.last().nameIndex = mShape->addName(meshNames[iMesh]); + mShape->mObjects.last().nodeIndex = subshape->objNodes[iMesh]; + mShape->mObjects.last().startMeshIndex = mAppMeshes.size(); + mShape->mObjects.last().numMeshes = 0; lastName = &meshNames[iMesh]; } // Add this mesh to the object mAppMeshes.push_back(mesh); - mShape->objects.last().numMeshes++; + mShape->mObjects.last().numMeshes++; // Set mesh flags mesh->mFlags = 0; @@ -483,9 +483,9 @@ void TSShapeLoader::generateObjects() } // Attempt to add the detail (will fail if it already exists) - S32 oldNumDetails = mShape->details.size(); + S32 oldNumDetails = mShape->mDetails.size(); mShape->addDetail(detailName, mesh->mDetailSize, iSub); - if (mShape->details.size() > oldNumDetails) + if (mShape->mDetails.size() > oldNumDetails) { Con::warnf("Object mesh \"%s\" has no matching detail (\"%s%d\" has" " been added automatically)", mesh->getName(false), detailName, mesh->mDetailSize); @@ -493,18 +493,18 @@ void TSShapeLoader::generateObjects() } // Get object count for this subshape - mShape->subShapeNumObjects.push_back(mShape->objects.size() - mShape->subShapeFirstObject.last()); + mShape->mSubShapeNumObjects.push_back(mShape->mObjects.size() - mShape->mSubShapeFirstObject.last()); } } void TSShapeLoader::generateSkins() { Vector skins; - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->mObjects.size(); iObject++) { - for (S32 iMesh = 0; iMesh < mShape->objects[iObject].numMeshes; iMesh++) + for (S32 iMesh = 0; iMesh < mShape->mObjects[iObject].numMeshes; iMesh++) { - AppMesh* mesh = mAppMeshes[mShape->objects[iObject].startMeshIndex + iMesh]; + AppMesh* mesh = mAppMeshes[mShape->mObjects[iObject].startMeshIndex + iMesh]; if (mesh->isSkin()) skins.push_back(mesh); } @@ -551,12 +551,12 @@ void TSShapeLoader::generateSkins() void TSShapeLoader::generateDefaultStates() { // Generate default object states (includes initial geometry) - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->mObjects.size(); iObject++) { updateProgress(Load_GenerateDefaultStates, "Generating initial mesh and node states...", - mShape->objects.size(), iObject); + mShape->mObjects.size(), iObject); - TSShape::Object& obj = mShape->objects[iObject]; + TSShape::Object& obj = mShape->mObjects[iObject]; // Calculate the objectOffset for each mesh at T=0 for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) @@ -572,7 +572,7 @@ void TSShapeLoader::generateDefaultStates() appMesh->mObjectOffset = nodeMat.inverse() * meshMat; } - generateObjectState(mShape->objects[iObject], smDefaultTime, true, true); + generateObjectState(mShape->mObjects[iObject], smDefaultTime, true, true); } // Generate default node transforms @@ -591,8 +591,8 @@ void TSShapeLoader::generateDefaultStates() void TSShapeLoader::generateObjectState(TSShape::Object& obj, F32 t, bool addFrame, bool addMatFrame) { - mShape->objectStates.increment(); - TSShape::ObjectState& state = mShape->objectStates.last(); + mShape->mObjectStates.increment(); + TSShape::ObjectState& state = mShape->mObjectStates.last(); state.frameIndex = 0; state.matFrameIndex = 0; @@ -689,13 +689,13 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo void TSShapeLoader::generateMaterialList() { // Install the materials into the material list - mShape->materialList = new TSMaterialList; + mShape->mMaterialList = new TSMaterialList; for (S32 iMat = 0; iMat < AppMesh::mAppMaterials.size(); iMat++) { updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::mAppMaterials.size(), iMat); AppMaterial* appMat = AppMesh::mAppMaterials[iMat]; - mShape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); + mShape->mMaterialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); } } @@ -712,8 +712,8 @@ void TSShapeLoader::generateSequences() // Initialize the sequence mAppSequences[iSeq]->setActive(true); - mShape->sequences.increment(); - TSShape::Sequence& seq = mShape->sequences.last(); + mShape->mSequences.increment(); + TSShape::Sequence& seq = mShape->mSequences.last(); seq.nameIndex = mShape->addName(mAppSequences[iSeq]->getName()); seq.toolBegin = mAppSequences[iSeq]->getStart(); @@ -788,7 +788,7 @@ void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) // Check if any of the node rotations are different to // the default rotation QuatF defaultRot; - mShape->defaultRotations[iNode].getQuatF(&defaultRot); + mShape->mDefaultRotations[iNode].getQuatF(&defaultRot); for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { @@ -807,7 +807,7 @@ void TSShapeLoader::setTranslationMembership(TSShape::Sequence& seq) { // Check if any of the node translations are different to // the default translation - Point3F& defaultTrans = mShape->defaultTranslations[iNode]; + Point3F& defaultTrans = mShape->mDefaultTranslations[iNode]; for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { @@ -865,12 +865,12 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc seq.frameMatters.clearAll(); // vert animation (morph) (size = objects.size()) seq.matFrameMatters.clearAll(); // UV animation (size = objects.size()) - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->mObjects.size(); iObject++) { - if (!mAppMeshes[mShape->objects[iObject].startMeshIndex]) + if (!mAppMeshes[mShape->mObjects[iObject].startMeshIndex]) continue; - if (mAppMeshes[mShape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) + if (mAppMeshes[mShape->mObjects[iObject].startMeshIndex]->animatesVis(appSeq)) seq.visMatters.set(iObject); // Morph and UV animation has been deprecated //if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesFrame(appSeq)) @@ -934,44 +934,44 @@ void TSShapeLoader::addNodeRotation(QuatF& rot, bool defaultVal) rot16.set(rot); if (!defaultVal) - mShape->nodeRotations.push_back(rot16); + mShape->mNodeRotations.push_back(rot16); else - mShape->defaultRotations.push_back(rot16); + mShape->mDefaultRotations.push_back(rot16); } void TSShapeLoader::addNodeTranslation(Point3F& trans, bool defaultVal) { if (!defaultVal) - mShape->nodeTranslations.push_back(trans); + mShape->mNodeTranslations.push_back(trans); else - mShape->defaultTranslations.push_back(trans); + mShape->mDefaultTranslations.push_back(trans); } void TSShapeLoader::addNodeUniformScale(F32 scale) { - mShape->nodeUniformScales.push_back(scale); + mShape->mNodeUniformScales.push_back(scale); } void TSShapeLoader::addNodeAlignedScale(Point3F& scale) { - mShape->nodeAlignedScales.push_back(scale); + mShape->mNodeAlignedScales.push_back(scale); } void TSShapeLoader::addNodeArbitraryScale(QuatF& qrot, Point3F& scale) { Quat16 rot16; rot16.set(qrot); - mShape->nodeArbitraryScaleRots.push_back(rot16); - mShape->nodeArbitraryScaleFactors.push_back(scale); + mShape->mNodeArbitraryScaleRots.push_back(rot16); + mShape->mNodeArbitraryScaleFactors.push_back(scale); } void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) { - seq.baseRotation = mShape->nodeRotations.size(); - seq.baseTranslation = mShape->nodeTranslations.size(); - seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? mShape->nodeArbitraryScaleRots.size() : - (seq.flags & TSShape::AlignedScale) ? mShape->nodeAlignedScales.size() : - mShape->nodeUniformScales.size(); + seq.baseRotation = mShape->mNodeRotations.size(); + seq.baseTranslation = mShape->mNodeTranslations.size(); + seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? mShape->mNodeArbitraryScaleRots.size() : + (seq.flags & TSShape::AlignedScale) ? mShape->mNodeAlignedScales.size() : + mShape->mNodeUniformScales.size(); for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { @@ -999,9 +999,9 @@ void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.baseObjectState = mShape->objectStates.size(); + seq.baseObjectState = mShape->mObjectStates.size(); - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->mObjects.size(); iObject++) { bool visMatters = seq.visMatters.test(iObject); bool frameMatters = seq.frameMatters.test(iObject); @@ -1012,7 +1012,7 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - generateObjectState(mShape->objects[iObject], time, frameMatters, matFrameMatters); + generateObjectState(mShape->mObjects[iObject], time, frameMatters, matFrameMatters); } } } @@ -1020,7 +1020,7 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.firstGroundFrame = mShape->groundTranslations.size(); + seq.firstGroundFrame = mShape->mGroundTranslations.size(); seq.numGroundFrames = 0; if (!mBoundsNode) @@ -1048,15 +1048,15 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq // Add ground transform Quat16 rotation; rotation.set(QuatF(mat)); - mShape->groundTranslations.push_back(mat.getPosition()); - mShape->groundRotations.push_back(rotation); + mShape->mGroundTranslations.push_back(mat.getPosition()); + mShape->mGroundRotations.push_back(rotation); } } void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSequence* appSeq) { // Initialize triggers - seq.firstTrigger = mShape->triggers.size(); + seq.firstTrigger = mShape->mTriggers.size(); seq.numTriggers = appSeq->getNumTriggers(); if (!seq.numTriggers) return; @@ -1066,8 +1066,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // Add triggers for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - mShape->triggers.increment(); - appSeq->getTrigger(iTrigger, mShape->triggers.last()); + mShape->mTriggers.increment(); + appSeq->getTrigger(iTrigger, mShape->mTriggers.last()); } // Track the triggers that get turned off by this shape...normally, triggers @@ -1077,7 +1077,7 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque U32 offTriggers = 0; for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - U32 state = mShape->triggers[seq.firstTrigger+iTrigger].state; + U32 state = mShape->mTriggers[seq.firstTrigger+iTrigger].state; if ((state & TSShape::Trigger::StateOn) == 0) offTriggers |= (state & TSShape::Trigger::StateMask); } @@ -1085,8 +1085,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // We now know which states are turned off, set invert on all those (including when turned on) for (int iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - if (mShape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) - mShape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; + if (mShape->mTriggers[seq.firstTrigger + iTrigger].state & offTriggers) + mShape->mTriggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; } } @@ -1105,29 +1105,29 @@ void TSShapeLoader::sortDetails() for (S32 iDet = 0; iDet < validDetails.size(); iDet++) { - TSShape::Detail &detail = mShape->details[validDetails[iDet]]; + TSShape::Detail &detail = mShape->mDetails[validDetails[iDet]]; if (detail.subShapeNum >= 0) detail.objectDetailNum = iDet; - for (S32 iObj = mShape->subShapeFirstObject[iSub]; - iObj < (mShape->subShapeFirstObject[iSub] + mShape->subShapeNumObjects[iSub]); + for (S32 iObj = mShape->mSubShapeFirstObject[iSub]; + iObj < (mShape->mSubShapeFirstObject[iSub] + mShape->mSubShapeNumObjects[iSub]); iObj++) { - TSShape::Object &object = mShape->objects[iObj]; + TSShape::Object &object = mShape->mObjects[iObj]; // Insert a NULL mesh for this detail level if required (ie. if the // object does not already have a mesh with an equal or higher detail) S32 meshIndex = (iDet < object.numMeshes) ? iDet : object.numMeshes-1; - if (mAppMeshes[object.startMeshIndex + meshIndex]->mDetailSize < mShape->details[iDet].size) + if (mAppMeshes[object.startMeshIndex + meshIndex]->mDetailSize < mShape->mDetails[iDet].size) { // Add a NULL mesh mAppMeshes.insert(object.startMeshIndex + iDet, NULL); object.numMeshes++; // Fixup the start index for the other objects - for (S32 k = iObj+1; k < mShape->objects.size(); k++) - mShape->objects[k].startMeshIndex++; + for (S32 k = iObj+1; k < mShape->mObjects.size(); k++) + mShape->mObjects[k].startMeshIndex++; } } } @@ -1142,20 +1142,20 @@ void TSShapeLoader::install() { // Arrays that are filled in by ts shape init, but need // to be allocated beforehand. - mShape->subShapeFirstTranslucentObject.setSize(mShape->subShapeFirstObject.size()); + mShape->mSubShapeFirstTranslucentObject.setSize(mShape->mSubShapeFirstObject.size()); // Construct TS sub-meshes - mShape->meshes.setSize(mAppMeshes.size()); + mShape->mMeshes.setSize(mAppMeshes.size()); for (U32 m = 0; m < mAppMeshes.size(); m++) - mShape->meshes[m] = mAppMeshes[m] ? mAppMeshes[m]->constructTSMesh() : NULL; + mShape->mMeshes[m] = mAppMeshes[m] ? mAppMeshes[m]->constructTSMesh() : NULL; // Remove empty meshes and objects - for (S32 iObj = mShape->objects.size()-1; iObj >= 0; iObj--) + for (S32 iObj = mShape->mObjects.size()-1; iObj >= 0; iObj--) { - TSShape::Object& obj = mShape->objects[iObj]; + TSShape::Object& obj = mShape->mObjects[iObj]; for (S32 iMesh = obj.numMeshes-1; iMesh >= 0; iMesh--) { - TSMesh *mesh = mShape->meshes[obj.startMeshIndex + iMesh]; + TSMesh *mesh = mShape->mMeshes[obj.startMeshIndex + iMesh]; if (mesh && !mesh->mPrimitives.size()) { @@ -1171,45 +1171,45 @@ void TSShapeLoader::install() } // Add a dummy object if needed so the shape loads and renders ok - if (!mShape->details.size()) + if (!mShape->mDetails.size()) { mShape->addDetail("detail", 2, 0); - mShape->subShapeNumObjects.last() = 1; + mShape->mSubShapeNumObjects.last() = 1; - mShape->meshes.push_back(NULL); + mShape->mMeshes.push_back(NULL); - mShape->objects.increment(); - mShape->objects.last().nameIndex = mShape->addName("dummy"); - mShape->objects.last().nodeIndex = 0; - mShape->objects.last().startMeshIndex = 0; - mShape->objects.last().numMeshes = 1; + mShape->mObjects.increment(); + mShape->mObjects.last().nameIndex = mShape->addName("dummy"); + mShape->mObjects.last().nodeIndex = 0; + mShape->mObjects.last().startMeshIndex = 0; + mShape->mObjects.last().numMeshes = 1; - mShape->objectStates.increment(); - mShape->objectStates.last().frameIndex = 0; - mShape->objectStates.last().matFrameIndex = 0; - mShape->objectStates.last().vis = 1.0f; + mShape->mObjectStates.increment(); + mShape->mObjectStates.last().frameIndex = 0; + mShape->mObjectStates.last().matFrameIndex = 0; + mShape->mObjectStates.last().vis = 1.0f; } // Update smallest visible detail mShape->mSmallestVisibleDL = -1; mShape->mSmallestVisibleSize = 999999; - for (S32 i = 0; i < mShape->details.size(); i++) + for (S32 i = 0; i < mShape->mDetails.size(); i++) { - if ((mShape->details[i].size >= 0) && - (mShape->details[i].size < mShape->mSmallestVisibleSize)) + if ((mShape->mDetails[i].size >= 0) && + (mShape->mDetails[i].size < mShape->mSmallestVisibleSize)) { mShape->mSmallestVisibleDL = i; - mShape->mSmallestVisibleSize = mShape->details[i].size; + mShape->mSmallestVisibleSize = mShape->mDetails[i].size; } } - computeBounds(mShape->bounds); - if (!mShape->bounds.isValidBox()) - mShape->bounds = Box3F(1.0f); + computeBounds(mShape->mBounds); + if (!mShape->mBounds.isValidBox()) + mShape->mBounds = Box3F(1.0f); - mShape->bounds.getCenter(&mShape->center); - mShape->radius = (mShape->bounds.maxExtents - mShape->center).len(); - mShape->tubeRadius = mShape->radius; + mShape->mBounds.getCenter(&mShape->mCenter); + mShape->mRadius = (mShape->mBounds.maxExtents - mShape->mCenter).len(); + mShape->mTubeRadius = mShape->mRadius; mShape->init(); } diff --git a/Engine/source/ts/tsAnimate.cpp b/Engine/source/ts/tsAnimate.cpp index 8c80fea18..4d1a51a03 100644 --- a/Engine/source/ts/tsAnimate.cpp +++ b/Engine/source/ts/tsAnimate.cpp @@ -43,14 +43,14 @@ void TSShapeInstance::sortThreads() void TSShapeInstance::setDirty(U32 dirty) { AssertFatal((dirty & AllDirtyMask) == dirty,"TSShapeInstance::setDirty: illegal dirty flags"); - for (S32 i=0; isubShapeFirstNode.size(); i++) + for (S32 i=0; imSubShapeFirstNode.size(); i++) mDirtyFlags[i] |= dirty; } void TSShapeInstance::clearDirty(U32 dirty) { AssertFatal((dirty & AllDirtyMask) == dirty,"TSShapeInstance::clearDirty: illegal dirty flags"); - for (S32 i=0; isubShapeFirstNode.size(); i++) + for (S32 i=0; imSubShapeFirstNode.size(); i++) mDirtyFlags[i] &= ~dirty; } @@ -62,25 +62,25 @@ void TSShapeInstance::animateNodes(S32 ss) { PROFILE_SCOPE( TSShapeInstance_animateNodes ); - if (!mShape->nodes.size()) + if (!mShape->mNodes.size()) return; // @todo: When a node is added, we need to make sure to resize the nodeTransforms array as well - mNodeTransforms.setSize(mShape->nodes.size()); + mNodeTransforms.setSize(mShape->mNodes.size()); // temporary storage for node transforms - smNodeCurrentRotations.setSize(mShape->nodes.size()); - smNodeCurrentTranslations.setSize(mShape->nodes.size()); - smNodeLocalTransforms.setSize(mShape->nodes.size()); - smRotationThreads.setSize(mShape->nodes.size()); - smTranslationThreads.setSize(mShape->nodes.size()); + smNodeCurrentRotations.setSize(mShape->mNodes.size()); + smNodeCurrentTranslations.setSize(mShape->mNodes.size()); + smNodeLocalTransforms.setSize(mShape->mNodes.size()); + smRotationThreads.setSize(mShape->mNodes.size()); + smTranslationThreads.setSize(mShape->mNodes.size()); TSIntegerSet rotBeenSet; TSIntegerSet tranBeenSet; TSIntegerSet scaleBeenSet; - rotBeenSet.setAll(mShape->nodes.size()); - tranBeenSet.setAll(mShape->nodes.size()); - scaleBeenSet.setAll(mShape->nodes.size()); + rotBeenSet.setAll(mShape->mNodes.size()); + tranBeenSet.setAll(mShape->mNodes.size()); + scaleBeenSet.setAll(mShape->mNodes.size()); smNodeLocalTransformDirty.clearAll(); S32 i,j,nodeIndex,a,b,start,end,firstBlend = mThreadList.size(); @@ -114,18 +114,18 @@ void TSShapeInstance::animateNodes(S32 ss) // we'll set default regardless of mask status // all the nodes marked above need to have the default transform - a = mShape->subShapeFirstNode[ss]; - b = a + mShape->subShapeNumNodes[ss]; + a = mShape->mSubShapeFirstNode[ss]; + b = a + mShape->mSubShapeNumNodes[ss]; for (i=a; idefaultRotations[i].getQuatF(&smNodeCurrentRotations[i]); + mShape->mDefaultRotations[i].getQuatF(&smNodeCurrentRotations[i]); smRotationThreads[i] = NULL; } if (tranBeenSet.test(i)) { - smNodeCurrentTranslations[i] = mShape->defaultTranslations[i]; + smNodeCurrentTranslations[i] = mShape->mDefaultTranslations[i]; smTranslationThreads[i] = NULL; } } @@ -235,7 +235,7 @@ void TSShapeInstance::animateNodes(S32 ss) // multiply transforms... for (i=a; inodes[i].parentIndex; + S32 parentIdx = mShape->mNodes[i].parentIndex; if (parentIdx < 0) mNodeTransforms[i] = smNodeLocalTransforms[i]; else @@ -248,12 +248,12 @@ void TSShapeInstance::handleDefaultScale(S32 a, S32 b, TSIntegerSet & scaleBeenS // set default scale values (i.e., identity) and do any initialization // relating to animated scale (since scale normally not animated) - smScaleThreads.setSize(mShape->nodes.size()); + smScaleThreads.setSize(mShape->mNodes.size()); scaleBeenSet.takeAway(mCallbackNodes); scaleBeenSet.takeAway(mHandsOffNodes); if (animatesUniformScale()) { - smNodeCurrentUniformScales.setSize(mShape->nodes.size()); + smNodeCurrentUniformScales.setSize(mShape->mNodes.size()); for (S32 i=a; inodes.size()); + smNodeCurrentAlignedScales.setSize(mShape->mNodes.size()); for (S32 i=a; inodes.size()); + smNodeCurrentArbitraryScales.setSize(mShape->mNodes.size()); for (S32 i=a; igetSequence()->visMatters); // set defaults - S32 a = mShape->subShapeFirstObject[ss]; - S32 b = a + mShape->subShapeNumObjects[ss]; + S32 a = mShape->mSubShapeFirstObject[ss]; + S32 b = a + mShape->mSubShapeNumObjects[ss]; for (i=a; iobjectStates[i].vis; + mMeshObjects[i].visible = mShape->mObjectStates[i].vis; } // go through each thread and set visibility on those objects that @@ -735,11 +735,11 @@ void TSShapeInstance::animateFrame(S32 ss) beenSet.takeAway(mThreadList[i]->getSequence()->frameMatters); // set defaults - S32 a = mShape->subShapeFirstObject[ss]; - S32 b = a + mShape->subShapeNumObjects[ss]; + S32 a = mShape->mSubShapeFirstObject[ss]; + S32 b = a + mShape->mSubShapeNumObjects[ss]; for (i=a; iobjectStates[i].frameIndex; + mMeshObjects[i].frame = mShape->mObjectStates[i].frameIndex; // go through each thread and set frame on those objects that // are not set yet and are controlled by that thread @@ -790,11 +790,11 @@ void TSShapeInstance::animateMatFrame(S32 ss) beenSet.takeAway(mThreadList[i]->getSequence()->matFrameMatters); // set defaults - S32 a = mShape->subShapeFirstObject[ss]; - S32 b = a + mShape->subShapeNumObjects[ss]; + S32 a = mShape->mSubShapeFirstObject[ss]; + S32 b = a + mShape->mSubShapeNumObjects[ss]; for (i=a; iobjectStates[i].matFrameIndex; + mMeshObjects[i].matFrame = mShape->mObjectStates[i].matFrameIndex; // go through each thread and set matFrame on those objects that // are not set yet and are controlled by that thread @@ -842,7 +842,7 @@ void TSShapeInstance::animate(S32 dl) // nothing to do return; - S32 ss = mShape->details[dl].subShapeNum; + S32 ss = mShape->mDetails[dl].subShapeNum; // this is a billboard detail... if (ss<0) @@ -878,7 +878,7 @@ void TSShapeInstance::animateNodeSubtrees(bool forceFull) // force transforms to animate setDirty(TransformDirty); - for (S32 i=0; isubShapeNumNodes.size(); i++) + for (S32 i=0; imSubShapeNumNodes.size(); i++) { if (mDirtyFlags[i] & TransformDirty) { @@ -896,7 +896,7 @@ void TSShapeInstance::animateSubtrees(bool forceFull) // force full animate setDirty(AllDirtyMask); - for (S32 i=0; isubShapeNumNodes.size(); i++) + for (S32 i=0; imSubShapeNumNodes.size(); i++) { if (mDirtyFlags[i] & TransformDirty) { diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 47cf594ed..fd3b17b06 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -52,10 +52,10 @@ bool TSShapeInstance::buildPolyList(AbstractPolyList * polyList, S32 dl) if (dl==-1) return false; - AssertFatal(dl>=0 && dldetails.size(),"TSShapeInstance::buildPolyList"); + AssertFatal(dl>=0 && dlmDetails.size(),"TSShapeInstance::buildPolyList"); // get subshape and object detail - const TSDetail * detail = &mShape->details[dl]; + const TSDetail * detail = &mShape->mDetails[dl]; S32 ss = detail->subShapeNum; S32 od = detail->objectDetailNum; @@ -67,8 +67,8 @@ bool TSShapeInstance::buildPolyList(AbstractPolyList * polyList, S32 dl) bool emitted = false; U32 surfaceKey = 0; - S32 start = mShape->subShapeFirstObject[ss]; - S32 end = mShape->subShapeNumObjects[ss] + start; + S32 start = mShape->mSubShapeFirstObject[ss]; + S32 end = mShape->mSubShapeNumObjects[ss] + start; if (start=0 && dldetails.size(),"TSShapeInstance::buildPolyList"); + AssertFatal(dl>=0 && dlmDetails.size(),"TSShapeInstance::buildPolyList"); // get subshape and object detail - const TSDetail * detail = &mShape->details[dl]; + const TSDetail * detail = &mShape->mDetails[dl]; S32 ss = detail->subShapeNum; S32 od = detail->objectDetailNum; @@ -135,8 +135,8 @@ bool TSShapeInstance::getFeatures(const MatrixF& mat, const Point3F& n, ConvexFe bool emitted = false; U32 surfaceKey = 0; - S32 start = mShape->subShapeFirstObject[ss]; - S32 end = mShape->subShapeNumObjects[ss] + start; + S32 start = mShape->mSubShapeFirstObject[ss]; + S32 end = mShape->mSubShapeNumObjects[ss] + start; if (start=0 && dldetails.size(),"TSShapeInstance::castRay"); + AssertFatal(dl>=0 && dlmDetails.size(),"TSShapeInstance::castRay"); // get subshape and object detail - const TSDetail * detail = &mShape->details[dl]; + const TSDetail * detail = &mShape->mDetails[dl]; S32 ss = detail->subShapeNum; S32 od = detail->objectDetailNum; @@ -179,8 +179,8 @@ bool TSShapeInstance::castRay(const Point3F & a, const Point3F & b, RayInfo * ra if ( ss < 0 ) return false; - S32 start = mShape->subShapeFirstObject[ss]; - S32 end = mShape->subShapeNumObjects[ss] + start; + S32 start = mShape->mSubShapeFirstObject[ss]; + S32 end = mShape->mSubShapeNumObjects[ss] + start; RayInfo saveRay; saveRay.t = 1.0f; const MatrixF * saveMat = NULL; @@ -255,18 +255,18 @@ bool TSShapeInstance::castRayRendered(const Point3F & a, const Point3F & b, RayI if (dl==-1) return false; - AssertFatal(dl>=0 && dldetails.size(),"TSShapeInstance::castRayRendered"); + AssertFatal(dl>=0 && dlmDetails.size(),"TSShapeInstance::castRayRendered"); // get subshape and object detail - const TSDetail * detail = &mShape->details[dl]; + const TSDetail * detail = &mShape->mDetails[dl]; S32 ss = detail->subShapeNum; S32 od = detail->objectDetailNum; if ( ss == -1 ) return false; - S32 start = mShape->subShapeFirstObject[ss]; - S32 end = mShape->subShapeNumObjects[ss] + start; + S32 start = mShape->mSubShapeFirstObject[ss]; + S32 end = mShape->mSubShapeNumObjects[ss] + start; RayInfo saveRay; saveRay.t = 1.0f; const MatrixF * saveMat = NULL; @@ -339,15 +339,15 @@ Point3F TSShapeInstance::support(const Point3F & v, S32 dl) { // if dl==-1, nothing to do AssertFatal(dl != -1, "Error, should never try to collide with a non-existant detail level!"); - AssertFatal(dl>=0 && dldetails.size(),"TSShapeInstance::support"); + AssertFatal(dl>=0 && dlmDetails.size(),"TSShapeInstance::support"); // get subshape and object detail - const TSDetail * detail = &mShape->details[dl]; + const TSDetail * detail = &mShape->mDetails[dl]; S32 ss = detail->subShapeNum; S32 od = detail->objectDetailNum; - S32 start = mShape->subShapeFirstObject[ss]; - S32 end = mShape->subShapeNumObjects[ss] + start; + S32 start = mShape->mSubShapeFirstObject[ss]; + S32 end = mShape->mSubShapeNumObjects[ss] + start; F32 currMaxDP = -1e9f; Point3F currSupport = Point3F(0, 0, 0); @@ -404,22 +404,22 @@ void TSShapeInstance::computeBounds(S32 dl, Box3F & bounds) if (dl==-1) return; - AssertFatal(dl>=0 && dldetails.size(),"TSShapeInstance::computeBounds"); + AssertFatal(dl>=0 && dlmDetails.size(),"TSShapeInstance::computeBounds"); // get subshape and object detail - const TSDetail * detail = &mShape->details[dl]; + const TSDetail * detail = &mShape->mDetails[dl]; S32 ss = detail->subShapeNum; S32 od = detail->objectDetailNum; // use shape bounds for imposter details if (ss < 0) { - bounds = mShape->bounds; + bounds = mShape->mBounds; return; } - S32 start = mShape->subShapeFirstObject[ss]; - S32 end = mShape->subShapeNumObjects[ss] + start; + S32 start = mShape->mSubShapeFirstObject[ss]; + S32 end = mShape->mSubShapeNumObjects[ss] + start; // run through objects and updating bounds as we go bounds.minExtents.set( 10E30f, 10E30f, 10E30f); @@ -587,10 +587,10 @@ bool TSShapeInstance::buildPolyListOpcode( S32 dl, AbstractPolyList *polyList, c if (dl==-1) return false; - AssertFatal(dl>=0 && dldetails.size(),"TSShapeInstance::buildPolyListOpcode"); + AssertFatal(dl>=0 && dlmDetails.size(),"TSShapeInstance::buildPolyListOpcode"); // get subshape and object detail - const TSDetail * detail = &mShape->details[dl]; + const TSDetail * detail = &mShape->mDetails[dl]; S32 ss = detail->subShapeNum; if ( ss < 0 ) return false; @@ -600,8 +600,8 @@ bool TSShapeInstance::buildPolyListOpcode( S32 dl, AbstractPolyList *polyList, c // nothing emitted yet... bool emitted = false; - S32 start = mShape->subShapeFirstObject[ss]; - S32 end = mShape->subShapeNumObjects[ss] + start; + S32 start = mShape->mSubShapeFirstObject[ss]; + S32 end = mShape->mSubShapeNumObjects[ss] + start; if (start=0 && dldetails.size(),"TSShapeInstance::castRayOpcode"); + AssertFatal(dl>=0 && dlmDetails.size(),"TSShapeInstance::castRayOpcode"); info->t = 100.f; // get subshape and object detail - const TSDetail * detail = &mShape->details[dl]; + const TSDetail * detail = &mShape->mDetails[dl]; S32 ss = detail->subShapeNum; if ( ss < 0 ) return false; @@ -686,8 +686,8 @@ bool TSShapeInstance::castRayOpcode( S32 dl, const Point3F & startPos, const Poi bool emitted = false; const MatrixF* saveMat = NULL; - S32 start = mShape->subShapeFirstObject[ss]; - S32 end = mShape->subShapeNumObjects[ss] + start; + S32 start = mShape->mSubShapeFirstObject[ss]; + S32 end = mShape->mSubShapeNumObjects[ss] + start; if (start=0 && dldetails.size(),"TSShapeInstance::buildConvexOpcode"); + AssertFatal(dl>=0 && dlmDetails.size(),"TSShapeInstance::buildConvexOpcode"); // get subshape and object detail - const TSDetail * detail = &mShape->details[dl]; + const TSDetail * detail = &mShape->mDetails[dl]; S32 ss = detail->subShapeNum; S32 od = detail->objectDetailNum; // nothing emitted yet... bool emitted = false; - S32 start = mShape->subShapeFirstObject[ss]; - S32 end = mShape->subShapeNumObjects[ss] + start; + S32 start = mShape->mSubShapeFirstObject[ss]; + S32 end = mShape->mSubShapeNumObjects[ss] + start; if (start *outDetails, Vect U32 highestDetail = -1; F32 highestSize = -F32_MAX; - for ( U32 i = 0; i < details.size(); i++ ) + for ( U32 i = 0; i < mDetails.size(); i++ ) { // Make sure we skip any details that shouldn't be rendered - if ( details[i].size < 0 ) + if ( mDetails[i].size < 0 ) continue; /* @@ -838,10 +838,10 @@ void TSShape::findColDetails( bool useVisibleMesh, Vector *outDetails, Vect */ // Otherwise test against the current highest size - if ( details[i].size > highestSize ) + if ( mDetails[i].size > highestSize ) { highestDetail = i; - highestSize = details[i].size; + highestSize = mDetails[i].size; } } @@ -861,9 +861,9 @@ void TSShape::findColDetails( bool useVisibleMesh, Vector *outDetails, Vect // // The LOS (light of sight) details are used for raycasts. - for ( U32 i = 0; i < details.size(); i++ ) + for ( U32 i = 0; i < mDetails.size(); i++ ) { - const String &name = names[ details[i].nameIndex ]; + const String &name = mNames[ mDetails[i].nameIndex ]; if ( !dStrStartsWith( name, "Collision" ) ) continue; @@ -906,9 +906,9 @@ void TSShape::findColDetails( bool useVisibleMesh, Vector *outDetails, Vect // Snag any "unmatched" LOS details and put // them at the end of the list. - for ( U32 i = 0; i < details.size(); i++ ) + for ( U32 i = 0; i < mDetails.size(); i++ ) { - const String &name = names[ details[i].nameIndex ]; + const String &name = mNames[ mDetails[i].nameIndex ]; if ( !dStrStartsWith( name, "LOS" ) ) continue; @@ -954,7 +954,7 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // visible detail levels. // A negative subshape on the detail means we don't have geometry. - const TSShape::Detail &detail = details[0]; + const TSShape::Detail &detail = mDetails[0]; if ( detail.subShapeNum < 0 ) return NULL; @@ -964,16 +964,16 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & polyList.setTransform( &MatrixF::Identity, scale ); // Create the collision meshes. - S32 start = subShapeFirstObject[ detail.subShapeNum ]; - S32 end = start + subShapeNumObjects[ detail.subShapeNum ]; + S32 start = mSubShapeFirstObject[ detail.subShapeNum ]; + S32 end = start + mSubShapeNumObjects[ detail.subShapeNum ]; for ( S32 o=start; o < end; o++ ) { - const TSShape::Object &object = objects[o]; + const TSShape::Object &object = mObjects[o]; if ( detail.objectDetailNum >= object.numMeshes ) continue; // No mesh or no verts.... nothing to do. - TSMesh *mesh = meshes[ object.startMeshIndex + detail.objectDetailNum ]; + TSMesh *mesh = mMeshes[ object.startMeshIndex + detail.objectDetailNum ]; if ( !mesh || mesh->mNumVerts == 0 ) continue; @@ -1013,31 +1013,31 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // // TODO: We need to support LOS collision for physics. // - for ( U32 i = 0; i < details.size(); i++ ) + for ( U32 i = 0; i < mDetails.size(); i++ ) { - const TSShape::Detail &detail = details[i]; - const String &name = names[detail.nameIndex]; + const TSShape::Detail &detail = mDetails[i]; + const String &name = mNames[detail.nameIndex]; // Is this a valid collision detail. if ( !dStrStartsWith( name, "Collision" ) || detail.subShapeNum < 0 ) continue; // Now go thru the meshes for this detail. - S32 start = subShapeFirstObject[ detail.subShapeNum ]; - S32 end = start + subShapeNumObjects[ detail.subShapeNum ]; + S32 start = mSubShapeFirstObject[ detail.subShapeNum ]; + S32 end = start + mSubShapeNumObjects[ detail.subShapeNum ]; if ( start >= end ) continue; for ( S32 o=start; o < end; o++ ) { - const TSShape::Object &object = objects[o]; - const String &meshName = names[ object.nameIndex ]; + const TSShape::Object &object = mObjects[o]; + const String &meshName = mNames[ object.nameIndex ]; if ( object.numMeshes <= detail.objectDetailNum ) continue; // No mesh, a flat bounds, or no verts.... nothing to do. - TSMesh *mesh = meshes[ object.startMeshIndex + detail.objectDetailNum ]; + TSMesh *mesh = mMeshes[ object.startMeshIndex + detail.objectDetailNum ]; if ( !mesh || mesh->getBounds().isEmpty() || mesh->mNumVerts == 0 ) continue; diff --git a/Engine/source/ts/tsDump.cpp b/Engine/source/ts/tsDump.cpp index 9d37faa81..0d5991754 100644 --- a/Engine/source/ts/tsDump.cpp +++ b/Engine/source/ts/tsDump.cpp @@ -50,7 +50,7 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector space[level*3] = '\0'; const char *nodeName = ""; - const TSShape::Node & node = mShape->nodes[nodeIndex]; + const TSShape::Node & node = mShape->mNodes[nodeIndex]; if (node.nameIndex != -1) nodeName = mShape->getName(node.nameIndex); dumpLine(avar("%s%s", space, nodeName)); @@ -93,7 +93,7 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector for (S32 k=0; kobject->numMeshes; k++) { S32 f = obj->object->startMeshIndex; - if (mShape->meshes[f+k]) + if (mShape->mMeshes[f+k]) dumpLine(avar(" %i",detailSizes[k])); } @@ -108,9 +108,9 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector } // search for children - for (S32 k=nodeIndex+1; knodes.size(); k++) + for (S32 k=nodeIndex+1; kmNodes.size(); k++) { - if (mShape->nodes[k].parentIndex == nodeIndex) + if (mShape->mNodes[k].parentIndex == nodeIndex) // this is our child dumpNode(stream, level+1, k, detailSizes); } @@ -126,9 +126,9 @@ void TSShapeInstance::dump(Stream & stream) dumpLine("\r\n Details:\r\n"); - for (i=0; idetails.size(); i++) + for (i=0; imDetails.size(); i++) { - const TSDetail & detail = mShape->details[i]; + const TSDetail & detail = mShape->mDetails[i]; name = mShape->getName(detail.nameIndex); ss = detail.subShapeNum; od = detail.objectDetailNum; @@ -145,23 +145,23 @@ void TSShapeInstance::dump(Stream & stream) dumpLine("\r\n Subtrees:\r\n"); - for (i=0; isubShapeFirstNode.size(); i++) + for (i=0; imSubShapeFirstNode.size(); i++) { - S32 a = mShape->subShapeFirstNode[i]; - S32 b = a + mShape->subShapeNumNodes[i]; + S32 a = mShape->mSubShapeFirstNode[i]; + S32 b = a + mShape->mSubShapeNumNodes[i]; dumpLine(avar(" Subtree %i\r\n",i)); // compute detail sizes for each subshape Vector detailSizes; - for (S32 l=0;ldetails.size(); l++) + for (S32 l=0;lmDetails.size(); l++) { - if ((mShape->details[l].subShapeNum==i) || (mShape->details[l].subShapeNum==-1)) - detailSizes.push_back((S32)mShape->details[l].size); + if ((mShape->mDetails[l].subShapeNum==i) || (mShape->mDetails[l].subShapeNum==-1)) + detailSizes.push_back((S32)mShape->mDetails[l].size); } for (j=a; jnodes[j]; + const TSNode & node = mShape->mNodes[j]; // if the node has a parent, it'll get dumped via the parent if (node.parentIndex<0) dumpNode(stream,3,j,detailSizes); @@ -169,22 +169,22 @@ void TSShapeInstance::dump(Stream & stream) } bool foundSkin = false; - for (i=0; iobjects.size(); i++) + for (i=0; imObjects.size(); i++) { - if (mShape->objects[i].nodeIndex<0) // must be a skin + if (mShape->mObjects[i].nodeIndex<0) // must be a skin { if (!foundSkin) dumpLine("\r\n Skins:\r\n"); foundSkin=true; const char * skinName = ""; - S32 nameIndex = mShape->objects[i].nameIndex; + S32 nameIndex = mShape->mObjects[i].nameIndex; if (nameIndex>=0) skinName = mShape->getName(nameIndex); dumpLine(avar(" Skin %s with following details: ",skinName)); - for (S32 num=0; numobjects[i].numMeshes; num++) + for (S32 num=0; nummObjects[i].numMeshes; num++) { - if (mShape->meshes[mShape->objects[i].startMeshIndex + num]) - dumpLine(avar(" %i",(S32)mShape->details[num].size)); + if (mShape->mMeshes[mShape->mObjects[i].startMeshIndex + num]) + dumpLine(avar(" %i",(S32)mShape->mDetails[num].size)); } dumpLine("\r\n"); } @@ -193,19 +193,19 @@ void TSShapeInstance::dump(Stream & stream) dumpLine("\r\n"); dumpLine("\r\n Sequences:\r\n"); - for (i = 0; i < mShape->sequences.size(); i++) + for (i = 0; i < mShape->mSequences.size(); i++) { const char *name = "(none)"; - if (mShape->sequences[i].nameIndex != -1) - name = mShape->getName(mShape->sequences[i].nameIndex); + if (mShape->mSequences[i].nameIndex != -1) + name = mShape->getName(mShape->mSequences[i].nameIndex); dumpLine(avar(" %3d: %s%s%s\r\n", i, name, - mShape->sequences[i].isCyclic() ? " (cyclic)" : "", - mShape->sequences[i].isBlend() ? " (blend)" : "")); + mShape->mSequences[i].isCyclic() ? " (cyclic)" : "", + mShape->mSequences[i].isBlend() ? " (blend)" : "")); } - if (mShape->materialList) + if (mShape->mMaterialList) { - TSMaterialList * ml = mShape->materialList; + TSMaterialList * ml = mShape->mMaterialList; dumpLine("\r\n Material list:\r\n"); for (i=0; i<(S32)ml->size(); i++) { diff --git a/Engine/source/ts/tsLastDetail.cpp b/Engine/source/ts/tsLastDetail.cpp index 1e9ec9726..4a425b6bb 100644 --- a/Engine/source/ts/tsLastDetail.cpp +++ b/Engine/source/ts/tsLastDetail.cpp @@ -81,8 +81,8 @@ TSLastDetail::TSLastDetail( TSShape *shape, mDl = dl; mDim = getMax( dim, (S32)32 ); - mRadius = mShape->radius; - mCenter = mShape->center; + mRadius = mShape->mRadius; + mCenter = mShape->mCenter; mCachePath = cachePath; diff --git a/Engine/source/ts/tsMeshFit.cpp b/Engine/source/ts/tsMeshFit.cpp index 9c07cceab..4188b83cc 100644 --- a/Engine/source/ts/tsMeshFit.cpp +++ b/Engine/source/ts/tsMeshFit.cpp @@ -204,18 +204,18 @@ void MeshFit::initSourceGeometry( const String& target ) { // Add all geometry in the highest detail level S32 dl = 0; - S32 ss = mShape->details[dl].subShapeNum; + S32 ss = mShape->mDetails[dl].subShapeNum; if ( ss < 0 ) return; - S32 od = mShape->details[dl].objectDetailNum; - S32 start = mShape->subShapeFirstObject[ss]; - S32 end = start + mShape->subShapeNumObjects[ss]; + S32 od = mShape->mDetails[dl].objectDetailNum; + S32 start = mShape->mSubShapeFirstObject[ss]; + S32 end = start + mShape->mSubShapeNumObjects[ss]; for ( S32 i = start; i < end; i++ ) { - const TSShape::Object &obj = mShape->objects[i]; - const TSMesh* mesh = ( od < obj.numMeshes ) ? mShape->meshes[obj.startMeshIndex + od] : NULL; + const TSShape::Object &obj = mShape->mObjects[i]; + const TSMesh* mesh = ( od < obj.numMeshes ) ? mShape->mMeshes[obj.startMeshIndex + od] : NULL; if ( mesh ) addSourceMesh( obj, mesh ); } @@ -227,10 +227,10 @@ void MeshFit::initSourceGeometry( const String& target ) if ( objIndex == -1 ) return; - const TSShape::Object &obj = mShape->objects[objIndex]; + const TSShape::Object &obj = mShape->mObjects[objIndex]; for ( S32 i = 0; i < obj.numMeshes; i++ ) { - const TSMesh* mesh = mShape->meshes[obj.startMeshIndex + i]; + const TSMesh* mesh = mShape->mMeshes[obj.startMeshIndex + i]; if ( mesh ) { addSourceMesh( obj, mesh ); @@ -310,13 +310,13 @@ TSMesh* MeshFit::initMeshFromFile( const String& filename ) const { // Open the source shape file and make a copy of the mesh Resource hShape = ResourceManager::get().load(filename); - if (!bool(hShape) || !((TSShape*)hShape)->meshes.size()) + if (!bool(hShape) || !((TSShape*)hShape)->mMeshes.size()) { Con::errorf("TSShape::createMesh: Could not load source mesh from %s", filename.c_str()); return NULL; } - TSMesh* srcMesh = ((TSShape*)hShape)->meshes[0]; + TSMesh* srcMesh = ((TSShape*)hShape)->mMeshes[0]; return mShape->copyMesh( srcMesh ); } diff --git a/Engine/source/ts/tsPartInstance.cpp b/Engine/source/ts/tsPartInstance.cpp index 32e1a6fe3..f7378cfdc 100644 --- a/Engine/source/ts/tsPartInstance.cpp +++ b/Engine/source/ts/tsPartInstance.cpp @@ -97,9 +97,9 @@ void TSPartInstance::updateBounds() void TSPartInstance::breakShape(TSShapeInstance * shape, S32 subShape, Vector & partList, F32 * probShatter, F32 * probBreak, S32 probDepth) { - AssertFatal(subShape>=0 && subShapemShape->subShapeFirstNode.size(),"TSPartInstance::breakShape: subShape out of range."); + AssertFatal(subShape>=0 && subShapemShape->mSubShapeFirstNode.size(),"TSPartInstance::breakShape: subShape out of range."); - S32 start = shape->mShape->subShapeFirstNode[subShape]; + S32 start = shape->mShape->mSubShapeFirstNode[subShape]; TSPartInstance::breakShape(shape, NULL, start, partList, probShatter, probBreak, probDepth); @@ -120,7 +120,7 @@ void TSPartInstance::breakShape(TSShapeInstance * shape, TSPartInstance * curren { AssertFatal( !probDepth || (probShatter && probBreak),"TSPartInstance::breakShape: probabilities improperly specified."); - const TSShape::Node * node = &shape->mShape->nodes[currentNode]; + const TSShape::Node * node = &shape->mShape->mNodes[currentNode]; S32 object = node->firstObject; S32 child = node->firstChild; @@ -155,14 +155,14 @@ void TSPartInstance::breakShape(TSShapeInstance * shape, TSPartInstance * curren { partList.increment(); partList.last() = new TSPartInstance(shape,object); - object = shape->mShape->objects[object].nextSibling; + object = shape->mShape->mObjects[object].nextSibling; } // iterate through the child nodes, call ourselves on each one with currentPart = NULL while (child>=0) { TSPartInstance::breakShape(shape,NULL,child,partList,probShatter,probBreak,probDepth); - child = shape->mShape->nodes[child].nextSibling; + child = shape->mShape->mNodes[child].nextSibling; } return; @@ -184,14 +184,14 @@ void TSPartInstance::breakShape(TSShapeInstance * shape, TSPartInstance * curren while (object>=0) { currentPart->addObject(object); - object = shape->mShape->objects[object].nextSibling; + object = shape->mShape->mObjects[object].nextSibling; } // iterate through child nodes, call ourselves on each one with currentPart as is while (child>=0) { TSPartInstance::breakShape(shape,currentPart,child,partList,probShatter,probBreak,probDepth); - child = shape->mShape->nodes[child].nextSibling; + child = shape->mShape->mNodes[child].nextSibling; } } @@ -334,7 +334,7 @@ F32 TSPartInstance::getDetailSize(S32 dl) const else if (mSizeCutoffs && dlgetShape()->mSmallestVisibleDL) - return mSourceShape->getShape()->details[dl].size; + return mSourceShape->getShape()->mDetails[dl].size; else return 0; } diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index f4fadf815..1a27dc3c6 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -62,7 +62,7 @@ bool TSShape::smInitOnRead = true; TSShape::TSShape() { - materialList = NULL; + mMaterialList = NULL; mReadVersion = -1; // -1 means constructed from scratch (e.g., in exporter or no read yet) mHasSkinMesh = false; mSequencesConstructed = false; @@ -74,70 +74,70 @@ TSShape::TSShape() mDetailLevelLookup.setSize( 1 ); mDetailLevelLookup[0].set( -1, 0 ); - VECTOR_SET_ASSOCIATION(sequences); - VECTOR_SET_ASSOCIATION(nodeRotations); - VECTOR_SET_ASSOCIATION(nodeTranslations); - VECTOR_SET_ASSOCIATION(nodeUniformScales); - VECTOR_SET_ASSOCIATION(nodeAlignedScales); - VECTOR_SET_ASSOCIATION(nodeArbitraryScaleRots); - VECTOR_SET_ASSOCIATION(nodeArbitraryScaleFactors); - VECTOR_SET_ASSOCIATION(groundRotations); - VECTOR_SET_ASSOCIATION(groundTranslations); - VECTOR_SET_ASSOCIATION(triggers); - VECTOR_SET_ASSOCIATION(billboardDetails); - VECTOR_SET_ASSOCIATION(detailCollisionAccelerators); - VECTOR_SET_ASSOCIATION(names); + VECTOR_SET_ASSOCIATION(mSequences); + VECTOR_SET_ASSOCIATION(mNodeRotations); + VECTOR_SET_ASSOCIATION(mNodeTranslations); + VECTOR_SET_ASSOCIATION(mNodeUniformScales); + VECTOR_SET_ASSOCIATION(mNodeAlignedScales); + VECTOR_SET_ASSOCIATION(mNodeArbitraryScaleRots); + VECTOR_SET_ASSOCIATION(mNodeArbitraryScaleFactors); + VECTOR_SET_ASSOCIATION(mGroundRotations); + VECTOR_SET_ASSOCIATION(mGroundTranslations); + VECTOR_SET_ASSOCIATION(mTriggers); + VECTOR_SET_ASSOCIATION(mBillboardDetails); + VECTOR_SET_ASSOCIATION(mDetailCollisionAccelerators); + VECTOR_SET_ASSOCIATION(mNames); - VECTOR_SET_ASSOCIATION( nodes ); - VECTOR_SET_ASSOCIATION( objects ); - VECTOR_SET_ASSOCIATION( objectStates ); - VECTOR_SET_ASSOCIATION( subShapeFirstNode ); - VECTOR_SET_ASSOCIATION( subShapeFirstObject ); - VECTOR_SET_ASSOCIATION( detailFirstSkin ); - VECTOR_SET_ASSOCIATION( subShapeNumNodes ); - VECTOR_SET_ASSOCIATION( subShapeNumObjects ); - VECTOR_SET_ASSOCIATION( details ); - VECTOR_SET_ASSOCIATION( defaultRotations ); - VECTOR_SET_ASSOCIATION( defaultTranslations ); + VECTOR_SET_ASSOCIATION( mNodes ); + VECTOR_SET_ASSOCIATION( mObjects ); + VECTOR_SET_ASSOCIATION( mObjectStates ); + VECTOR_SET_ASSOCIATION( mSubShapeFirstNode ); + VECTOR_SET_ASSOCIATION( mSubShapeFirstObject ); + VECTOR_SET_ASSOCIATION( mDetailFirstSkin ); + VECTOR_SET_ASSOCIATION( mSubShapeNumNodes ); + VECTOR_SET_ASSOCIATION( mSubShapeNumObjects ); + VECTOR_SET_ASSOCIATION( mDetails ); + VECTOR_SET_ASSOCIATION( mDefaultRotations ); + VECTOR_SET_ASSOCIATION( mDefaultTranslations ); - VECTOR_SET_ASSOCIATION( subShapeFirstTranslucentObject ); - VECTOR_SET_ASSOCIATION( meshes ); + VECTOR_SET_ASSOCIATION( mSubShapeFirstTranslucentObject ); + VECTOR_SET_ASSOCIATION( mMeshes ); - VECTOR_SET_ASSOCIATION( alphaIn ); - VECTOR_SET_ASSOCIATION( alphaOut ); + VECTOR_SET_ASSOCIATION( mAlphaIn ); + VECTOR_SET_ASSOCIATION( mAlphaOut ); } TSShape::~TSShape() { - delete materialList; + delete mMaterialList; S32 i; // everything left over here is a legit mesh - for (i=0; i= mShapeData) && ((S8*)meshes[i] < (mShapeData + mShapeDataSize))) - destructInPlace(meshes[i]); + if (((S8*)mMeshes[i] >= mShapeData) && ((S8*)mMeshes[i] < (mShapeData + mShapeDataSize))) + destructInPlace(mMeshes[i]); else - delete meshes[i]; + delete mMeshes[i]; } - for (i=0; ivertexList; delete [] accel->normalList; @@ -147,8 +147,8 @@ TSShape::~TSShape() delete accel; } } - for (dca = 0; dca < detailCollisionAccelerators.size(); dca++) - detailCollisionAccelerators[dca] = NULL; + for (dca = 0; dca < mDetailCollisionAccelerators.size(); dca++) + mDetailCollisionAccelerators[dca] = NULL; if( mShapeData ) delete[] mShapeData; @@ -156,44 +156,44 @@ TSShape::~TSShape() const String& TSShape::getName( S32 nameIndex ) const { - AssertFatal(nameIndex>=0 && nameIndex=0 && nameIndex= 0 && seqIndex= 0 && seqIndexgetMaterialNameList().size(); + S32 targetCount = mMaterialList->getMaterialNameList().size(); if(mapToNameIndex < 0 || mapToNameIndex >= targetCount) return String::EmptyString; - return materialList->getMaterialNameList()[mapToNameIndex]; + return mMaterialList->getMaterialNameList()[mapToNameIndex]; } S32 TSShape::getTargetCount() const @@ -215,46 +215,46 @@ S32 TSShape::getTargetCount() const if(!this) return -1; - return materialList->getMaterialNameList().size(); + return mMaterialList->getMaterialNameList().size(); } S32 TSShape::findNode(S32 nameIndex) const { - for (S32 i=0; i validDetails; @@ -278,7 +278,7 @@ bool TSShape::findMeshIndex(const String& meshName, S32& objIndex, S32& meshInde // Find the detail with the correct size for (meshIndex = 0; meshIndex < validDetails.size(); meshIndex++) { - const TSShape::Detail& det = details[validDetails[meshIndex]]; + const TSShape::Detail& det = mDetails[validDetails[meshIndex]]; if (detailSize == det.size) return true; } @@ -291,15 +291,15 @@ TSMesh* TSShape::findMesh(const String& meshName) S32 objIndex, meshIndex; if (!findMeshIndex(meshName, objIndex, meshIndex)) return 0; - return meshes[objects[objIndex].startMeshIndex + meshIndex]; + return mMeshes[mObjects[objIndex].startMeshIndex + meshIndex]; } S32 TSShape::getSubShapeForNode(S32 nodeIndex) { - for (S32 i = 0; i < subShapeFirstNode.size(); i++) + for (S32 i = 0; i < mSubShapeFirstNode.size(); i++) { - S32 start = subShapeFirstNode[i]; - S32 end = start + subShapeNumNodes[i]; + S32 start = mSubShapeFirstNode[i]; + S32 end = start + mSubShapeNumNodes[i]; if ((nodeIndex >= start) && (nodeIndex < end)) return i;; } @@ -308,10 +308,10 @@ S32 TSShape::getSubShapeForNode(S32 nodeIndex) S32 TSShape::getSubShapeForObject(S32 objIndex) { - for (S32 i = 0; i < subShapeFirstObject.size(); i++) + for (S32 i = 0; i < mSubShapeFirstObject.size(); i++) { - S32 start = subShapeFirstObject[i]; - S32 end = start + subShapeNumObjects[i]; + S32 start = mSubShapeFirstObject[i]; + S32 end = start + mSubShapeNumObjects[i]; if ((objIndex >= start) && (objIndex < end)) return i; } @@ -321,10 +321,10 @@ S32 TSShape::getSubShapeForObject(S32 objIndex) void TSShape::getSubShapeDetails(S32 subShapeIndex, Vector& validDetails) { validDetails.clear(); - for (S32 i = 0; i < details.size(); i++) + for (S32 i = 0; i < mDetails.size(); i++) { - if ((details[i].subShapeNum == subShapeIndex) || - (details[i].subShapeNum < 0)) + if ((mDetails[i].subShapeNum == subShapeIndex) || + (mDetails[i].subShapeNum < 0)) validDetails.push_back(i); } } @@ -338,36 +338,36 @@ void TSShape::getNodeWorldTransform(S32 nodeIndex, MatrixF* mat) const else { // Calculate the world transform of the given node - defaultRotations[nodeIndex].getQuatF().setMatrix(mat); - mat->setPosition(defaultTranslations[nodeIndex]); + mDefaultRotations[nodeIndex].getQuatF().setMatrix(mat); + mat->setPosition(mDefaultTranslations[nodeIndex]); - S32 parentIndex = nodes[nodeIndex].parentIndex; + S32 parentIndex = mNodes[nodeIndex].parentIndex; while (parentIndex != -1) { MatrixF mat2(*mat); - defaultRotations[parentIndex].getQuatF().setMatrix(mat); - mat->setPosition(defaultTranslations[parentIndex]); + mDefaultRotations[parentIndex].getQuatF().setMatrix(mat); + mat->setPosition(mDefaultTranslations[parentIndex]); mat->mul(mat2); - parentIndex = nodes[parentIndex].parentIndex; + parentIndex = mNodes[parentIndex].parentIndex; } } } void TSShape::getNodeObjects(S32 nodeIndex, Vector& nodeObjects) { - for (S32 i = 0; i < objects.size(); i++) + for (S32 i = 0; i < mObjects.size(); i++) { - if ((nodeIndex == -1) || (objects[i].nodeIndex == nodeIndex)) + if ((nodeIndex == -1) || (mObjects[i].nodeIndex == nodeIndex)) nodeObjects.push_back(i); } } void TSShape::getNodeChildren(S32 nodeIndex, Vector& nodeChildren) { - for (S32 i = 0; i < nodes.size(); i++) + for (S32 i = 0; i < mNodes.size(); i++) { - if (nodes[i].parentIndex == nodeIndex) + if (mNodes[i].parentIndex == nodeIndex) nodeChildren.push_back(i); } } @@ -379,101 +379,101 @@ void TSShape::getObjectDetails(S32 objIndex, Vector& objDetails) getSubShapeDetails(getSubShapeForObject(objIndex), validDetails); // Get the non-null details for this object - const TSShape::Object& obj = objects[objIndex]; + const TSShape::Object& obj = mObjects[objIndex]; for (S32 i = 0; i < obj.numMeshes; i++) { - if (meshes[obj.startMeshIndex + i]) + if (mMeshes[obj.startMeshIndex + i]) objDetails.push_back(validDetails[i]); } } void TSShape::init() { - S32 numSubShapes = subShapeFirstNode.size(); - AssertFatal(numSubShapes==subShapeFirstObject.size(),"TSShape::init"); + S32 numSubShapes = mSubShapeFirstNode.size(); + AssertFatal(numSubShapes==mSubShapeFirstObject.size(),"TSShape::init"); S32 i,j; // set up parent/child relationships on nodes and objects - for (i=0; i=0) { - if (nodes[parentIndex].firstChild<0) - nodes[parentIndex].firstChild=i; + if (mNodes[parentIndex].firstChild<0) + mNodes[parentIndex].firstChild=i; else { - S32 child = nodes[parentIndex].firstChild; - while (nodes[child].nextSibling>=0) - child = nodes[child].nextSibling; - nodes[child].nextSibling = i; + S32 child = mNodes[parentIndex].firstChild; + while (mNodes[child].nextSibling>=0) + child = mNodes[child].nextSibling; + mNodes[child].nextSibling = i; } } } - for (i=0; i=0) { - if (nodes[nodeIndex].firstObject<0) - nodes[nodeIndex].firstObject = i; + if (mNodes[nodeIndex].firstObject<0) + mNodes[nodeIndex].firstObject = i; else { - S32 objectIndex = nodes[nodeIndex].firstObject; - while (objects[objectIndex].nextSibling>=0) - objectIndex = objects[objectIndex].nextSibling; - objects[objectIndex].nextSibling = i; + S32 objectIndex = mNodes[nodeIndex].firstObject; + while (mObjects[objectIndex].nextSibling>=0) + objectIndex = mObjects[objectIndex].nextSibling; + mObjects[objectIndex].nextSibling = i; } } } mFlags = 0; - for (i=0; igetNumPolys() : 0; } } - details[i].polyCount = count; + mDetails[i].polyCount = count; } // Init the collision accelerator array. Note that we don't compute the // accelerators until the app requests them { S32 dca; - for (dca = 0; dca < detailCollisionAccelerators.size(); dca++) + for (dca = 0; dca < mDetailCollisionAccelerators.size(); dca++) { - ConvexHullAccelerator* accel = detailCollisionAccelerators[dca]; + ConvexHullAccelerator* accel = mDetailCollisionAccelerators[dca]; if (accel != NULL) { delete [] accel->vertexList; delete [] accel->normalList; @@ -540,9 +540,9 @@ void TSShape::init() } } - detailCollisionAccelerators.setSize(details.size()); - for (dca = 0; dca < detailCollisionAccelerators.size(); dca++) - detailCollisionAccelerators[dca] = NULL; + mDetailCollisionAccelerators.setSize(mDetails.size()); + for (dca = 0; dca < mDetailCollisionAccelerators.size(); dca++) + mDetailCollisionAccelerators[dca] = NULL; } initVertexFeatures(); @@ -554,8 +554,8 @@ void TSShape::initVertexFeatures() bool hasColors = false; bool hasTexcoord2 = false; - Vector::iterator iter = meshes.begin(); - for ( ; iter != meshes.end(); iter++ ) + Vector::iterator iter = mMeshes.begin(); + for ( ; iter != mMeshes.end(); iter++ ) { TSMesh *mesh = *iter; if ( mesh && @@ -594,8 +594,8 @@ void TSShape::initVertexFeatures() // Go fix up meshes to include defaults for optional features // and initialize them if they're not a skin mesh. - iter = meshes.begin(); - for ( ; iter != meshes.end(); iter++ ) + iter = mMeshes.begin(); + for ( ; iter != mMeshes.end(); iter++ ) { TSMesh *mesh = *iter; if ( !mesh || @@ -621,20 +621,20 @@ void TSShape::setupBillboardDetails( const String &cachePath ) // set up billboard details -- only do this once, meaning that // if we add a sequence to the shape we don't redo the billboard // details... - if ( !billboardDetails.empty() ) + if ( !mBillboardDetails.empty() ) return; - for ( U32 i=0; i < details.size(); i++ ) + for ( U32 i=0; i < mDetails.size(); i++ ) { - const Detail &det = details[i]; + const Detail &det = mDetails[i]; if ( det.subShapeNum >= 0 ) continue; // not a billboard detail - while (billboardDetails.size() <= i ) - billboardDetails.push_back(NULL); + while (mBillboardDetails.size() <= i ) + mBillboardDetails.push_back(NULL); - billboardDetails[i] = new TSLastDetail( this, + mBillboardDetails[i] = new TSLastDetail( this, cachePath, det.bbEquatorSteps, det.bbPolarSteps, @@ -643,15 +643,15 @@ void TSShape::setupBillboardDetails( const String &cachePath ) det.bbDetailLevel, det.bbDimension ); - billboardDetails[i]->update(); + mBillboardDetails[i]->update(); } } void TSShape::initMaterialList() { - S32 numSubShapes = subShapeFirstObject.size(); + S32 numSubShapes = mSubShapeFirstObject.size(); #if defined(TORQUE_MAX_LIB) - subShapeFirstTranslucentObject.setSize(numSubShapes); + mSubShapeFirstTranslucentObject.setSize(numSubShapes); #endif mHasSkinMesh = false; @@ -661,16 +661,16 @@ void TSShape::initMaterialList() // also, while we're at it, set mHasTranslucency for (S32 ss = 0; ssmPrimitives[k].matIndex & TSDrawPrimitive::NoMaterial) continue; - S32 flags = materialList->getFlags(mesh->mPrimitives[k].matIndex & TSDrawPrimitive::MaterialMask); + S32 flags = mMaterialList->getFlags(mesh->mPrimitives[k].matIndex & TSDrawPrimitive::MaterialMask); if (flags & TSMaterialList::AuxiliaryMap) continue; if (flags & TSMaterialList::Translucent) { mFlags |= HasTranslucency; - subShapeFirstTranslucentObject[ss] = i; + mSubShapeFirstTranslucentObject[ss] = i; break; } } @@ -704,26 +704,26 @@ void TSShape::initMaterialList() bool TSShape::preloadMaterialList(const Torque::Path &path) { - if (materialList) - materialList->setTextureLookupPath(path.getPath()); + if (mMaterialList) + mMaterialList->setTextureLookupPath(path.getPath()); return true; } bool TSShape::buildConvexHull(S32 dl) const { - AssertFatal(dl>=0 && dl=0 && dlbuildConvexHull(); @@ -739,10 +739,10 @@ void TSShape::computeBounds(S32 dl, Box3F & bounds) const if (dl==-1) return; - AssertFatal(dl>=0 && dl=0 && dlsubShapeNum; S32 od = detail->objectDetailNum; @@ -753,16 +753,16 @@ void TSShape::computeBounds(S32 dl, Box3F & bounds) const // set up temporary storage for non-local transforms... S32 i; - S32 start = subShapeFirstNode[ss]; - S32 end = subShapeNumNodes[ss] + start; + S32 start = mSubShapeFirstNode[ss]; + S32 end = mSubShapeNumNodes[ss] + start; gTempNodeTransforms.setSize(end-start); for (i=start; i=0) - gTempNodeTransforms[i-start].mul(gTempNodeTransforms[nodes[i].parentIndex-start],mat); + TSTransform::setMatrix(mDefaultRotations[i].getQuatF(&q),mDefaultTranslations[i],&mat); + if (mNodes[i].parentIndex>=0) + gTempNodeTransforms[i-start].mul(gTempNodeTransforms[mNodes[i].parentIndex-start],mat); else gTempNodeTransforms[i-start] = mat; } @@ -771,12 +771,12 @@ void TSShape::computeBounds(S32 dl, Box3F & bounds) const bounds.minExtents.set( 10E30f, 10E30f, 10E30f); bounds.maxExtents.set(-10E30f,-10E30f,-10E30f); Box3F box; - start = subShapeFirstObject[ss]; - end = subShapeNumObjects[ss] + start; + start = mSubShapeFirstObject[ss]; + end = mSubShapeNumObjects[ss] + start; for (i=start; inumMeshes ? meshes[object->startMeshIndex+od] : NULL; + const Object * object = &mObjects[i]; + TSMesh * mesh = odnumMeshes ? mMeshes[object->startMeshIndex+od] : NULL; if (mesh) { static MatrixF idMat(true); @@ -805,23 +805,23 @@ bool TSShape::checkSkip(S32 meshNum, S32 & curObject, S32 skipDL) return false; // skip detail level exists on this subShape - S32 skipSS = details[skipDL].subShapeNum; + S32 skipSS = mDetails[skipDL].subShapeNum; - if (curObject=start) { // we are either from this object, the next object, or a decal - if (meshNum < start + objects[curObject].numMeshes) + if (meshNum < start + mObjects[curObject].numMeshes) { // this object... - if (subShapeFirstObject[skipSS]>curObject) + if (mSubShapeFirstObject[skipSS]>curObject) // haven't reached this subshape yet return true; - if (skipSS+1==subShapeFirstObject.size() || curObject21) { // more node sequence data...scale - nodeUniformScales.setSize(numNodeUniformScales); + mNodeUniformScales.setSize(numNodeUniformScales); for (i=0;i23) { - groundTranslations.setSize(numGroundFrames); + mGroundTranslations.setSize(numGroundFrames); for (i=0;i 10000 ) || - ( details[i].maxError == 0 ) || ( details[i].maxError > 10000 ) ) + if ( ( mDetails[i].averageError == 0 ) || ( mDetails[i].averageError > 10000 ) || + ( mDetails[i].maxError == 0 ) || ( mDetails[i].maxError > 10000 ) ) { - details[i].averageError = details[i].maxError = -1.0f; + mDetails[i].averageError = mDetails[i].maxError = -1.0f; } } @@ -1198,7 +1198,7 @@ void TSShape::assembleShape() } } } - meshes.set(ptr32,numMeshes); + mMeshes.set(ptr32,numMeshes); tsalloc.checkGuard(); @@ -1206,13 +1206,13 @@ void TSShape::assembleShape() char * nameBufferStart = (char*)tsalloc.getPointer8(0); char * name = nameBufferStart; S32 nameBufferSize = 0; - names.setSize(numNames); + mNames.setSize(numNames); for (i=0; i 25) { U32 alignedSize32 = sizeof( Detail ) / 4; - tsalloc.copyToBuffer32((S32*)details.address(),numDetails * alignedSize32 ); + tsalloc.copyToBuffer32((S32*)mDetails.address(),numDetails * alignedSize32 ); } else { // Legacy details => no explicit autobillboard parameters U32 legacyDetailSize32 = 7; // only store the first 7 4-byte values of each detail - for ( S32 i = 0; i < details.size(); i++ ) - tsalloc.copyToBuffer32( (S32*)&details[i], legacyDetailSize32 ); + for ( S32 i = 0; i < mDetails.size(); i++ ) + tsalloc.copyToBuffer32( (S32*)&mDetails[i], legacyDetailSize32 ); } tsalloc.setGuard(); @@ -1403,18 +1403,18 @@ void TSShape::disassembleShape() bool * isMesh = new bool[numMeshes]; // funny business because decals are pretend meshes (legacy issue) for (i=0;igetMeshType() != TSMesh::DecalMeshType) ? mesh->getMeshType() : TSMesh::NullMeshType); if (mesh) mesh->disassemble(); @@ -1424,7 +1424,7 @@ void TSShape::disassembleShape() // names for (i=0; imTVerts2.size() || meshes[i]->mColors.size()) + if (mMeshes[i]->mTVerts2.size() || mMeshes[i]->mColors.size()) return false; // Cannot use old format if any primitive has too many triangles // (ie. cannot fit in a S16) - for (S32 j = 0; j < meshes[i]->mPrimitives.size(); j++) + for (S32 j = 0; j < mMeshes[i]->mPrimitives.size(); j++) { - if ((meshes[i]->mPrimitives[j].start + - meshes[i]->mPrimitives[j].numElements) >= (1 << 15)) + if ((mMeshes[i]->mPrimitives[j].start + + mMeshes[i]->mPrimitives[j].numElements) >= (1 << 15)) { return false; } @@ -1513,12 +1513,12 @@ void TSShape::write(Stream * s, bool saveOldFormat) s->write(size8 *4,buffer8); // write sequences - write will properly endian-flip. - s->write(sequences.size()); - for (S32 i=0; iwrite(mSequences.size()); + for (S32 i=0; iwrite(*s); + mMaterialList->write(*s); delete [] buffer32; delete [] buffer16; @@ -1585,20 +1585,20 @@ bool TSShape::read(Stream * s) // read sequences S32 numSequences; s->read(&numSequences); - sequences.setSize(numSequences); + mSequences.setSize(numSequences); for (i=0; iread(*s); + delete mMaterialList; // just in case... + mMaterialList = new TSMaterialList; + mMaterialList->read(*s); } // since we read in the buffers, we need to endian-flip their entire contents... @@ -1842,89 +1842,89 @@ bool TSShape::read(Stream * s) void TSShape::createEmptyShape() { - nodes.set(dMalloc(1 * sizeof(Node)), 1); - nodes[0].nameIndex = 1; - nodes[0].parentIndex = -1; - nodes[0].firstObject = 0; - nodes[0].firstChild = -1; - nodes[0].nextSibling = -1; + mNodes.set(dMalloc(1 * sizeof(Node)), 1); + mNodes[0].nameIndex = 1; + mNodes[0].parentIndex = -1; + mNodes[0].firstObject = 0; + mNodes[0].firstChild = -1; + mNodes[0].nextSibling = -1; - objects.set(dMalloc(1 * sizeof(Object)), 1); - objects[0].nameIndex = 2; - objects[0].numMeshes = 1; - objects[0].startMeshIndex = 0; - objects[0].nodeIndex = 0; - objects[0].nextSibling = -1; - objects[0].firstDecal = -1; + mObjects.set(dMalloc(1 * sizeof(Object)), 1); + mObjects[0].nameIndex = 2; + mObjects[0].numMeshes = 1; + mObjects[0].startMeshIndex = 0; + mObjects[0].nodeIndex = 0; + mObjects[0].nextSibling = -1; + mObjects[0].firstDecal = -1; - objectStates.set(dMalloc(1 * sizeof(ObjectState)), 1); - objectStates[0].vis = 1; - objectStates[0].frameIndex = 0; - objectStates[0].matFrameIndex = 0; + mObjectStates.set(dMalloc(1 * sizeof(ObjectState)), 1); + mObjectStates[0].vis = 1; + mObjectStates[0].frameIndex = 0; + mObjectStates[0].matFrameIndex = 0; - subShapeFirstNode.set(dMalloc(1 * sizeof(S32)), 1); - subShapeFirstNode[0] = 0; + mSubShapeFirstNode.set(dMalloc(1 * sizeof(S32)), 1); + mSubShapeFirstNode[0] = 0; - subShapeFirstObject.set(dMalloc(1 * sizeof(S32)), 1); - subShapeFirstObject[0] = 0; + mSubShapeFirstObject.set(dMalloc(1 * sizeof(S32)), 1); + mSubShapeFirstObject[0] = 0; - detailFirstSkin.set(NULL, 0); + mDetailFirstSkin.set(NULL, 0); - subShapeNumNodes.set(dMalloc(1 * sizeof(S32)), 1); - subShapeNumNodes[0] = 1; + mSubShapeNumNodes.set(dMalloc(1 * sizeof(S32)), 1); + mSubShapeNumNodes[0] = 1; - subShapeNumObjects.set(dMalloc(1 * sizeof(S32)), 1); - subShapeNumObjects[0] = 1; + mSubShapeNumObjects.set(dMalloc(1 * sizeof(S32)), 1); + mSubShapeNumObjects[0] = 1; - details.set(dMalloc(1 * sizeof(Detail)), 1); - details[0].nameIndex = 0; - details[0].subShapeNum = 0; - details[0].objectDetailNum = 0; - details[0].size = 2.0f; - details[0].averageError = -1.0f; - details[0].maxError = -1.0f; - details[0].polyCount = 0; + mDetails.set(dMalloc(1 * sizeof(Detail)), 1); + mDetails[0].nameIndex = 0; + mDetails[0].subShapeNum = 0; + mDetails[0].objectDetailNum = 0; + mDetails[0].size = 2.0f; + mDetails[0].averageError = -1.0f; + mDetails[0].maxError = -1.0f; + mDetails[0].polyCount = 0; - defaultRotations.set(dMalloc(1 * sizeof(Quat16)), 1); - defaultRotations[0].x = 0.0f; - defaultRotations[0].y = 0.0f; - defaultRotations[0].z = 0.0f; - defaultRotations[0].w = 0.0f; + mDefaultRotations.set(dMalloc(1 * sizeof(Quat16)), 1); + mDefaultRotations[0].x = 0.0f; + mDefaultRotations[0].y = 0.0f; + mDefaultRotations[0].z = 0.0f; + mDefaultRotations[0].w = 0.0f; - defaultTranslations.set(dMalloc(1 * sizeof(Point3F)), 1); - defaultTranslations[0].set(0.0f, 0.0f, 0.0f); + mDefaultTranslations.set(dMalloc(1 * sizeof(Point3F)), 1); + mDefaultTranslations[0].set(0.0f, 0.0f, 0.0f); - subShapeFirstTranslucentObject.set(dMalloc(1 * sizeof(S32)), 1); - subShapeFirstTranslucentObject[0] = 1; + mSubShapeFirstTranslucentObject.set(dMalloc(1 * sizeof(S32)), 1); + mSubShapeFirstTranslucentObject[0] = 1; - alphaIn.set(dMalloc(1 * sizeof(F32)), 1); - alphaIn[0] = 0; + mAlphaIn.set(dMalloc(1 * sizeof(F32)), 1); + mAlphaIn[0] = 0; - alphaOut.set(dMalloc(1 * sizeof(F32)), 1); - alphaOut[0] = -1; + mAlphaOut.set(dMalloc(1 * sizeof(F32)), 1); + mAlphaOut[0] = -1; - sequences.set(NULL, 0); - nodeRotations.set(NULL, 0); - nodeTranslations.set(NULL, 0); - nodeUniformScales.set(NULL, 0); - nodeAlignedScales.set(NULL, 0); - nodeArbitraryScaleRots.set(NULL, 0); - nodeArbitraryScaleFactors.set(NULL, 0); - groundRotations.set(NULL, 0); - groundTranslations.set(NULL, 0); - triggers.set(NULL, 0); - billboardDetails.set(NULL, 0); + mSequences.set(NULL, 0); + mNodeRotations.set(NULL, 0); + mNodeTranslations.set(NULL, 0); + mNodeUniformScales.set(NULL, 0); + mNodeAlignedScales.set(NULL, 0); + mNodeArbitraryScaleRots.set(NULL, 0); + mNodeArbitraryScaleFactors.set(NULL, 0); + mGroundRotations.set(NULL, 0); + mGroundTranslations.set(NULL, 0); + mTriggers.set(NULL, 0); + mBillboardDetails.set(NULL, 0); - names.setSize(3); - names[0] = StringTable->insert("Detail2"); - names[1] = StringTable->insert("Mesh2"); - names[2] = StringTable->insert("Mesh"); + mNames.setSize(3); + mNames[0] = StringTable->insert("Detail2"); + mNames[1] = StringTable->insert("Mesh2"); + mNames[2] = StringTable->insert("Mesh"); - radius = 0.866025f; - tubeRadius = 0.707107f; - center.set(0.0f, 0.5f, 0.0f); - bounds.minExtents.set(-0.5f, 0.0f, -0.5f); - bounds.maxExtents.set(0.5f, 1.0f, 0.5f); + mRadius = 0.866025f; + mTubeRadius = 0.707107f; + mCenter.set(0.0f, 0.5f, 0.0f); + mBounds.minExtents.set(-0.5f, 0.0f, -0.5f); + mBounds.maxExtents.set(0.5f, 1.0f, 0.5f); mExporterVersion = 124; mSmallestVisibleSize = 2; @@ -1940,9 +1940,9 @@ void TSShape::createEmptyShape() // Init the collision accelerator array. Note that we don't compute the // accelerators until the app requests them - detailCollisionAccelerators.setSize(details.size()); - for (U32 i = 0; i < detailCollisionAccelerators.size(); i++) - detailCollisionAccelerators[i] = NULL; + mDetailCollisionAccelerators.setSize(mDetails.size()); + for (U32 i = 0; i < mDetailCollisionAccelerators.size(); i++) + mDetailCollisionAccelerators[i] = NULL; } void TSShape::fixEndian(S32 * buff32, S16 * buff16, S8 *, S32 count32, S32 count16, S32) @@ -2045,27 +2045,27 @@ template<> ResourceBase::Signature Resource::signature() TSShape::ConvexHullAccelerator* TSShape::getAccelerator(S32 dl) { - AssertFatal(dl < details.size(), "Error, bad detail level!"); + AssertFatal(dl < mDetails.size(), "Error, bad detail level!"); if (dl == -1) return NULL; - AssertFatal( detailCollisionAccelerators.size() == details.size(), + AssertFatal( mDetailCollisionAccelerators.size() == mDetails.size(), "TSShape::getAccelerator() - mismatched array sizes!" ); - if (detailCollisionAccelerators[dl] == NULL) + if (mDetailCollisionAccelerators[dl] == NULL) computeAccelerator(dl); - AssertFatal(detailCollisionAccelerators[dl] != NULL, "This should be non-null after computing it!"); - return detailCollisionAccelerators[dl]; + AssertFatal(mDetailCollisionAccelerators[dl] != NULL, "This should be non-null after computing it!"); + return mDetailCollisionAccelerators[dl]; } void TSShape::computeAccelerator(S32 dl) { - AssertFatal(dl < details.size(), "Error, bad detail level!"); + AssertFatal(dl < mDetails.size(), "Error, bad detail level!"); // Have we already computed this? - if (detailCollisionAccelerators[dl] != NULL) + if (mDetailCollisionAccelerators[dl] != NULL) return; // Create a bogus features list... @@ -2073,12 +2073,12 @@ void TSShape::computeAccelerator(S32 dl) MatrixF mat(true); Point3F n(0, 0, 1); - const TSDetail* detail = &details[dl]; + const TSDetail* detail = &mDetails[dl]; S32 ss = detail->subShapeNum; S32 od = detail->objectDetailNum; - S32 start = subShapeFirstObject[ss]; - S32 end = subShapeNumObjects[ss] + start; + S32 start = mSubShapeFirstObject[ss]; + S32 end = mSubShapeNumObjects[ss] + start; if (start < end) { // run through objects and collide @@ -2087,10 +2087,10 @@ void TSShape::computeAccelerator(S32 dl) U32 surfaceKey = 0; for (S32 i = start; i < end; i++) { - const TSObject* obj = &objects[i]; + const TSObject* obj = &mObjects[i]; if (obj->numMeshes && od < obj->numMeshes) { - TSMesh* mesh = meshes[obj->startMeshIndex + od]; + TSMesh* mesh = mMeshes[obj->startMeshIndex + od]; if (mesh) mesh->getFeatures(0, mat, n, &cf, surfaceKey); } @@ -2145,7 +2145,7 @@ void TSShape::computeAccelerator(S32 dl) // Ok, so now we have a vertex list. Lets copy that out... ConvexHullAccelerator* accel = new ConvexHullAccelerator; - detailCollisionAccelerators[dl] = accel; + mDetailCollisionAccelerators[dl] = accel; accel->numVerts = cf.mVertexList.size(); accel->vertexList = new Point3F[accel->numVerts]; dMemcpy(accel->vertexList, cf.mVertexList.address(), sizeof(Point3F) * accel->numVerts); diff --git a/Engine/source/ts/tsShape.h b/Engine/source/ts/tsShape.h index 676b323fe..84bf75964 100644 --- a/Engine/source/ts/tsShape.h +++ b/Engine/source/ts/tsShape.h @@ -274,25 +274,25 @@ class TSShape /// @name Shape Vector Data /// @{ - Vector nodes; - Vector objects; - Vector objectStates; - Vector subShapeFirstNode; - Vector subShapeFirstObject; - Vector detailFirstSkin; - Vector subShapeNumNodes; - Vector subShapeNumObjects; - Vector details; - Vector defaultRotations; - Vector defaultTranslations; + Vector mNodes; + Vector mObjects; + Vector mObjectStates; + Vector mSubShapeFirstNode; + Vector mSubShapeFirstObject; + Vector mDetailFirstSkin; + Vector mSubShapeNumNodes; + Vector mSubShapeNumObjects; + Vector mDetails; + Vector mDefaultRotations; + Vector mDefaultTranslations; /// @} /// These are set up at load time, but memory is allocated along with loaded data /// @{ - Vector subShapeFirstTranslucentObject; - Vector meshes; + Vector mSubShapeFirstTranslucentObject; + Vector mMeshes; /// @} @@ -306,39 +306,39 @@ class TSShape /// - intraDL is at 0 when if shape were any farther away we'd be at dl+1 /// @{ - Vector alphaIn; - Vector alphaOut + Vector mAlphaIn; + Vector mAlphaOut ; /// @} /// @name Resizeable vectors /// @{ - Vector sequences; - Vector nodeRotations; - Vector nodeTranslations; - Vector nodeUniformScales; - Vector nodeAlignedScales; - Vector nodeArbitraryScaleRots; - Vector nodeArbitraryScaleFactors; - Vector groundRotations; - Vector groundTranslations; - Vector triggers; - Vector billboardDetails; - Vector detailCollisionAccelerators; - Vector names; + Vector mSequences; + Vector mNodeRotations; + Vector mNodeTranslations; + Vector mNodeUniformScales; + Vector mNodeAlignedScales; + Vector mNodeArbitraryScaleRots; + Vector mNodeArbitraryScaleFactors; + Vector mGroundRotations; + Vector mGroundTranslations; + Vector mTriggers; + Vector mBillboardDetails; + Vector mDetailCollisionAccelerators; + Vector mNames; /// @} - TSMaterialList * materialList; + TSMaterialList * mMaterialList; /// @name Bounding /// @{ - F32 radius; - F32 tubeRadius; - Point3F center; - Box3F bounds; + F32 mRadius; + F32 mTubeRadius; + Point3F mCenter; + Box3F mBounds; /// @} @@ -348,7 +348,7 @@ class TSShape S32 mSmallestVisibleDL; ///< @see mSmallestVisibleSize S32 mReadVersion; ///< File version that this shape was read from. U32 mFlags; ///< hasTranslucancy - U32 data; ///< User-defined data storage. + U32 mData; ///< User-defined data storage. /// If enabled detail selection will use the /// legacy screen error method for lod. @@ -659,34 +659,34 @@ class TSShape inline QuatF & TSShape::getRotation(const Sequence & seq, S32 keyframeNum, S32 rotNum, QuatF * quat) const { - return nodeRotations[seq.baseRotation + rotNum*seq.numKeyframes + keyframeNum].getQuatF(quat); + return mNodeRotations[seq.baseRotation + rotNum*seq.numKeyframes + keyframeNum].getQuatF(quat); } inline const Point3F & TSShape::getTranslation(const Sequence & seq, S32 keyframeNum, S32 tranNum) const { - return nodeTranslations[seq.baseTranslation + tranNum*seq.numKeyframes + keyframeNum]; + return mNodeTranslations[seq.baseTranslation + tranNum*seq.numKeyframes + keyframeNum]; } inline F32 TSShape::getUniformScale(const Sequence & seq, S32 keyframeNum, S32 scaleNum) const { - return nodeUniformScales[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum]; + return mNodeUniformScales[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum]; } inline const Point3F & TSShape::getAlignedScale(const Sequence & seq, S32 keyframeNum, S32 scaleNum) const { - return nodeAlignedScales[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum]; + return mNodeAlignedScales[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum]; } inline TSScale & TSShape::getArbitraryScale(const Sequence & seq, S32 keyframeNum, S32 scaleNum, TSScale * scale) const { - nodeArbitraryScaleRots[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum].getQuatF(&scale->mRotate); - scale->mScale = nodeArbitraryScaleFactors[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum]; + mNodeArbitraryScaleRots[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum].getQuatF(&scale->mRotate); + scale->mScale = mNodeArbitraryScaleFactors[seq.baseScale + scaleNum*seq.numKeyframes + keyframeNum]; return *scale; } inline const TSShape::ObjectState & TSShape::getObjectState(const Sequence & seq, S32 keyframeNum, S32 objectNum) const { - return objectStates[seq.baseObjectState + objectNum*seq.numKeyframes + keyframeNum]; + return mObjectStates[seq.baseObjectState + objectNum*seq.numKeyframes + keyframeNum]; } #endif diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 0590b4fe9..a77735c3b 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -482,7 +482,7 @@ bool TSShapeConstructor::writeField(StringTableEntry fieldname, const char *valu return ret; \ } \ } \ - TSShape::Node* var = var##Index < 0 ? NULL : &(mShape->nodes[var##Index]); \ + TSShape::Node* var = var##Index < 0 ? NULL : &(mShape->mNodes[var##Index]); \ TORQUE_UNUSED(var##Index); \ TORQUE_UNUSED(var) @@ -495,7 +495,7 @@ bool TSShapeConstructor::writeField(StringTableEntry fieldname, const char *valu "node '%s'", name); \ return ret; \ } \ - TSShape::Node* var = &(mShape->nodes[var##Index]); \ + TSShape::Node* var = &(mShape->mNodes[var##Index]); \ TORQUE_UNUSED(var##Index); \ TORQUE_UNUSED(var) @@ -508,7 +508,7 @@ bool TSShapeConstructor::writeField(StringTableEntry fieldname, const char *valu "object '%s'", name); \ return ret; \ } \ - TSShape::Object* var = &(mShape->objects[var##Index]); \ + TSShape::Object* var = &(mShape->mObjects[var##Index]); \ TORQUE_UNUSED(var##Index); \ TORQUE_UNUSED(var) @@ -531,7 +531,7 @@ bool TSShapeConstructor::writeField(StringTableEntry fieldname, const char *valu "sequence named '%s'", name); \ return ret; \ } \ - TSShape::Sequence* var = &(mShape->sequences[var##Index]); \ + TSShape::Sequence* var = &(mShape->mSequences[var##Index]); \ TORQUE_UNUSED(var##Index); \ TORQUE_UNUSED(var); @@ -695,7 +695,7 @@ DefineTSShapeConstructorMethod( getNodeCount, S32, (),, "%count = %this.getNodeCount();\n" "@endtsexample\n" ) { - return mShape->nodes.size(); + return mShape->mNodes.size(); }} DefineTSShapeConstructorMethod( getNodeIndex, S32, ( const char* name ),, @@ -723,8 +723,8 @@ DefineTSShapeConstructorMethod( getNodeName, const char*, ( S32 index ),, " echo(%i SPC %this.getNodeName(%i));\n" "@endtsexample\n" ) { - CHECK_INDEX_IN_RANGE( getNodeName, index, mShape->nodes.size(), "" ); - return mShape->getName( mShape->nodes[index].nameIndex ); + CHECK_INDEX_IN_RANGE( getNodeName, index, mShape->mNodes.size(), "" ); + return mShape->getName( mShape->mNodes[index].nameIndex ); }} DefineTSShapeConstructorMethod( getNodeParentName, const char*, ( const char* name ),, @@ -742,7 +742,7 @@ DefineTSShapeConstructorMethod( getNodeParentName, const char*, ( const char* na if ( node->parentIndex < 0 ) return ""; else - return mShape->getName( mShape->nodes[node->parentIndex].nameIndex ); + return mShape->getName( mShape->mNodes[node->parentIndex].nameIndex ); }} DefineTSShapeConstructorMethod( setNodeParent, bool, ( const char* name, const char* parentName ),, @@ -814,7 +814,7 @@ DefineTSShapeConstructorMethod( getNodeChildName, const char*, ( const char* nam mShape->getNodeChildren( nodeIndex, nodeChildren ); CHECK_INDEX_IN_RANGE( getNodeChildName, index, nodeChildren.size(), "" ); - return mShape->getName( mShape->nodes[nodeChildren[index]].nameIndex ); + return mShape->getName( mShape->mNodes[nodeChildren[index]].nameIndex ); }} DefineTSShapeConstructorMethod( getNodeObjectCount, S32, ( const char* name ),, @@ -852,7 +852,7 @@ DefineTSShapeConstructorMethod( getNodeObjectName, const char*, ( const char* na mShape->getNodeObjects( nodeIndex, nodeObjects ); CHECK_INDEX_IN_RANGE( getNodeObjectName, index, nodeObjects.size(), "" ); - return mShape->getName( mShape->objects[nodeObjects[index]].nameIndex ); + return mShape->getName( mShape->mObjects[nodeObjects[index]].nameIndex ); }} DefineTSShapeConstructorMethod( getNodeTransform, TransformF, ( const char* name, bool isWorld ), ( false ), @@ -884,8 +884,8 @@ DefineTSShapeConstructorMethod( getNodeTransform, TransformF, ( const char* name else { // Local transform - pos = mShape->defaultTranslations[nodeIndex]; - const Quat16& q16 = mShape->defaultRotations[nodeIndex]; + pos = mShape->mDefaultTranslations[nodeIndex]; + const Quat16& q16 = mShape->mDefaultRotations[nodeIndex]; aa.set( q16.getQuatF() ); } @@ -1067,7 +1067,7 @@ DefineTSShapeConstructorMethod( getObjectCount, S32, (),, (), 0, "%count = %this.getObjectCount();\n" "@endtsexample\n" ) { - return mShape->objects.size(); + return mShape->mObjects.size(); }} DefineTSShapeConstructorMethod( getObjectName, const char*, ( S32 index ),, @@ -1082,9 +1082,9 @@ DefineTSShapeConstructorMethod( getObjectName, const char*, ( S32 index ),, " echo( %i SPC %this.getObjectName( %i ) );\n" "@endtsexample\n" ) { - CHECK_INDEX_IN_RANGE( getObjectName, index, mShape->objects.size(), "" ); + CHECK_INDEX_IN_RANGE( getObjectName, index, mShape->mObjects.size(), "" ); - return mShape->getName( mShape->objects[index].nameIndex ); + return mShape->getName( mShape->mObjects[index].nameIndex ); }} DefineTSShapeConstructorMethod( getObjectIndex, S32, ( const char* name ),, @@ -1113,7 +1113,7 @@ DefineTSShapeConstructorMethod( getObjectNode, const char*, ( const char* name ) if ( obj->nodeIndex < 0 ) return ""; else - return mShape->getName( mShape->nodes[obj->nodeIndex].nameIndex ); + return mShape->getName( mShape->mNodes[obj->nodeIndex].nameIndex ); }} DefineTSShapeConstructorMethod( setObjectNode, bool, ( const char* objName, const char* nodeName ),, @@ -1217,7 +1217,7 @@ DefineTSShapeConstructorMethod( getMeshName, const char*, ( const char* name, S3 CHECK_INDEX_IN_RANGE( getMeshName, index, objectDetails.size(), "" ); char* returnBuffer = Con::getReturnBuffer(256); - dSprintf(returnBuffer, 256, "%s %d", name, (S32)mShape->details[objectDetails[index]].size); + dSprintf(returnBuffer, 256, "%s %d", name, (S32)mShape->mDetails[objectDetails[index]].size); return returnBuffer; }} @@ -1242,7 +1242,7 @@ DefineTSShapeConstructorMethod( getMeshSize, S32, ( const char* name, S32 index CHECK_INDEX_IN_RANGE( getMeshName, index, objectDetails.size(), -1 ); - return (S32)mShape->details[objectDetails[index]].size; + return (S32)mShape->mDetails[objectDetails[index]].size; }} DefineTSShapeConstructorMethod( setMeshSize, bool, ( const char* name, S32 size ),, @@ -1327,8 +1327,8 @@ DefineTSShapeConstructorMethod( getMeshMaterial, const char*, ( const char* name // Return the name of the first material attached to this mesh S32 matIndex = mesh->mPrimitives[0].matIndex & TSDrawPrimitive::MaterialMask; - if ((matIndex >= 0) && (matIndex < mShape->materialList->size())) - return mShape->materialList->getMaterialName( matIndex ); + if ((matIndex >= 0) && (matIndex < mShape->mMaterialList->size())) + return mShape->mMaterialList->getMaterialName( matIndex ); else return ""; }} @@ -1350,16 +1350,16 @@ DefineTSShapeConstructorMethod( setMeshMaterial, bool, ( const char* meshName, c // Check if this material is already in the shape S32 matIndex; - for ( matIndex = 0; matIndex < mShape->materialList->size(); matIndex++ ) + for ( matIndex = 0; matIndex < mShape->mMaterialList->size(); matIndex++ ) { - if ( dStrEqual( matName, mShape->materialList->getMaterialName( matIndex ) ) ) + if ( dStrEqual( matName, mShape->mMaterialList->getMaterialName( matIndex ) ) ) break; } - if ( matIndex == mShape->materialList->size() ) + if ( matIndex == mShape->mMaterialList->size() ) { // Add a new material to the shape U32 flags = TSMaterialList::S_Wrap | TSMaterialList::T_Wrap; - mShape->materialList->push_back( matName, flags ); + mShape->mMaterialList->push_back( matName, flags ); } // Set this material for all primitives in the mesh @@ -1431,7 +1431,7 @@ DefineTSShapeConstructorMethod( getBounds, Box3F, (),, "Get the bounding box for the shape.\n" "@return Bounding box \"minX minY minZ maxX maxY maxZ\"" ) { - return mShape->bounds; + return mShape->mBounds; }} DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),, @@ -1443,10 +1443,10 @@ DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),, // Set shape bounds TSShape* shape = mShape; - shape->bounds = bbox; - shape->bounds.getCenter( &shape->center ); - shape->radius = ( shape->bounds.maxExtents - shape->center ).len(); - shape->tubeRadius = shape->radius; + shape->mBounds = bbox; + shape->mBounds.getCenter( &shape->mCenter ); + shape->mRadius = ( shape->mBounds.maxExtents - shape->mCenter ).len(); + shape->mTubeRadius = shape->mRadius; ADD_TO_CHANGE_SET(); return true; @@ -1458,7 +1458,7 @@ DefineTSShapeConstructorMethod( getDetailLevelCount, S32, (),, (), 0, "Get the total number of detail levels in the shape.\n" "@return the number of detail levels in the shape\n" ) { - return mShape->details.size(); + return mShape->mDetails.size(); }} DefineTSShapeConstructorMethod( getDetailLevelName, const char*, ( S32 index ),, @@ -1473,9 +1473,9 @@ DefineTSShapeConstructorMethod( getDetailLevelName, const char*, ( S32 index ),, " echo( %i SPC %this.getDetailLevelName( %i ) );\n" "@endtsexample\n" ) { - CHECK_INDEX_IN_RANGE( getDetailLevelName, index, mShape->details.size(), "" ); + CHECK_INDEX_IN_RANGE( getDetailLevelName, index, mShape->mDetails.size(), "" ); - return mShape->getName(mShape->details[index].nameIndex); + return mShape->getName(mShape->mDetails[index].nameIndex); }} DefineTSShapeConstructorMethod( getDetailLevelSize, S32, ( S32 index),, @@ -1490,9 +1490,9 @@ DefineTSShapeConstructorMethod( getDetailLevelSize, S32, ( S32 index),, " echo( \"Detail\" @ %i @ \" has size \" @ %this.getDetailLevelSize( %i ) );\n" "@endtsexample\n" ) { - CHECK_INDEX_IN_RANGE( getDetailLevelSize, index, mShape->details.size(), 0 ); + CHECK_INDEX_IN_RANGE( getDetailLevelSize, index, mShape->mDetails.size(), 0 ); - return (S32)mShape->details[index].size; + return (S32)mShape->mDetails[index].size; }} DefineTSShapeConstructorMethod( getDetailLevelIndex, S32, ( S32 size ),, @@ -1567,9 +1567,9 @@ DefineTSShapeConstructorMethod( getImposterDetailLevel, S32, (),, (), -1, "@return imposter detail level index, or -1 if the shape does not use " "imposters.\n\n" ) { - for ( S32 i = 0; i < mShape->details.size(); i++ ) + for ( S32 i = 0; i < mShape->mDetails.size(); i++ ) { - if ( mShape->details[i].subShapeNum < 0 ) + if ( mShape->mDetails[i].subShapeNum < 0 ) return i; } return -1; @@ -1597,10 +1597,10 @@ DefineTSShapeConstructorMethod( getImposterSettings, const char*, ( S32 index ), " echo( \"Imposter settings: \" @ %this.getImposterSettings( %index ) );\n" "@endtsexample\n" ) { - CHECK_INDEX_IN_RANGE( getImposterSettings, index, mShape->details.size(), "" ); + CHECK_INDEX_IN_RANGE( getImposterSettings, index, mShape->mDetails.size(), "" ); // Return information about the detail level - const TSShape::Detail& det = mShape->details[index]; + const TSShape::Detail& det = mShape->mDetails[index]; char* returnBuffer = Con::getReturnBuffer(512); dSprintf(returnBuffer, 512, "%d\t%d\t%d\t%d\t%d\t%d\t%g", @@ -1670,7 +1670,7 @@ DefineTSShapeConstructorMethod( getSequenceCount, S32, (),, (), 0, "Get the total number of sequences in the shape.\n" "@return the number of sequences in the shape\n\n" ) { - return mShape->sequences.size(); + return mShape->mSequences.size(); }} DefineTSShapeConstructorMethod( getSequenceIndex, S32, ( const char* name),, @@ -1699,9 +1699,9 @@ DefineTSShapeConstructorMethod( getSequenceName, const char*, ( S32 index ),, " echo( %i SPC %this.getSequenceName( %i ) );\n" "@endtsexample\n" ) { - CHECK_INDEX_IN_RANGE( getSequenceName, index, mShape->sequences.size(), "" ); + CHECK_INDEX_IN_RANGE( getSequenceName, index, mShape->mSequences.size(), "" ); - return mShape->getName( mShape->sequences[index].nameIndex ); + return mShape->getName( mShape->mSequences[index].nameIndex ); }} DefineTSShapeConstructorMethod( getSequenceSource, const char*, ( const char* name ),, @@ -1789,12 +1789,12 @@ DefineTSShapeConstructorMethod( getSequenceGroundSpeed, const char*, ( const cha Point3F trans(0,0,0), rot(0,0,0); if ( seq->numGroundFrames > 0 ) { - const Point3F& p1 = mShape->groundTranslations[seq->firstGroundFrame]; - const Point3F& p2 = mShape->groundTranslations[seq->firstGroundFrame + 1]; + const Point3F& p1 = mShape->mGroundTranslations[seq->firstGroundFrame]; + const Point3F& p2 = mShape->mGroundTranslations[seq->firstGroundFrame + 1]; trans = p2 - p1; - QuatF r1 = mShape->groundRotations[seq->firstGroundFrame].getQuatF(); - QuatF r2 = mShape->groundRotations[seq->firstGroundFrame + 1].getQuatF(); + QuatF r1 = mShape->mGroundRotations[seq->firstGroundFrame].getQuatF(); + QuatF r2 = mShape->mGroundRotations[seq->firstGroundFrame + 1].getQuatF(); r2 -= r1; MatrixF mat; @@ -2032,7 +2032,7 @@ DefineTSShapeConstructorMethod( getTrigger, const char*, ( const char* name, S32 CHECK_INDEX_IN_RANGE( getTrigger, index, seq->numTriggers, "" ); - const TSShape::Trigger& trig = mShape->triggers[seq->firstTrigger + index]; + const TSShape::Trigger& trig = mShape->mTriggers[seq->firstTrigger + index]; S32 frame = trig.pos * seq->numKeyframes; S32 state = getBinLog2(trig.state & TSShape::Trigger::StateMask) + 1; if (!(trig.state & TSShape::Trigger::StateOn)) @@ -2138,9 +2138,9 @@ void TSShapeConstructor::ChangeSet::write(TSShape* shape, Stream& stream, const // Remove all __backup__ sequences (used during Shape Editing) if (shape) { - for (S32 i = 0; i < shape->sequences.size(); i++) + for (S32 i = 0; i < shape->mSequences.size(); i++) { - const char* seqName = shape->getName( shape->sequences[i].nameIndex ); + const char* seqName = shape->getName( shape->mSequences[i].nameIndex ); if ( dStrStartsWith( seqName, "__backup__" ) ) { Command cmd( "removeSequence" ); diff --git a/Engine/source/ts/tsShapeEdit.cpp b/Engine/source/ts/tsShapeEdit.cpp index 4eac3c3f6..5d4a1ce5f 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -45,8 +45,8 @@ S32 TSShape::addName(const String& name) if (index >= 0) return index; - names.push_back(StringTable->insert(name)); - return names.size()-1; + mNames.push_back(StringTable->insert(name)); + return mNames.size()-1; } void TSShape::updateSmallestVisibleDL() @@ -55,14 +55,14 @@ void TSShape::updateSmallestVisibleDL() mSmallestVisibleDL = -1; mSmallestVisibleSize = F32_MAX; F32 maxSize = 0.0f; - for (S32 i = 0; i < details.size(); i++) + for (S32 i = 0; i < mDetails.size(); i++) { - maxSize = getMax( maxSize, details[i].size ); + maxSize = getMax( maxSize, mDetails[i].size ); - if ((details[i].size >= 0) && (details[i].size < mSmallestVisibleSize)) + if ((mDetails[i].size >= 0) && (mDetails[i].size < mSmallestVisibleSize)) { mSmallestVisibleDL = i; - mSmallestVisibleSize = details[i].size; + mSmallestVisibleSize = mDetails[i].size; } } @@ -73,20 +73,20 @@ void TSShape::updateSmallestVisibleDL() F32 pixelSize = (F32)l; S32 dl = -1; - for ( U32 d=0; d < details.size(); d++ ) + for ( U32 d=0; d < mDetails.size(); d++ ) { // Break when we get to hidden detail // levels like collision shapes. - if ( details[d].size < 0 ) + if ( mDetails[d].size < 0 ) break; - if ( pixelSize > details[d].size ) + if ( pixelSize > mDetails[d].size ) { dl = d; break; } - if ( d + 1 >= details.size() || details[d+1].size < 0 ) + if ( d + 1 >= mDetails.size() || mDetails[d+1].size < 0 ) { // We've run out of details and haven't found anything? // Let's just grab this one. @@ -99,8 +99,8 @@ void TSShape::updateSmallestVisibleDL() F32 intraDL = 0; if ( dl > -1 ) { - F32 curSize = details[dl].size; - F32 nextSize = dl == 0 ? 2.0f * curSize : details[dl - 1].size; + F32 curSize = mDetails[dl].size; + F32 nextSize = dl == 0 ? 2.0f * curSize : mDetails[dl - 1].size; intraDL = mClampF( nextSize - curSize > 0.01f ? (pixelSize - curSize) / (nextSize - curSize) : 1.0f, 0, 1 ); } @@ -113,7 +113,7 @@ void TSShape::updateSmallestVisibleDL() // See setDetailFromDistance(). // mUseDetailFromScreenError = mSmallestVisibleDL >= 0 && - details.first().maxError >= 0; + mDetails.first().maxError >= 0; } S32 TSShape::addDetail(const String& dname, S32 size, S32 subShapeNum) @@ -122,20 +122,20 @@ S32 TSShape::addDetail(const String& dname, S32 size, S32 subShapeNum) // Check if this detail size has already been added S32 index; - for (index = 0; index < details.size(); index++) + for (index = 0; index < mDetails.size(); index++) { - if ((details[index].size == size) && - (details[index].subShapeNum == subShapeNum) && - (details[index].nameIndex == nameIndex)) + if ((mDetails[index].size == size) && + (mDetails[index].subShapeNum == subShapeNum) && + (mDetails[index].nameIndex == nameIndex)) return index; - if (details[index].size < size) + if (mDetails[index].size < size) break; } // Create a new detail level at the right index, so array // remains sorted by detail size (from largest to smallest) - details.insert(index); - TSShape::Detail &detail = details[index]; + mDetails.insert(index); + TSShape::Detail &detail = mDetails[index]; // Clear the detail to ensure no garbage values // are left in any vars we don't set. @@ -151,15 +151,15 @@ S32 TSShape::addDetail(const String& dname, S32 size, S32 subShapeNum) detail.polyCount = 0; // Resize alpha vectors - alphaIn.increment(); - alphaOut.increment(); + mAlphaIn.increment(); + mAlphaOut.increment(); // Fixup objectDetailNum in other detail levels - for (S32 i = index+1; i < details.size(); i++) + for (S32 i = index+1; i < mDetails.size(); i++) { - if ((details[i].subShapeNum >= 0) && - ((subShapeNum == -1) || (details[i].subShapeNum == subShapeNum))) - details[i].objectDetailNum++; + if ((mDetails[i].subShapeNum >= 0) && + ((subShapeNum == -1) || (mDetails[i].subShapeNum == subShapeNum))) + mDetails[i].objectDetailNum++; } // Update smallest visible detail @@ -179,7 +179,7 @@ S32 TSShape::addImposter(const String& cachePath, S32 size, S32 numEquatorSteps, { // Size is in use. If the detail is already an imposter, we can just change // the settings, otherwise quit - if ( details[detIndex].subShapeNum >= 0 ) + if ( mDetails[detIndex].subShapeNum >= 0 ) { Con::errorf( "TSShape::addImposter: A non-billboard detail already " "exists at size %d", size ); @@ -190,16 +190,16 @@ S32 TSShape::addImposter(const String& cachePath, S32 size, S32 numEquatorSteps, { // Size is not in use. If an imposter already exists, change its size, otherwise // create a new detail - for ( detIndex = 0; detIndex < details.size(); ++detIndex ) + for ( detIndex = 0; detIndex < mDetails.size(); ++detIndex ) { - if ( details[detIndex].subShapeNum < 0 ) + if ( mDetails[detIndex].subShapeNum < 0 ) { // Change the imposter detail size - setDetailSize( details[detIndex].size, size ); + setDetailSize( mDetails[detIndex].size, size ); break; } } - if ( detIndex == details.size() ) + if ( detIndex == mDetails.size() ) { isNewDetail = true; detIndex = addDetail( "bbDetail", size, -1 ); @@ -207,7 +207,7 @@ S32 TSShape::addImposter(const String& cachePath, S32 size, S32 numEquatorSteps, } // Now set the billboard properties. - Detail &detail = details[detIndex]; + Detail &detail = mDetails[detIndex]; // In prior to DTS version 26 we would pack the autobillboard // into this single 32bit value. This was prone to overflows @@ -228,14 +228,14 @@ S32 TSShape::addImposter(const String& cachePath, S32 size, S32 numEquatorSteps, if ( isNewDetail ) { // Add NULL meshes for this detail - for ( S32 iObj = 0; iObj < objects.size(); ++iObj ) + for ( S32 iObj = 0; iObj < mObjects.size(); ++iObj ) { - if ( detIndex < objects[iObj].numMeshes ) + if ( detIndex < mObjects[iObj].numMeshes ) { - objects[iObj].numMeshes++; - meshes.insert( objects[iObj].startMeshIndex + detIndex, NULL ); - for (S32 j = iObj + 1; j < objects.size(); ++j ) - objects[j].startMeshIndex++; + mObjects[iObj].numMeshes++; + mMeshes.insert( mObjects[iObj].startMeshIndex + detIndex, NULL ); + for (S32 j = iObj + 1; j < mObjects.size(); ++j ) + mObjects[j].startMeshIndex++; } } @@ -243,15 +243,15 @@ S32 TSShape::addImposter(const String& cachePath, S32 size, S32 numEquatorSteps, if ( GFXDevice::devicePresent() ) setupBillboardDetails( cachePath ); - while ( detailCollisionAccelerators.size() < details.size() ) - detailCollisionAccelerators.push_back( NULL ); + while ( mDetailCollisionAccelerators.size() < mDetails.size() ) + mDetailCollisionAccelerators.push_back( NULL ); } else { - if ( billboardDetails.size() && GFXDevice::devicePresent() ) + if ( mBillboardDetails.size() && GFXDevice::devicePresent() ) { - delete billboardDetails[detIndex]; - billboardDetails[detIndex] = new TSLastDetail( + delete mBillboardDetails[detIndex]; + mBillboardDetails[detIndex] = new TSLastDetail( this, cachePath, detail.bbEquatorSteps, @@ -261,7 +261,7 @@ S32 TSShape::addImposter(const String& cachePath, S32 size, S32 numEquatorSteps, detail.bbDetailLevel, detail.bbDimension ); - billboardDetails[detIndex]->update( true ); + mBillboardDetails[detIndex]->update( true ); } } @@ -272,41 +272,41 @@ bool TSShape::removeImposter() { // Find the imposter detail level S32 detIndex; - for ( detIndex = 0; detIndex < details.size(); ++detIndex ) + for ( detIndex = 0; detIndex < mDetails.size(); ++detIndex ) { - if ( details[detIndex].subShapeNum < 0 ) + if ( mDetails[detIndex].subShapeNum < 0 ) break; } - if ( detIndex == details.size() ) + if ( detIndex == mDetails.size() ) { Con::errorf( "TSShape::removeImposter: No imposter detail level found in shape" ); return false; } // Remove the detail level - details.erase( detIndex ); + mDetails.erase( detIndex ); - if ( detIndex < billboardDetails.size() ) + if ( detIndex < mBillboardDetails.size() ) { // Delete old textures - TSLastDetail* bb = billboardDetails[detIndex]; + TSLastDetail* bb = mBillboardDetails[detIndex]; bb->deleteImposterCacheTextures(); - delete billboardDetails[detIndex]; + delete mBillboardDetails[detIndex]; } - billboardDetails.clear(); + mBillboardDetails.clear(); - detailCollisionAccelerators.erase( detIndex ); + mDetailCollisionAccelerators.erase( detIndex ); // Remove the (NULL) meshes from each object - for ( S32 iObj = 0; iObj < objects.size(); ++iObj ) + for ( S32 iObj = 0; iObj < mObjects.size(); ++iObj ) { - if ( detIndex < objects[iObj].numMeshes ) + if ( detIndex < mObjects[iObj].numMeshes ) { - objects[iObj].numMeshes--; - meshes.erase( objects[iObj].startMeshIndex + detIndex ); - for (S32 j = iObj + 1; j < objects.size(); ++j ) - objects[j].startMeshIndex--; + mObjects[iObj].numMeshes--; + mMeshes.erase( mObjects[iObj].startMeshIndex + detIndex ); + for (S32 j = iObj + 1; j < mObjects.size(); ++j ) + mObjects[j].startMeshIndex--; } } @@ -339,19 +339,19 @@ bool TSShape::removeName(const String& name) { // Check if the name is still in use S32 nameIndex = findName(name); - if ((findByName(nodes, nameIndex) >= 0) || - (findByName(objects, nameIndex) >= 0) || - (findByName(sequences, nameIndex) >= 0) || - (findByName(details, nameIndex) >= 0)) + if ((findByName(mNodes, nameIndex) >= 0) || + (findByName(mObjects, nameIndex) >= 0) || + (findByName(mSequences, nameIndex) >= 0) || + (findByName(mDetails, nameIndex) >= 0)) return false; // Remove the name, then update nameIndex for affected elements - names.erase(nameIndex); + mNames.erase(nameIndex); - adjustForNameRemoval(nodes, nameIndex); - adjustForNameRemoval(objects, nameIndex); - adjustForNameRemoval(sequences, nameIndex); - adjustForNameRemoval(details, nameIndex); + adjustForNameRemoval(mNodes, nameIndex); + adjustForNameRemoval(mObjects, nameIndex); + adjustForNameRemoval(mSequences, nameIndex); + adjustForNameRemoval(mDetails, nameIndex); return true; } @@ -387,22 +387,22 @@ template bool doRename(TSShape* shape, Vector& group, const String& bool TSShape::renameNode(const String& oldName, const String& newName) { - return doRename(this, nodes, oldName, newName); + return doRename(this, mNodes, oldName, newName); } bool TSShape::renameObject(const String& oldName, const String& newName) { - return doRename(this, objects, oldName, newName); + return doRename(this, mObjects, oldName, newName); } bool TSShape::renameDetail(const String& oldName, const String& newName) { - return doRename(this, details, oldName, newName); + return doRename(this, mDetails, oldName, newName); } bool TSShape::renameSequence(const String& oldName, const String& newName) { - return doRename(this, sequences, oldName, newName); + return doRename(this, mSequences, oldName, newName); } //----------------------------------------------------------------------------- @@ -410,7 +410,7 @@ bool TSShape::renameSequence(const String& oldName, const String& newName) bool TSShape::addNode(const String& name, const String& parentName, const Point3F& pos, const QuatF& rot) { // Check that adding this node would not exceed the maximum count - if (nodes.size() >= MAX_TS_SET_SIZE) + if (mNodes.size() >= MAX_TS_SET_SIZE) { Con::errorf("TSShape::addNode: Cannot add node, shape already has maximum (%d) nodes", MAX_TS_SET_SIZE); return false; @@ -437,18 +437,18 @@ bool TSShape::addNode(const String& name, const String& parentName, const Point3 // Insert node at the end of the subshape S32 subShapeIndex = (parentIndex >= 0) ? getSubShapeForNode(parentIndex) : 0; - S32 nodeIndex = subShapeNumNodes[subShapeIndex]; + S32 nodeIndex = mSubShapeNumNodes[subShapeIndex]; // Adjust subshape node indices - subShapeNumNodes[subShapeIndex]++; - for (S32 i = subShapeIndex + 1; i < subShapeFirstNode.size(); i++) - subShapeFirstNode[i]++; + mSubShapeNumNodes[subShapeIndex]++; + for (S32 i = subShapeIndex + 1; i < mSubShapeFirstNode.size(); i++) + mSubShapeFirstNode[i]++; // Update animation sequences - for (S32 iSeq = 0; iSeq < sequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < mSequences.size(); iSeq++) { // Update animation matters arrays (new node is not animated) - TSShape::Sequence& seq = sequences[iSeq]; + TSShape::Sequence& seq = mSequences[iSeq]; seq.translationMatters.insert(nodeIndex, false); seq.rotationMatters.insert(nodeIndex, false); seq.scaleMatters.insert(nodeIndex, false); @@ -461,30 +461,30 @@ bool TSShape::addNode(const String& name, const String& parentName, const Point3 node.firstChild = -1; node.firstObject = -1; node.nextSibling = -1; - nodes.insert(nodeIndex, node); + mNodes.insert(nodeIndex, node); // Insert node default translation and rotation Quat16 rot16; rot16.set(rot); - defaultTranslations.insert(nodeIndex, pos); - defaultRotations.insert(nodeIndex, rot16); + mDefaultTranslations.insert(nodeIndex, pos); + mDefaultRotations.insert(nodeIndex, rot16); // Fixup node indices - for (S32 i = 0; i < nodes.size(); i++) + for (S32 i = 0; i < mNodes.size(); i++) { - if (nodes[i].parentIndex >= nodeIndex) - nodes[i].parentIndex++; + if (mNodes[i].parentIndex >= nodeIndex) + mNodes[i].parentIndex++; } - for (S32 i = 0; i < objects.size(); i++) + for (S32 i = 0; i < mObjects.size(); i++) { - if (objects[i].nodeIndex >= nodeIndex) - objects[i].nodeIndex++; + if (mObjects[i].nodeIndex >= nodeIndex) + mObjects[i].nodeIndex++; } - for (S32 i = 0; i < meshes.size(); i++) + for (S32 i = 0; i < mMeshes.size(); i++) { - if (meshes[i] && (meshes[i]->getMeshType() == TSMesh::SkinMeshType)) + if (mMeshes[i] && (mMeshes[i]->getMeshType() == TSMesh::SkinMeshType)) { - TSSkinMesh* skin = dynamic_cast(meshes[i]); + TSSkinMesh* skin = dynamic_cast(mMeshes[i]); for (S32 j = 0; j < skin->mBatchData.nodeIndex.size(); j++) { if (skin->mBatchData.nodeIndex[j] >= nodeIndex) @@ -536,7 +536,7 @@ bool TSShape::removeNode(const String& name) return false; } - S32 nodeParentIndex = nodes[nodeIndex].parentIndex; + S32 nodeParentIndex = mNodes[nodeIndex].parentIndex; // Warn if there are objects attached to this node Vector nodeObjects; @@ -545,30 +545,30 @@ bool TSShape::removeNode(const String& name) { Con::warnf("TSShape::removeNode: Node '%s' has %d objects attached, these " "will be reassigned to the node's parent ('%s')", name.c_str(), nodeObjects.size(), - ((nodeParentIndex >= 0) ? getName(nodes[nodeParentIndex].nameIndex).c_str() : "null")); + ((nodeParentIndex >= 0) ? getName(mNodes[nodeParentIndex].nameIndex).c_str() : "null")); } // Update animation sequences - for (S32 iSeq = 0; iSeq < sequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < mSequences.size(); iSeq++) { - TSShape::Sequence& seq = sequences[iSeq]; + TSShape::Sequence& seq = mSequences[iSeq]; // Remove animated node transforms if (seq.translationMatters.test(nodeIndex)) - eraseStates(nodeTranslations, seq.translationMatters, seq.baseTranslation, seq.numKeyframes, nodeIndex); + eraseStates(mNodeTranslations, seq.translationMatters, seq.baseTranslation, seq.numKeyframes, nodeIndex); if (seq.rotationMatters.test(nodeIndex)) - eraseStates(nodeRotations, seq.rotationMatters, seq.baseRotation, seq.numKeyframes, nodeIndex); + eraseStates(mNodeRotations, seq.rotationMatters, seq.baseRotation, seq.numKeyframes, nodeIndex); if (seq.scaleMatters.test(nodeIndex)) { if (seq.flags & TSShape::ArbitraryScale) { - eraseStates(nodeArbitraryScaleRots, seq.scaleMatters, seq.baseScale, seq.numKeyframes, nodeIndex); - eraseStates(nodeArbitraryScaleFactors, seq.scaleMatters, seq.baseScale, seq.numKeyframes, nodeIndex); + eraseStates(mNodeArbitraryScaleRots, seq.scaleMatters, seq.baseScale, seq.numKeyframes, nodeIndex); + eraseStates(mNodeArbitraryScaleFactors, seq.scaleMatters, seq.baseScale, seq.numKeyframes, nodeIndex); } else if (seq.flags & TSShape::AlignedScale) - eraseStates(nodeAlignedScales, seq.scaleMatters, seq.baseScale, seq.numKeyframes, nodeIndex); + eraseStates(mNodeAlignedScales, seq.scaleMatters, seq.baseScale, seq.numKeyframes, nodeIndex); else - eraseStates(nodeUniformScales, seq.scaleMatters, seq.baseScale, seq.numKeyframes, nodeIndex); + eraseStates(mNodeUniformScales, seq.scaleMatters, seq.baseScale, seq.numKeyframes, nodeIndex); } seq.translationMatters.erase(nodeIndex); @@ -577,42 +577,42 @@ bool TSShape::removeNode(const String& name) } // Remove the node - nodes.erase(nodeIndex); - defaultTranslations.erase(nodeIndex); - defaultRotations.erase(nodeIndex); + mNodes.erase(nodeIndex); + mDefaultTranslations.erase(nodeIndex); + mDefaultRotations.erase(nodeIndex); // Adjust subshape node indices S32 subShapeIndex = getSubShapeForNode(nodeIndex); - subShapeNumNodes[subShapeIndex]--; - for (S32 i = subShapeIndex + 1; i < subShapeFirstNode.size(); i++) - subShapeFirstNode[i]--; + mSubShapeNumNodes[subShapeIndex]--; + for (S32 i = subShapeIndex + 1; i < mSubShapeFirstNode.size(); i++) + mSubShapeFirstNode[i]--; // Fixup node parent indices - for (S32 i = 0; i < nodes.size(); i++) + for (S32 i = 0; i < mNodes.size(); i++) { - if (nodes[i].parentIndex == nodeIndex) - nodes[i].parentIndex = -1; - else if (nodes[i].parentIndex > nodeIndex) - nodes[i].parentIndex--; + if (mNodes[i].parentIndex == nodeIndex) + mNodes[i].parentIndex = -1; + else if (mNodes[i].parentIndex > nodeIndex) + mNodes[i].parentIndex--; } if (nodeParentIndex > nodeIndex) nodeParentIndex--; // Fixup object node indices, and re-assign attached objects to node's parent - for (S32 i = 0; i < objects.size(); i++) + for (S32 i = 0; i < mObjects.size(); i++) { - if (objects[i].nodeIndex == nodeIndex) - objects[i].nodeIndex = nodeParentIndex; - if (objects[i].nodeIndex > nodeIndex) - objects[i].nodeIndex--; + if (mObjects[i].nodeIndex == nodeIndex) + mObjects[i].nodeIndex = nodeParentIndex; + if (mObjects[i].nodeIndex > nodeIndex) + mObjects[i].nodeIndex--; } // Fixup skin weight node indices, and re-assign weights for deleted node to its parent - for (S32 i = 0; i < meshes.size(); i++) + for (S32 i = 0; i < mMeshes.size(); i++) { - if (meshes[i] && (meshes[i]->getMeshType() == TSMesh::SkinMeshType)) + if (mMeshes[i] && (mMeshes[i]->getMeshType() == TSMesh::SkinMeshType)) { - TSSkinMesh* skin = dynamic_cast(meshes[i]); + TSSkinMesh* skin = dynamic_cast(mMeshes[i]); for (S32 j = 0; j < skin->mBatchData.nodeIndex.size(); j++) { if (skin->mBatchData.nodeIndex[j] == nodeIndex) @@ -645,8 +645,8 @@ bool TSShape::setNodeTransform(const String& name, const Point3F& pos, const Qua } // Update initial node position and rotation - defaultTranslations[nodeIndex] = pos; - defaultRotations[nodeIndex].set(rot); + mDefaultTranslations[nodeIndex] = pos; + mDefaultRotations[nodeIndex].set(rot); return true; } @@ -655,39 +655,39 @@ bool TSShape::setNodeTransform(const String& name, const Point3F& pos, const Qua S32 TSShape::addObject(const String& objName, S32 subShapeIndex) { - S32 objIndex = subShapeNumObjects[subShapeIndex]; + S32 objIndex = mSubShapeNumObjects[subShapeIndex]; // Add object to subshape - subShapeNumObjects[subShapeIndex]++; - for (S32 i = subShapeIndex + 1; i < subShapeFirstObject.size(); i++) - subShapeFirstObject[i]++; + mSubShapeNumObjects[subShapeIndex]++; + for (S32 i = subShapeIndex + 1; i < mSubShapeFirstObject.size(); i++) + mSubShapeFirstObject[i]++; TSShape::Object obj; obj.nameIndex = addName(objName); obj.nodeIndex = 0; obj.numMeshes = 0; - obj.startMeshIndex = (objIndex == 0) ? 0 : objects[objIndex-1].startMeshIndex + objects[objIndex-1].numMeshes; + obj.startMeshIndex = (objIndex == 0) ? 0 : mObjects[objIndex-1].startMeshIndex + mObjects[objIndex-1].numMeshes; obj.firstDecal = 0; obj.nextSibling = 0; - objects.insert(objIndex, obj); + mObjects.insert(objIndex, obj); // Add default object state TSShape::ObjectState state; state.frameIndex = 0; state.matFrameIndex = 0; state.vis = 1.0f; - objectStates.insert(objIndex, state); + mObjectStates.insert(objIndex, state); // Fixup sequences - for (S32 i = 0; i < sequences.size(); i++) - sequences[i].baseObjectState++; + for (S32 i = 0; i < mSequences.size(); i++) + mSequences[i].baseObjectState++; return objIndex; } void TSShape::addMeshToObject(S32 objIndex, S32 meshIndex, TSMesh* mesh) { - TSShape::Object& obj = objects[objIndex]; + TSShape::Object& obj = mObjects[objIndex]; // Pad with NULLs if required S32 oldNumMeshes = obj.numMeshes; @@ -695,13 +695,13 @@ void TSShape::addMeshToObject(S32 objIndex, S32 meshIndex, TSMesh* mesh) { for (S32 i = obj.numMeshes; i < meshIndex; i++) { - meshes.insert(obj.startMeshIndex + i, NULL); + mMeshes.insert(obj.startMeshIndex + i, NULL); obj.numMeshes++; } } // Insert the new mesh - meshes.insert(obj.startMeshIndex + meshIndex, mesh); + mMeshes.insert(obj.startMeshIndex + meshIndex, mesh); obj.numMeshes++; // Skinned meshes are not attached to any node @@ -709,26 +709,26 @@ void TSShape::addMeshToObject(S32 objIndex, S32 meshIndex, TSMesh* mesh) obj.nodeIndex = -1; // Fixup mesh indices for other objects - for (S32 i = 0; i < objects.size(); i++) + for (S32 i = 0; i < mObjects.size(); i++) { - if ((i != objIndex) && (objects[i].startMeshIndex >= obj.startMeshIndex)) - objects[i].startMeshIndex += (obj.numMeshes - oldNumMeshes); + if ((i != objIndex) && (mObjects[i].startMeshIndex >= obj.startMeshIndex)) + mObjects[i].startMeshIndex += (obj.numMeshes - oldNumMeshes); } } void TSShape::removeMeshFromObject(S32 objIndex, S32 meshIndex) { - TSShape::Object& obj = objects[objIndex]; + TSShape::Object& obj = mObjects[objIndex]; // Remove the mesh, but do not destroy it (this must be done by the caller) - meshes[obj.startMeshIndex + meshIndex] = NULL; + mMeshes[obj.startMeshIndex + meshIndex] = NULL; // Check if there are any objects remaining that have a valid mesh at this // detail size bool removeDetail = true; - for (S32 i = 0; i < objects.size(); i++) + for (S32 i = 0; i < mObjects.size(); i++) { - if ((meshIndex < objects[i].numMeshes) && meshes[objects[i].startMeshIndex + meshIndex]) + if ((meshIndex < mObjects[i].numMeshes) && mMeshes[mObjects[i].startMeshIndex + meshIndex]) { removeDetail = false; break; @@ -738,17 +738,17 @@ void TSShape::removeMeshFromObject(S32 objIndex, S32 meshIndex) // Remove detail level if possible if (removeDetail) { - for (S32 i = 0; i < objects.size(); i++) + for (S32 i = 0; i < mObjects.size(); i++) { - if (meshIndex < objects[i].numMeshes) + if (meshIndex < mObjects[i].numMeshes) { - meshes.erase(objects[i].startMeshIndex + meshIndex); - objects[i].numMeshes--; + mMeshes.erase(mObjects[i].startMeshIndex + meshIndex); + mObjects[i].numMeshes--; - for (S32 j = 0; j < objects.size(); j++) + for (S32 j = 0; j < mObjects.size(); j++) { - if (objects[j].startMeshIndex > objects[i].startMeshIndex) - objects[j].startMeshIndex--; + if (mObjects[j].startMeshIndex > mObjects[i].startMeshIndex) + mObjects[j].startMeshIndex--; } } } @@ -758,27 +758,27 @@ void TSShape::removeMeshFromObject(S32 objIndex, S32 meshIndex) for (S32 i = 0; i < validDetails.size(); i++) { - TSShape::Detail& detail = details[validDetails[i]]; + TSShape::Detail& detail = mDetails[validDetails[i]]; if (detail.objectDetailNum > meshIndex) detail.objectDetailNum--; } - details.erase(validDetails[meshIndex]); + mDetails.erase(validDetails[meshIndex]); } // Remove trailing NULL meshes from the object S32 oldNumMeshes = obj.numMeshes; - while (obj.numMeshes && !meshes[obj.startMeshIndex + obj.numMeshes - 1]) + while (obj.numMeshes && !mMeshes[obj.startMeshIndex + obj.numMeshes - 1]) { - meshes.erase(obj.startMeshIndex + obj.numMeshes - 1); + mMeshes.erase(obj.startMeshIndex + obj.numMeshes - 1); obj.numMeshes--; } // Fixup mesh indices for other objects - for (S32 i = 0; i < objects.size(); i++) + for (S32 i = 0; i < mObjects.size(); i++) { - if (objects[i].startMeshIndex > obj.startMeshIndex) - objects[i].startMeshIndex -= (oldNumMeshes - obj.numMeshes); + if (mObjects[i].startMeshIndex > obj.startMeshIndex) + mObjects[i].startMeshIndex -= (oldNumMeshes - obj.numMeshes); } } @@ -805,7 +805,7 @@ bool TSShape::setObjectNode(const String& objName, const String& nodeName) } } - objects[objIndex].nodeIndex = nodeIndex; + mObjects[objIndex].nodeIndex = nodeIndex; return true; } @@ -821,31 +821,31 @@ bool TSShape::removeObject(const String& name) } // Destroy all meshes in the object - TSShape::Object& obj = objects[objIndex]; + TSShape::Object& obj = mObjects[objIndex]; while ( obj.numMeshes ) { - destructInPlace(meshes[obj.startMeshIndex + obj.numMeshes - 1]); + destructInPlace(mMeshes[obj.startMeshIndex + obj.numMeshes - 1]); removeMeshFromObject(objIndex, obj.numMeshes - 1); } // Remove the object from the shape - objects.erase(objIndex); + mObjects.erase(objIndex); S32 subShapeIndex = getSubShapeForObject(objIndex); - subShapeNumObjects[subShapeIndex]--; - for (S32 i = subShapeIndex + 1; i < subShapeFirstObject.size(); i++) - subShapeFirstObject[i]--; + mSubShapeNumObjects[subShapeIndex]--; + for (S32 i = subShapeIndex + 1; i < mSubShapeFirstObject.size(); i++) + mSubShapeFirstObject[i]--; // Remove the object from all sequences - for (S32 i = 0; i < sequences.size(); i++) + for (S32 i = 0; i < mSequences.size(); i++) { - TSShape::Sequence& seq = sequences[i]; + TSShape::Sequence& seq = mSequences[i]; TSIntegerSet objMatters(seq.frameMatters); objMatters.overlap(seq.matFrameMatters); objMatters.overlap(seq.visMatters); if (objMatters.test(objIndex)) - eraseStates(objectStates, objMatters, seq.baseObjectState, seq.numKeyframes, objIndex); + eraseStates(mObjectStates, objMatters, seq.baseObjectState, seq.numKeyframes, objIndex); seq.frameMatters.erase(objIndex); seq.matFrameMatters.erase(objIndex); @@ -966,11 +966,11 @@ bool TSShape::addMesh(TSMesh* mesh, const String& meshName) S32 objIndex = findObject(objName); if (objIndex < 0) objIndex = addObject(objName, 0); - AssertFatal(objIndex >= 0 && objIndex < objects.size(), "Invalid object index!"); + AssertFatal(objIndex >= 0 && objIndex < mObjects.size(), "Invalid object index!"); // Determine the subshape this object belongs to S32 subShapeIndex = getSubShapeForObject(objIndex); - AssertFatal(subShapeIndex < subShapeFirstObject.size(), "Could not find subshape for object!"); + AssertFatal(subShapeIndex < mSubShapeFirstObject.size(), "Could not find subshape for object!"); // Get the existing detail levels for the subshape Vector validDetails; @@ -981,7 +981,7 @@ bool TSShape::addMesh(TSMesh* mesh, const String& meshName) bool newDetail = true; for (detIndex = 0; detIndex < validDetails.size(); detIndex++) { - const TSShape::Detail& det = details[validDetails[detIndex]]; + const TSShape::Detail& det = mDetails[validDetails[detIndex]]; if (detailSize >= det.size) { newDetail = (det.size != detailSize); @@ -1002,7 +1002,7 @@ bool TSShape::addMesh(TSMesh* mesh, const String& meshName) detailName = "detail"; S32 index = addDetail(detailName, detailSize, subShapeIndex); - details[index].objectDetailNum = detIndex; + mDetails[index].objectDetailNum = detIndex; } // Adding a new mesh or detail level is a bit tricky, since each @@ -1020,10 +1020,10 @@ bool TSShape::addMesh(TSMesh* mesh, const String& meshName) // 2 | | | 2 // Add meshes as required for each object - for (S32 i = 0; i < subShapeNumObjects[subShapeIndex]; i++) + for (S32 i = 0; i < mSubShapeNumObjects[subShapeIndex]; i++) { - S32 index = subShapeFirstObject[subShapeIndex] + i; - const TSShape::Object& obj = objects[index]; + S32 index = mSubShapeFirstObject[subShapeIndex] + i; + const TSShape::Object& obj = mObjects[index]; if (index == objIndex) { @@ -1031,9 +1031,9 @@ bool TSShape::addMesh(TSMesh* mesh, const String& meshName) // if required. if (!newDetail && (detIndex < obj.numMeshes)) { - if ( meshes[obj.startMeshIndex + detIndex] ) - destructInPlace(meshes[obj.startMeshIndex + detIndex]); - meshes[obj.startMeshIndex + detIndex] = mesh; + if ( mMeshes[obj.startMeshIndex + detIndex] ) + destructInPlace(mMeshes[obj.startMeshIndex + detIndex]); + mMeshes[obj.startMeshIndex + detIndex] = mesh; } else addMeshToObject(index, detIndex, mesh); @@ -1069,16 +1069,16 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String TSSkinMesh *srcSkin = dynamic_cast(srcMesh); // Check that the source skin is compatible with our skeleton - Vector nodeMap(srcShape->nodes.size()); - for (S32 i = 0; i < srcShape->nodes.size(); i++) - nodeMap.push_back( findNode( srcShape->getName(srcShape->nodes[i].nameIndex) ) ); + Vector nodeMap(srcShape->mNodes.size()); + for (S32 i = 0; i < srcShape->mNodes.size(); i++) + nodeMap.push_back( findNode( srcShape->getName(srcShape->mNodes[i].nameIndex) ) ); for (S32 i = 0; i < srcSkin->mBoneIndex.size(); i++) { S32 srcNode = srcSkin->mBoneIndex[i]; if (nodeMap[srcNode] == -1) { - const char* name = srcShape->getName(srcShape->nodes[srcNode].nameIndex).c_str(); + const char* name = srcShape->getName(srcShape->mNodes[srcNode].nameIndex).c_str(); Con::errorf("TSShape::addMesh: Skin is weighted to node (%s) that " "does not exist in this shape", name); return false; @@ -1109,14 +1109,14 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String { S32 drawType = (mesh->mPrimitives[i].matIndex & (~TSDrawPrimitive::MaterialMask)); S32 srcMatIndex = mesh->mPrimitives[i].matIndex & TSDrawPrimitive::MaterialMask; - const String& matName = srcShape->materialList->getMaterialName(srcMatIndex); + const String& matName = srcShape->mMaterialList->getMaterialName(srcMatIndex); // Add the material if it does not already exist - S32 destMatIndex = materialList->getMaterialNameList().find_next(matName); + S32 destMatIndex = mMaterialList->getMaterialNameList().find_next(matName); if (destMatIndex < 0) { - destMatIndex = materialList->size(); - materialList->push_back(matName, srcShape->materialList->getFlags(srcMatIndex)); + destMatIndex = mMaterialList->size(); + mMaterialList->push_back(matName, srcShape->mMaterialList->getFlags(srcMatIndex)); } mesh->mPrimitives[i].matIndex = drawType | destMatIndex; @@ -1131,15 +1131,15 @@ bool TSShape::setMeshSize(const String& meshName, S32 size) { S32 objIndex, meshIndex; if (!findMeshIndex(meshName, objIndex, meshIndex) || - !meshes[objects[objIndex].startMeshIndex + meshIndex]) + !mMeshes[mObjects[objIndex].startMeshIndex + meshIndex]) { Con::errorf("TSShape::setMeshSize: Could not find mesh '%s'", meshName.c_str()); return false; } // Remove the mesh from the object, but don't destroy it - TSShape::Object& obj = objects[objIndex]; - TSMesh* mesh = meshes[obj.startMeshIndex + meshIndex]; + TSShape::Object& obj = mObjects[objIndex]; + TSMesh* mesh = mMeshes[obj.startMeshIndex + meshIndex]; removeMeshFromObject(objIndex, meshIndex); // Add the mesh back at the new position @@ -1158,15 +1158,15 @@ bool TSShape::removeMesh(const String& meshName) { S32 objIndex, meshIndex; if (!findMeshIndex(meshName, objIndex, meshIndex) || - !meshes[objects[objIndex].startMeshIndex + meshIndex]) + !mMeshes[mObjects[objIndex].startMeshIndex + meshIndex]) { Con::errorf("TSShape::removeMesh: Could not find mesh '%s'", meshName.c_str()); return false; } // Destroy and remove the mesh - TSShape::Object& obj = objects[objIndex]; - destructInPlace(meshes[obj.startMeshIndex + meshIndex]); + TSShape::Object& obj = mObjects[objIndex]; + destructInPlace(mMeshes[obj.startMeshIndex + meshIndex]); removeMeshFromObject(objIndex, meshIndex); // Remove the object if there are no meshes left @@ -1226,20 +1226,20 @@ S32 TSShape::setDetailSize(S32 oldSize, S32 newSize) } // Remove this detail from the list - TSShape::Detail tmpDetail = details[oldIndex]; + TSShape::Detail tmpDetail = mDetails[oldIndex]; tmpDetail.size = newSize; - details.erase(oldIndex); + mDetails.erase(oldIndex); // Determine the new position for the detail (details are sorted by size) S32 newIndex = 0; - for ( newIndex = 0; newIndex < details.size(); ++newIndex ) + for ( newIndex = 0; newIndex < mDetails.size(); ++newIndex ) { - if ( newSize > details[newIndex].size ) + if ( newSize > mDetails[newIndex].size ) break; } // Add the detail at its new position - details.insert( newIndex, tmpDetail ); + mDetails.insert( newIndex, tmpDetail ); // Rename the detail so its trailing size value is correct { @@ -1253,38 +1253,38 @@ S32 TSShape::setDetailSize(S32 oldSize, S32 newSize) if ( newIndex != oldIndex ) { // Fixup details - for ( S32 iDet = 0; iDet < details.size(); iDet++ ) + for ( S32 iDet = 0; iDet < mDetails.size(); iDet++ ) { - if ( details[iDet].subShapeNum < 0 ) + if ( mDetails[iDet].subShapeNum < 0 ) { - if ( details[iDet].bbDetailLevel == oldIndex ) - details[iDet].bbDetailLevel = newIndex; + if ( mDetails[iDet].bbDetailLevel == oldIndex ) + mDetails[iDet].bbDetailLevel = newIndex; } else { - details[iDet].objectDetailNum = iDet; + mDetails[iDet].objectDetailNum = iDet; } } // Fixup Billboard details - _PadMoveAndTrim( billboardDetails, 0, billboardDetails.size(), - details.size(), oldIndex, newIndex ); + _PadMoveAndTrim( mBillboardDetails, 0, mBillboardDetails.size(), + mDetails.size(), oldIndex, newIndex ); // Now move the mesh for each object in the subshape (adding and removing // NULLs as appropriate) - for ( S32 iObj = 0; iObj < objects.size(); ++iObj ) + for ( S32 iObj = 0; iObj < mObjects.size(); ++iObj ) { - TSShape::Object& obj = objects[iObj]; - S32 oldMeshCount = meshes.size(); + TSShape::Object& obj = mObjects[iObj]; + S32 oldMeshCount = mMeshes.size(); - _PadMoveAndTrim( meshes, obj.startMeshIndex, obj.numMeshes, - details.size(), oldIndex, newIndex ); + _PadMoveAndTrim( mMeshes, obj.startMeshIndex, obj.numMeshes, + mDetails.size(), oldIndex, newIndex ); - obj.numMeshes += ( meshes.size() - oldMeshCount ); + obj.numMeshes += ( mMeshes.size() - oldMeshCount ); // Fixup startMeshIndex for remaining objects - for ( S32 j = iObj + 1; j < objects.size(); ++j ) - objects[j].startMeshIndex += ( meshes.size() - oldMeshCount ); + for ( S32 j = iObj + 1; j < mObjects.size(); ++j ) + mObjects[j].startMeshIndex += ( mMeshes.size() - oldMeshCount ); } } @@ -1301,20 +1301,20 @@ bool TSShape::removeDetail( S32 size ) { S32 dl = findDetailBySize( size ); - if ( ( dl < 0 ) || ( dl >= details.size() ) ) + if ( ( dl < 0 ) || ( dl >= mDetails.size() ) ) { Con::errorf( "TSShape::removeDetail: Invalid detail index (%d)", dl ); return false; } // Destroy and remove each mesh in the detail level - for ( S32 objIndex = objects.size()-1; objIndex >= 0; objIndex-- ) + for ( S32 objIndex = mObjects.size()-1; objIndex >= 0; objIndex-- ) { - TSShape::Object& obj = objects[objIndex]; + TSShape::Object& obj = mObjects[objIndex]; if ( dl < obj.numMeshes ) { - if ( meshes[obj.startMeshIndex + dl] ) - destructInPlace( meshes[obj.startMeshIndex + dl] ); + if ( mMeshes[obj.startMeshIndex + dl] ) + destructInPlace( mMeshes[obj.startMeshIndex + dl] ); removeMeshFromObject(objIndex, dl); // Remove the object if there are no meshes left @@ -1324,16 +1324,16 @@ bool TSShape::removeDetail( S32 size ) } // Destroy billboard detail level - if ( dl < billboardDetails.size() ) + if ( dl < mBillboardDetails.size() ) { - if ( billboardDetails[dl] ) + if ( mBillboardDetails[dl] ) { // Delete old textures - billboardDetails[dl]->deleteImposterCacheTextures(); - delete billboardDetails[dl]; + mBillboardDetails[dl]->deleteImposterCacheTextures(); + delete mBillboardDetails[dl]; } - billboardDetails.erase( dl ); + mBillboardDetails.erase( dl ); } // Update smallest visible detail @@ -1354,7 +1354,7 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, if (path.getExtension().equal("dsq", String::NoCase)) { - S32 oldSeqCount = sequences.size(); + S32 oldSeqCount = mSequences.size(); // DSQ source file char filenameBuf[1024]; @@ -1377,37 +1377,37 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, // Rename the new sequence if required (avoid rename if name is not // unique (this will be fixed up later, and we don't need 2 errors about it!) if (oldName.isEmpty()) - oldName = getName(sequences.last().nameIndex); + oldName = getName(mSequences.last().nameIndex); if (!oldName.equal(name)) { if (findSequence(name) == -1) { // Use a dummy intermediate name since we might be renaming from an // existing name (and we want to rename the right sequence!) - sequences.last().nameIndex = addName("__dummy__"); + mSequences.last().nameIndex = addName("__dummy__"); renameSequence("__dummy__", name); } } // Check that sequences have unique names bool lastSequenceRejected = false; - for (S32 i = sequences.size()-1; i >= oldSeqCount; i--) + for (S32 i = mSequences.size()-1; i >= oldSeqCount; i--) { - S32 nameIndex = (i == sequences.size()-1) ? findName(name) : sequences[i].nameIndex; + S32 nameIndex = (i == mSequences.size()-1) ? findName(name) : mSequences[i].nameIndex; S32 seqIndex = findSequence(nameIndex); if ((seqIndex != -1) && (seqIndex != i)) { Con::errorf("TSShape::addSequence: Failed to add sequence '%s' " "(name already exists)", getName(nameIndex).c_str()); - sequences[i].nameIndex = addName("__dummy__"); + mSequences[i].nameIndex = addName("__dummy__"); removeSequence("__dummy__"); - if (i == sequences.size()) + if (i == mSequences.size()) lastSequenceRejected = true; } } // @todo:Need to remove keyframes if start!=0 and end!=-1 - TSShape::Sequence& seq = sequences.last(); + TSShape::Sequence& seq = mSequences.last(); // Store information about how this sequence was created seq.sourceData.from = String::ToString("%s\t%s", filenameBuf, name.c_str()); @@ -1415,7 +1415,7 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, seq.sourceData.start = ((startFrame < 0) || (startFrame >= seq.numKeyframes)) ? 0 : startFrame; seq.sourceData.end = ((endFrame < 0) || (endFrame >= seq.numKeyframes)) ? seq.numKeyframes-1 : endFrame; - return (sequences.size() != oldSeqCount); + return (mSequences.size() != oldSeqCount); } /* Check that sequence to be added does not already exist */ @@ -1442,7 +1442,7 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, return false; } srcShape = const_cast((const TSShape*)hSrcShape); - if (!srcShape->sequences.size()) + if (!srcShape->mSequences.size()) { Con::errorf("TSShape::addSequence: Source shape '%s' does not contain any sequences", path.getFullPath().c_str()); return false; @@ -1450,7 +1450,7 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, // If no sequence name is specified, just use the first one if (oldName.isEmpty()) - oldName = srcShape->getName(srcShape->sequences[0].nameIndex); + oldName = srcShape->getName(srcShape->mSequences[0].nameIndex); } else { @@ -1467,7 +1467,7 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, } // Check keyframe range - const TSShape::Sequence* srcSeq = &srcShape->sequences[seqIndex]; + const TSShape::Sequence* srcSeq = &srcShape->mSequences[seqIndex]; if ((startFrame < 0) || (startFrame >= srcSeq->numKeyframes)) { Con::warnf("TSShape::addSequence: Start keyframe (%d) out of range (0-%d) for sequence '%s'", @@ -1484,21 +1484,21 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, } // Create array to map source nodes to our nodes - Vector nodeMap(srcShape->nodes.size()); - for (S32 i = 0; i < srcShape->nodes.size(); i++) - nodeMap.push_back(findNode(srcShape->getName(srcShape->nodes[i].nameIndex))); + Vector nodeMap(srcShape->mNodes.size()); + for (S32 i = 0; i < srcShape->mNodes.size(); i++) + nodeMap.push_back(findNode(srcShape->getName(srcShape->mNodes[i].nameIndex))); // Create array to map source objects to our objects - Vector objectMap(srcShape->objects.size()); - for (S32 i = 0; i < srcShape->objects.size(); i++) - objectMap.push_back(findObject(srcShape->getName(srcShape->objects[i].nameIndex))); + Vector objectMap(srcShape->mObjects.size()); + for (S32 i = 0; i < srcShape->mObjects.size(); i++) + objectMap.push_back(findObject(srcShape->getName(srcShape->mObjects[i].nameIndex))); // Copy the source sequence (need to do it this ugly way instead of just // using push_back since srcSeq pointer may change if copying a sequence // from inside the shape itself - sequences.increment(); - TSShape::Sequence& seq = sequences.last(); - srcSeq = &srcShape->sequences[seqIndex]; // update pointer as it may have changed! + mSequences.increment(); + TSShape::Sequence& seq = mSequences.last(); + srcSeq = &srcShape->mSequences[seqIndex]; // update pointer as it may have changed! seq = *srcSeq; seq.nameIndex = addName(name); @@ -1519,7 +1519,7 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, if (srcSeq->visMatters.test(i)) { // Check if visibility is animated within the frames to be copied - const F32 defaultVis = srcShape->objectStates[i].vis; + const F32 defaultVis = srcShape->mObjectStates[i].vis; S32 objNum = srcSeq->visMatters.count(i); for (S32 iFrame = startFrame; iFrame <= endFrame; iFrame++) { @@ -1540,8 +1540,8 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, objectStateSet.overlap(seq.matFrameMatters); objectStateSet.overlap(seq.visMatters); - seq.baseObjectState = objectStates.size(); - objectStates.increment(objectStateSet.count()*seq.numKeyframes); + seq.baseObjectState = mObjectStates.size(); + mObjectStates.increment(objectStateSet.count()*seq.numKeyframes); for (S32 i = 0; i < objectMap.size(); i++) { if (objectMap[i] < 0) @@ -1552,7 +1552,7 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, { S32 src = srcSeq->baseObjectState + srcSeq->numKeyframes * srcObjectStateSet.count(i) + startFrame; S32 dest = seq.baseObjectState + seq.numKeyframes * objectStateSet.count(objectMap[i]); - dCopyArray(&objectStates[dest], &srcShape->objectStates[src], seq.numKeyframes); + dCopyArray(&mObjectStates[dest], &srcShape->mObjectStates[src], seq.numKeyframes); } } @@ -1561,27 +1561,27 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, S32 groundBase = srcSeq->firstGroundFrame + startFrame*ratio; seq.numGroundFrames *= ratio; - seq.firstGroundFrame = groundTranslations.size(); - groundTranslations.reserve(groundTranslations.size() + seq.numGroundFrames); - groundRotations.reserve(groundRotations.size() + seq.numGroundFrames); + seq.firstGroundFrame = mGroundTranslations.size(); + mGroundTranslations.reserve(mGroundTranslations.size() + seq.numGroundFrames); + mGroundRotations.reserve(mGroundRotations.size() + seq.numGroundFrames); for (S32 i = 0; i < seq.numGroundFrames; i++) { - groundTranslations.push_back(srcShape->groundTranslations[groundBase + i]); - groundRotations.push_back(srcShape->groundRotations[groundBase + i]); + mGroundTranslations.push_back(srcShape->mGroundTranslations[groundBase + i]); + mGroundRotations.push_back(srcShape->mGroundRotations[groundBase + i]); } // Add triggers seq.numTriggers = 0; - seq.firstTrigger = triggers.size(); + seq.firstTrigger = mTriggers.size(); F32 seqStartPos = (F32)startFrame / seq.numKeyframes; F32 seqEndPos = (F32)endFrame / seq.numKeyframes; for (S32 i = 0; i < srcSeq->numTriggers; i++) { - const TSShape::Trigger& srcTrig = srcShape->triggers[srcSeq->firstTrigger + i]; + const TSShape::Trigger& srcTrig = srcShape->mTriggers[srcSeq->firstTrigger + i]; if ((srcTrig.pos >= seqStartPos) && (srcTrig.pos <= seqEndPos)) { - triggers.push_back(srcTrig); - triggers.last().pos -= seqStartPos; + mTriggers.push_back(srcTrig); + mTriggers.last().pos -= seqStartPos; seq.numTriggers++; } } @@ -1598,7 +1598,7 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, if (srcSeq->translationMatters.test(i)) { // Check if node position is animated within the frames to be copied - const Point3F& defaultTrans = srcShape->defaultTranslations[i]; + const Point3F& defaultTrans = srcShape->mDefaultTranslations[i]; S32 tranNum = srcSeq->translationMatters.count(i); for (S32 iFrame = startFrame; iFrame <= endFrame; iFrame++) { @@ -1613,7 +1613,7 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, if (srcSeq->rotationMatters.test(i)) { // Check if node rotation is animated within the frames to be copied - const QuatF defaultRot = srcShape->defaultRotations[i].getQuatF(); + const QuatF defaultRot = srcShape->mDefaultRotations[i].getQuatF(); S32 rotNum = srcSeq->rotationMatters.count(i); for (S32 iFrame = startFrame; iFrame <= endFrame; iFrame++) { @@ -1672,26 +1672,26 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, } // Resize the node transform arrays - seq.baseTranslation = nodeTranslations.size(); - nodeTranslations.increment(seq.translationMatters.count()*seq.numKeyframes); - seq.baseRotation = nodeRotations.size(); - nodeRotations.increment(seq.rotationMatters.count()*seq.numKeyframes); + seq.baseTranslation = mNodeTranslations.size(); + mNodeTranslations.increment(seq.translationMatters.count()*seq.numKeyframes); + seq.baseRotation = mNodeRotations.size(); + mNodeRotations.increment(seq.rotationMatters.count()*seq.numKeyframes); if (seq.flags & TSShape::ArbitraryScale) { S32 scaleCount = seq.scaleMatters.count(); - seq.baseScale = nodeArbitraryScaleRots.size(); - nodeArbitraryScaleRots.increment(scaleCount*seq.numKeyframes); - nodeArbitraryScaleFactors.increment(scaleCount*seq.numKeyframes); + seq.baseScale = mNodeArbitraryScaleRots.size(); + mNodeArbitraryScaleRots.increment(scaleCount*seq.numKeyframes); + mNodeArbitraryScaleFactors.increment(scaleCount*seq.numKeyframes); } else if (seq.flags & TSShape::AlignedScale) { - seq.baseScale = nodeAlignedScales.size(); - nodeAlignedScales.increment(seq.scaleMatters.count()*seq.numKeyframes); + seq.baseScale = mNodeAlignedScales.size(); + mNodeAlignedScales.increment(seq.scaleMatters.count()*seq.numKeyframes); } else { - seq.baseScale = nodeUniformScales.size(); - nodeUniformScales.increment(seq.scaleMatters.count()*seq.numKeyframes); + seq.baseScale = mNodeUniformScales.size(); + mNodeUniformScales.increment(seq.scaleMatters.count()*seq.numKeyframes); } // Add node transforms (remap from source node indices to our node indices). As @@ -1707,28 +1707,28 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, { S32 src = srcSeq->baseTranslation + srcSeq->numKeyframes * srcSeq->translationMatters.count(i) + startFrame; S32 dest = seq.baseTranslation + seq.numKeyframes * seq.translationMatters.count(nodeMap[i]); - dCopyArray(&nodeTranslations[dest], &srcShape->nodeTranslations[src], seq.numKeyframes); + dCopyArray(&mNodeTranslations[dest], &srcShape->mNodeTranslations[src], seq.numKeyframes); } - else if (padTransKeys && (defaultTranslations[nodeMap[i]] != srcShape->defaultTranslations[i])) + else if (padTransKeys && (mDefaultTranslations[nodeMap[i]] != srcShape->mDefaultTranslations[i])) { seq.translationMatters.set(nodeMap[i]); S32 dest = seq.baseTranslation + seq.numKeyframes * seq.translationMatters.count(nodeMap[i]); for (S32 j = 0; j < seq.numKeyframes; j++) - nodeTranslations.insert(dest, srcShape->defaultTranslations[i]); + mNodeTranslations.insert(dest, srcShape->mDefaultTranslations[i]); } if (seq.rotationMatters.test(nodeMap[i])) { S32 src = srcSeq->baseRotation + srcSeq->numKeyframes * srcSeq->rotationMatters.count(i) + startFrame; S32 dest = seq.baseRotation + seq.numKeyframes * seq.rotationMatters.count(nodeMap[i]); - dCopyArray(&nodeRotations[dest], &srcShape->nodeRotations[src], seq.numKeyframes); + dCopyArray(&mNodeRotations[dest], &srcShape->mNodeRotations[src], seq.numKeyframes); } - else if (padRotKeys && (defaultRotations[nodeMap[i]] != srcShape->defaultRotations[i])) + else if (padRotKeys && (mDefaultRotations[nodeMap[i]] != srcShape->mDefaultRotations[i])) { seq.rotationMatters.set(nodeMap[i]); S32 dest = seq.baseRotation + seq.numKeyframes * seq.rotationMatters.count(nodeMap[i]); for (S32 j = 0; j < seq.numKeyframes; j++) - nodeRotations.insert(dest, srcShape->defaultRotations[i]); + mNodeRotations.insert(dest, srcShape->mDefaultRotations[i]); } if (seq.scaleMatters.test(nodeMap[i])) @@ -1737,13 +1737,13 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, S32 dest = seq.baseScale + seq.numKeyframes * seq.scaleMatters.count(nodeMap[i]); if (seq.flags & TSShape::ArbitraryScale) { - dCopyArray(&nodeArbitraryScaleRots[dest], &srcShape->nodeArbitraryScaleRots[src], seq.numKeyframes); - dCopyArray(&nodeArbitraryScaleFactors[dest], &srcShape->nodeArbitraryScaleFactors[src], seq.numKeyframes); + dCopyArray(&mNodeArbitraryScaleRots[dest], &srcShape->mNodeArbitraryScaleRots[src], seq.numKeyframes); + dCopyArray(&mNodeArbitraryScaleFactors[dest], &srcShape->mNodeArbitraryScaleFactors[src], seq.numKeyframes); } else if (seq.flags & TSShape::AlignedScale) - dCopyArray(&nodeAlignedScales[dest], &srcShape->nodeAlignedScales[src], seq.numKeyframes); + dCopyArray(&mNodeAlignedScales[dest], &srcShape->mNodeAlignedScales[src], seq.numKeyframes); else - dCopyArray(&nodeUniformScales[dest], &srcShape->nodeUniformScales[src], seq.numKeyframes); + dCopyArray(&mNodeUniformScales[dest], &srcShape->mNodeUniformScales[src], seq.numKeyframes); } } @@ -1782,47 +1782,47 @@ bool TSShape::removeSequence(const String& name) return false; } - TSShape::Sequence& seq = sequences[seqIndex]; + TSShape::Sequence& seq = mSequences[seqIndex]; // Remove the node transforms for this sequence - S32 transCount = eraseStates(nodeTranslations, seq.translationMatters, seq.baseTranslation, seq.numKeyframes); - S32 rotCount = eraseStates(nodeRotations, seq.rotationMatters, seq.baseRotation, seq.numKeyframes); + S32 transCount = eraseStates(mNodeTranslations, seq.translationMatters, seq.baseTranslation, seq.numKeyframes); + S32 rotCount = eraseStates(mNodeRotations, seq.rotationMatters, seq.baseRotation, seq.numKeyframes); S32 scaleCount = 0; if (seq.flags & TSShape::ArbitraryScale) { - scaleCount = eraseStates(nodeArbitraryScaleRots, seq.scaleMatters, seq.baseScale, seq.numKeyframes); - eraseStates(nodeArbitraryScaleFactors, seq.scaleMatters, seq.baseScale, seq.numKeyframes); + scaleCount = eraseStates(mNodeArbitraryScaleRots, seq.scaleMatters, seq.baseScale, seq.numKeyframes); + eraseStates(mNodeArbitraryScaleFactors, seq.scaleMatters, seq.baseScale, seq.numKeyframes); } else if (seq.flags & TSShape::AlignedScale) - scaleCount = eraseStates(nodeAlignedScales, seq.scaleMatters, seq.baseScale, seq.numKeyframes); + scaleCount = eraseStates(mNodeAlignedScales, seq.scaleMatters, seq.baseScale, seq.numKeyframes); else - scaleCount = eraseStates(nodeUniformScales, seq.scaleMatters, seq.baseScale, seq.numKeyframes); + scaleCount = eraseStates(mNodeUniformScales, seq.scaleMatters, seq.baseScale, seq.numKeyframes); // Remove the object states for this sequence TSIntegerSet objMatters(seq.frameMatters); objMatters.overlap(seq.matFrameMatters); objMatters.overlap(seq.visMatters); - S32 objCount = eraseStates(objectStates, objMatters, seq.baseObjectState, seq.numKeyframes); + S32 objCount = eraseStates(mObjectStates, objMatters, seq.baseObjectState, seq.numKeyframes); // Remove groundframes and triggers TSIntegerSet dummy; - eraseStates(groundTranslations, dummy, seq.firstGroundFrame, seq.numGroundFrames, 0); - eraseStates(groundRotations, dummy, seq.firstGroundFrame, seq.numGroundFrames, 0); - eraseStates(triggers, dummy, seq.firstTrigger, seq.numTriggers, 0); + eraseStates(mGroundTranslations, dummy, seq.firstGroundFrame, seq.numGroundFrames, 0); + eraseStates(mGroundRotations, dummy, seq.firstGroundFrame, seq.numGroundFrames, 0); + eraseStates(mTriggers, dummy, seq.firstTrigger, seq.numTriggers, 0); // Fixup the base indices of the other sequences - for (S32 i = seqIndex + 1; i < sequences.size(); i++) + for (S32 i = seqIndex + 1; i < mSequences.size(); i++) { - sequences[i].baseTranslation -= transCount; - sequences[i].baseRotation -= rotCount; - sequences[i].baseScale -= scaleCount; - sequences[i].baseObjectState -= objCount; - sequences[i].firstGroundFrame -= seq.numGroundFrames; - sequences[i].firstTrigger -= seq.numTriggers; + mSequences[i].baseTranslation -= transCount; + mSequences[i].baseRotation -= rotCount; + mSequences[i].baseScale -= scaleCount; + mSequences[i].baseObjectState -= objCount; + mSequences[i].firstGroundFrame -= seq.numGroundFrames; + mSequences[i].firstTrigger -= seq.numTriggers; } // Remove the sequence itself - sequences.erase(seqIndex); + mSequences.erase(seqIndex); // Remove the sequence name if it is no longer in use removeName(name); @@ -1842,7 +1842,7 @@ bool TSShape::addTrigger(const String& seqName, S32 keyframe, S32 state) return false; } - TSShape::Sequence& seq = sequences[seqIndex]; + TSShape::Sequence& seq = mSequences[seqIndex]; if (keyframe >= seq.numKeyframes) { Con::errorf("TSShape::addTrigger: Keyframe out of range (0-%d for sequence '%s')", @@ -1861,14 +1861,14 @@ bool TSShape::addTrigger(const String& seqName, S32 keyframe, S32 state) { seq.firstTrigger = 0; for (S32 i = 0; i < seqIndex; i++) - seq.firstTrigger += sequences[i].numTriggers; + seq.firstTrigger += mSequences[i].numTriggers; } // Find where to insert the trigger (sorted by keyframe) S32 trigIndex; for (trigIndex = seq.firstTrigger; trigIndex < (seq.firstTrigger + seq.numTriggers); trigIndex++) { - const TSShape::Trigger& trig = triggers[trigIndex]; + const TSShape::Trigger& trig = mTriggers[trigIndex]; if ((S32)(trig.pos * seq.numKeyframes) > keyframe) break; } @@ -1877,7 +1877,7 @@ bool TSShape::addTrigger(const String& seqName, S32 keyframe, S32 state) TSShape::Trigger trig; trig.pos = (F32)keyframe / getMax(1, seq.numKeyframes-1); trig.state = state; - triggers.insert(trigIndex, trig); + mTriggers.insert(trigIndex, trig); seq.numTriggers++; // set invert for other triggers if needed @@ -1886,16 +1886,16 @@ bool TSShape::addTrigger(const String& seqName, S32 keyframe, S32 state) U32 offTrigger = (trig.state & TSShape::Trigger::StateMask); for (S32 i = 0; i < seq.numTriggers; i++) { - if (triggers[seq.firstTrigger + i].state & offTrigger) - triggers[seq.firstTrigger + i].state |= TSShape::Trigger::InvertOnReverse; + if (mTriggers[seq.firstTrigger + i].state & offTrigger) + mTriggers[seq.firstTrigger + i].state |= TSShape::Trigger::InvertOnReverse; } } // fixup firstTrigger index for other sequences - for (S32 i = seqIndex + 1; i < sequences.size(); i++) + for (S32 i = seqIndex + 1; i < mSequences.size(); i++) { - if (sequences[i].numTriggers > 0) - sequences[i].firstTrigger++; + if (mSequences[i].numTriggers > 0) + mSequences[i].firstTrigger++; } // set MakePath flag so triggers will be animated @@ -1914,7 +1914,7 @@ bool TSShape::removeTrigger(const String& seqName, S32 keyframe, S32 state) return false; } - TSShape::Sequence& seq = sequences[seqIndex]; + TSShape::Sequence& seq = mSequences[seqIndex]; if (keyframe >= seq.numKeyframes) { Con::errorf("TSShape::removeTrigger: Keyframe out of range (0-%d for sequence '%s')", @@ -1931,20 +1931,20 @@ bool TSShape::removeTrigger(const String& seqName, S32 keyframe, S32 state) // Find and remove the trigger for (S32 trigIndex = seq.firstTrigger; trigIndex < (seq.firstTrigger + seq.numTriggers); trigIndex++) { - TSShape::Trigger& trig = triggers[trigIndex]; + TSShape::Trigger& trig = mTriggers[trigIndex]; S32 cmpFrame = (S32)(trig.pos * (seq.numKeyframes-1) + 0.5f); S32 cmpState = trig.state & (~TSShape::Trigger::InvertOnReverse); if ((cmpFrame == keyframe) && (cmpState == state)) { - triggers.erase(trigIndex); + mTriggers.erase(trigIndex); seq.numTriggers--; // Fix up firstTrigger for other sequences - for (S32 i = seqIndex + 1; i < sequences.size(); i++) + for (S32 i = seqIndex + 1; i < mSequences.size(); i++) { - if (sequences[i].numTriggers > 0) - sequences[i].firstTrigger--; + if (mSequences[i].numTriggers > 0) + mSequences[i].firstTrigger--; } // Clear MakePath flag if no more triggers @@ -1968,19 +1968,19 @@ void TSShape::getNodeKeyframe(S32 nodeIndex, const TSShape::Sequence& seq, S32 k if (seq.rotationMatters.test(nodeIndex)) { S32 index = seq.rotationMatters.count(nodeIndex) * seq.numKeyframes + keyframe; - nodeRotations[seq.baseRotation + index].getQuatF(&rot); + mNodeRotations[seq.baseRotation + index].getQuatF(&rot); } else - defaultRotations[nodeIndex].getQuatF(&rot); + mDefaultRotations[nodeIndex].getQuatF(&rot); Point3F trans; if (seq.translationMatters.test(nodeIndex)) { S32 index = seq.translationMatters.count(nodeIndex) * seq.numKeyframes + keyframe; - trans = nodeTranslations[seq.baseTranslation + index]; + trans = mNodeTranslations[seq.baseTranslation + index]; } else - trans = defaultTranslations[nodeIndex]; + trans = mDefaultTranslations[nodeIndex]; // Set the keyframe matrix rot.setMatrix(mat); @@ -1996,7 +1996,7 @@ bool TSShape::setSequenceBlend(const String& seqName, bool blend, const String& Con::errorf("TSShape::setSequenceBlend: Could not find sequence named '%s'", seqName.c_str()); return false; } - TSShape::Sequence& seq = sequences[seqIndex]; + TSShape::Sequence& seq = mSequences[seqIndex]; // Ignore if blend flag is already correct if (seq.isBlend() == blend) @@ -2009,7 +2009,7 @@ bool TSShape::setSequenceBlend(const String& seqName, bool blend, const String& Con::errorf("TSShape::setSequenceBlend: Could not find reference sequence named '%s'", blendRefSeqName.c_str()); return false; } - TSShape::Sequence& blendRefSeq = sequences[blendRefSeqIndex]; + TSShape::Sequence& blendRefSeq = mSequences[blendRefSeqIndex]; if ((blendRefFrame < 0) || (blendRefFrame >= blendRefSeq.numKeyframes)) { @@ -2060,9 +2060,9 @@ bool TSShape::setSequenceBlend(const String& seqName, bool blend, const String& newMat.mul(refMat, oldMat); if (updateRot) - nodeRotations[rotOffset + frame].set(QuatF(newMat)); + mNodeRotations[rotOffset + frame].set(QuatF(newMat)); if (updateTrans) - nodeTranslations[transOffset + frame] = newMat.getPosition(); + mNodeTranslations[transOffset + frame] = newMat.getPosition(); } } @@ -2082,7 +2082,7 @@ bool TSShape::setSequenceGroundSpeed(const String& seqName, const Point3F& trans Con::errorf("setSequenceGroundSpeed: Could not find sequence named '%s'", seqName.c_str()); return false; } - TSShape::Sequence& seq = sequences[seqIndex]; + TSShape::Sequence& seq = mSequences[seqIndex]; // Determine how many ground-frames to generate (FPS=10, at least 1 frame) const F32 groundFrameRate = 10.0f; @@ -2094,20 +2094,20 @@ bool TSShape::setSequenceGroundSpeed(const String& seqName, const Point3F& trans { if (frameAdjust > 0) { - groundTranslations.insert(seq.firstGroundFrame); - groundRotations.insert(seq.firstGroundFrame); + mGroundTranslations.insert(seq.firstGroundFrame); + mGroundRotations.insert(seq.firstGroundFrame); } else { - groundTranslations.erase(seq.firstGroundFrame); - groundRotations.erase(seq.firstGroundFrame); + mGroundTranslations.erase(seq.firstGroundFrame); + mGroundRotations.erase(seq.firstGroundFrame); } } // Fixup ground frame indices seq.numGroundFrames += frameAdjust; - for (S32 i = seqIndex+1; i < sequences.size(); i++) - sequences[i].firstGroundFrame += frameAdjust; + for (S32 i = seqIndex+1; i < mSequences.size(); i++) + mSequences[i].firstGroundFrame += frameAdjust; // Generate the ground-frames Point3F adjTrans = trans; @@ -2121,8 +2121,8 @@ bool TSShape::setSequenceGroundSpeed(const String& seqName, const Point3F& trans QuatF groundRot(rotSpeed); for (S32 i = 0; i < seq.numGroundFrames; i++) { - groundTranslations[seq.firstGroundFrame + i] = adjTrans * (i + 1); - groundRotations[seq.firstGroundFrame + i].set(groundRot); + mGroundTranslations[seq.firstGroundFrame + i] = adjTrans * (i + 1); + mGroundRotations[seq.firstGroundFrame + i].set(groundRot); groundRot *= rotSpeed; } diff --git a/Engine/source/ts/tsShapeInstance.cpp b/Engine/source/ts/tsShapeInstance.cpp index d8722b6f9..722561c1f 100644 --- a/Engine/source/ts/tsShapeInstance.cpp +++ b/Engine/source/ts/tsShapeInstance.cpp @@ -176,7 +176,7 @@ void TSShapeInstance::buildInstanceData(TSShape * _shape, bool loadMaterials) mScaleCurrentlyAnimated = false; if(loadMaterials) - setMaterialList(mShape->materialList); + setMaterialList(mShape->mMaterialList); // set up node data initNodeTransforms(); @@ -185,7 +185,7 @@ void TSShapeInstance::buildInstanceData(TSShape * _shape, bool loadMaterials) initMeshObjects(); // set up subtree data - S32 ss = mShape->subShapeFirstNode.size(); // we have this many subtrees + S32 ss = mShape->mSubShapeFirstNode.size(); // we have this many subtrees mDirtyFlags = new U32[ss]; mGroundThread = NULL; @@ -201,18 +201,18 @@ void TSShapeInstance::buildInstanceData(TSShape * _shape, bool loadMaterials) void TSShapeInstance::initNodeTransforms() { // set up node data - S32 numNodes = mShape->nodes.size(); + S32 numNodes = mShape->mNodes.size(); mNodeTransforms.setSize(numNodes); } void TSShapeInstance::initMeshObjects() { // add objects to trees - S32 numObjects = mShape->objects.size(); + S32 numObjects = mShape->mObjects.size(); mMeshObjects.setSize(numObjects); for (S32 i=0; iobjects[i]; + const TSObject * obj = &mShape->mObjects[i]; MeshObjectInstance * objInst = &mMeshObjects[i]; // hook up the object to it's node and transforms. @@ -221,7 +221,7 @@ void TSShapeInstance::initMeshObjects() // set up list of meshes if (obj->numMeshes) - objInst->meshList = &mShape->meshes[obj->startMeshIndex]; + objInst->meshList = &mShape->mMeshes[obj->startMeshIndex]; else objInst->meshList = NULL; @@ -328,7 +328,7 @@ void TSShapeInstance::renderDebugNormals( F32 normalScalar, S32 dl ) if ( dl < 0 ) return; - AssertFatal( dl >= 0 && dl < mShape->details.size(), + AssertFatal( dl >= 0 && dl < mShape->mDetails.size(), "TSShapeInstance::renderDebugNormals() - Bad detail level!" ); static GFXStateBlockRef sb; @@ -344,13 +344,13 @@ void TSShapeInstance::renderDebugNormals( F32 normalScalar, S32 dl ) } GFX->setStateBlock( sb ); - const TSDetail *detail = &mShape->details[dl]; + const TSDetail *detail = &mShape->mDetails[dl]; const S32 ss = detail->subShapeNum; if ( ss < 0 ) return; - const S32 start = mShape->subShapeFirstObject[ss]; - const S32 end = start + mShape->subShapeNumObjects[ss]; + const S32 start = mShape->mSubShapeFirstObject[ss]; + const S32 end = start + mShape->mSubShapeNumObjects[ss]; for ( S32 i = start; i < end; i++ ) { @@ -446,8 +446,8 @@ void TSShapeInstance::render( const TSRenderState &rdata ) // NOTE: // intraDL is at 1 when if shape were any closer to us we'd be at dl-1, // intraDL is at 0 when if shape were any farther away we'd be at dl+1 - F32 alphaOut = mShape->alphaOut[mCurrentDetailLevel]; - F32 alphaIn = mShape->alphaIn[mCurrentDetailLevel]; + F32 alphaOut = mShape->mAlphaOut[mCurrentDetailLevel]; + F32 alphaIn = mShape->mAlphaIn[mCurrentDetailLevel]; F32 saveAA = mAlphaAlways ? mAlphaAlwaysValue : 1.0f; /// This first case is the single detail level render. @@ -459,7 +459,7 @@ void TSShapeInstance::render( const TSRenderState &rdata ) // alpha=1-(intraDl-alphaOut)/alphaIn // first draw next detail level - if ( mCurrentDetailLevel + 1 < mShape->details.size() && mShape->details[ mCurrentDetailLevel + 1 ].size > 0.0f ) + if ( mCurrentDetailLevel + 1 < mShape->mDetails.size() && mShape->mDetails[ mCurrentDetailLevel + 1 ].size > 0.0f ) { setAlphaAlways( saveAA * ( alphaIn + alphaOut - mCurrentIntraDetailLevel ) / alphaIn ); render( rdata, mCurrentDetailLevel + 1, 0.0f ); @@ -474,7 +474,7 @@ void TSShapeInstance::render( const TSRenderState &rdata ) // alpha = 1-intraDL/alphaOut // first draw next detail level - if ( mCurrentDetailLevel + 1 < mShape->details.size() && mShape->details[ mCurrentDetailLevel + 1 ].size > 0.0f ) + if ( mCurrentDetailLevel + 1 < mShape->mDetails.size() && mShape->mDetails[ mCurrentDetailLevel + 1 ].size > 0.0f ) render( rdata, mCurrentDetailLevel+1, 0.0f ); setAlphaAlways( saveAA * mCurrentIntraDetailLevel / alphaOut ); @@ -489,7 +489,7 @@ void TSShapeInstance::setMeshForceHidden( const char *meshName, bool hidden ) for ( ; iter != mMeshObjects.end(); iter++ ) { S32 nameIndex = iter->object->nameIndex; - const char *name = mShape->names[ nameIndex ]; + const char *name = mShape->mNames[ nameIndex ]; if ( dStrcmp( meshName, name ) == 0 ) { @@ -509,11 +509,11 @@ void TSShapeInstance::setMeshForceHidden( S32 meshIndex, bool hidden ) void TSShapeInstance::render( const TSRenderState &rdata, S32 dl, F32 intraDL ) { - AssertFatal( dl >= 0 && dl < mShape->details.size(),"TSShapeInstance::render" ); + AssertFatal( dl >= 0 && dl < mShape->mDetails.size(),"TSShapeInstance::render" ); S32 i; - const TSDetail * detail = &mShape->details[dl]; + const TSDetail * detail = &mShape->mDetails[dl]; S32 ss = detail->subShapeNum; S32 od = detail->objectDetailNum; @@ -523,14 +523,14 @@ void TSShapeInstance::render( const TSRenderState &rdata, S32 dl, F32 intraDL ) PROFILE_SCOPE( TSShapeInstance_RenderBillboards ); if ( !rdata.isNoRenderTranslucent() && ( TSLastDetail::smCanShadow || !rdata.getSceneState()->isShadowPass() ) ) - mShape->billboardDetails[ dl ]->render( rdata, mAlphaAlways ? mAlphaAlwaysValue : 1.0f ); + mShape->mBillboardDetails[ dl ]->render( rdata, mAlphaAlways ? mAlphaAlwaysValue : 1.0f ); return; } // run through the meshes - S32 start = rdata.isNoRenderNonTranslucent() ? mShape->subShapeFirstTranslucentObject[ss] : mShape->subShapeFirstObject[ss]; - S32 end = rdata.isNoRenderTranslucent() ? mShape->subShapeFirstTranslucentObject[ss] : mShape->subShapeFirstObject[ss] + mShape->subShapeNumObjects[ss]; + S32 start = rdata.isNoRenderNonTranslucent() ? mShape->mSubShapeFirstTranslucentObject[ss] : mShape->mSubShapeFirstObject[ss]; + S32 end = rdata.isNoRenderTranslucent() ? mShape->mSubShapeFirstTranslucentObject[ss] : mShape->mSubShapeFirstObject[ss] + mShape->mSubShapeNumObjects[ss]; for (i=start; iradius / scaledDistance ) * state->getWorldToScreenScale().y * pixelScale; + F32 pixelRadius = ( mShape->mRadius / scaledDistance ) * state->getWorldToScreenScale().y * pixelScale; F32 pixelSize = pixelRadius * smDetailAdjust; if ( pixelSize < smSmallestVisiblePixelSize ) { @@ -671,7 +671,7 @@ S32 TSShapeInstance::setDetailFromScreenError( F32 errorTolerance ) if ( mShape->mSmallestVisibleDL < 0 ) prevErr = 0.0f; else - prevErr = 10.0f * mShape->details[mShape->mSmallestVisibleDL].averageError * 20.0f; + prevErr = 10.0f * mShape->mDetails[mShape->mSmallestVisibleDL].averageError * 20.0f; if ( mShape->mSmallestVisibleDL < 0 || prevErr < errorTolerance ) { // draw last detail @@ -688,7 +688,7 @@ S32 TSShapeInstance::setDetailFromScreenError( F32 errorTolerance ) // we use the next highest detail (higher error) for (S32 i = mShape->mSmallestVisibleDL; i >= 0; i-- ) { - F32 err0 = 10.0f * mShape->details[i].averageError; + F32 err0 = 10.0f * mShape->mDetails[i].averageError; if ( err0 < errorTolerance ) { // ok, stop here @@ -776,10 +776,10 @@ void TSShapeInstance::prepCollision() PROFILE_SCOPE( TSShapeInstance_PrepCollision ); // Iterate over all our meshes and call prepCollision on them... - for(S32 i=0; imeshes.size(); i++) + for(S32 i=0; imMeshes.size(); i++) { - if(mShape->meshes[i]) - mShape->meshes[i]->prepOpcodeCollision(); + if(mShape->mMeshes[i]) + mShape->mMeshes[i]->prepOpcodeCollision(); } } diff --git a/Engine/source/ts/tsShapeInstance.h b/Engine/source/ts/tsShapeInstance.h index f507f7153..c526aeff0 100644 --- a/Engine/source/ts/tsShapeInstance.h +++ b/Engine/source/ts/tsShapeInstance.h @@ -531,7 +531,7 @@ protected: void deltaGround1(TSThread *, F32 start, F32 end, MatrixF& mat); /// @} - U32 getNumDetails() const { return mShape ? mShape->details.size() : 0; } + U32 getNumDetails() const { return mShape ? mShape->mDetails.size() : 0; } S32 getCurrentDetail() const { return mCurrentDetailLevel; } @@ -785,7 +785,7 @@ public: TSShapeInstance * getShapeInstance() { return mShapeInstance; } bool hasSequence() const { return sequence >= 0; } U32 getSeqIndex() const { return sequence; } - const TSSequence* getSequence() const { return &(mShapeInstance->mShape->sequences[sequence]); } + const TSSequence* getSequence() const { return &(mShapeInstance->mShape->mSequences[sequence]); } const String& getSequenceName() const { return mShapeInstance->mShape->getSequenceName(sequence); } S32 operator<(const TSThread &) const; }; diff --git a/Engine/source/ts/tsShapeOldRead.cpp b/Engine/source/ts/tsShapeOldRead.cpp index e76198de3..e46971813 100644 --- a/Engine/source/ts/tsShapeOldRead.cpp +++ b/Engine/source/ts/tsShapeOldRead.cpp @@ -33,12 +33,12 @@ void TSShape::fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * d { #if !defined(TORQUE_MAX_LIB) // this method not necessary in exporter, and a couple lines won't compile for exporter - if (!objects.address() || !meshes.address() || !numSkins) + if (!mObjects.address() || !mMeshes.address() || !numSkins) // not ready for this yet, will catch it on the next pass return; - S32 numObjects = objects.size(); - TSObject * newObjects = objects.address() + objects.size(); - TSSkinMesh ** skins = (TSSkinMesh**)&meshes[numMeshes]; + S32 numObjects = mObjects.size(); + TSObject * newObjects = mObjects.address() + mObjects.size(); + TSSkinMesh ** skins = (TSSkinMesh**)&mMeshes[numMeshes]; Vector skinsCopy; // Note: newObjects has as much free space as we need, so we just need to keep track of the // number of objects we use and then update objects.size @@ -52,7 +52,7 @@ void TSShape::fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * d while (skinsUsedwrite(sz); - for (i=0;iwrite(0); @@ -208,71 +208,71 @@ void TSShape::exportSequences(Stream * s) // on import, we will need to adjust keyframe data based on number of // nodes/objects in this shape...number of nodes can be inferred from // above, but number of objects cannot be. Write that quantity here: - s->write(objects.size()); + s->write(mObjects.size()); // write node states -- skip default node states - s->write(nodeRotations.size()); - for (i=0;iwrite(mNodeRotations.size()); + for (i=0;iwrite(nodeRotations[i].x); - s->write(nodeRotations[i].y); - s->write(nodeRotations[i].z); - s->write(nodeRotations[i].w); + s->write(mNodeRotations[i].x); + s->write(mNodeRotations[i].y); + s->write(mNodeRotations[i].z); + s->write(mNodeRotations[i].w); } - s->write(nodeTranslations.size()); - for (i=0;iwrite(mNodeTranslations.size()); + for (i=0;iwrite(nodeTranslations[i].x); - s->write(nodeTranslations[i].y); - s->write(nodeTranslations[i].z); + s->write(mNodeTranslations[i].x); + s->write(mNodeTranslations[i].y); + s->write(mNodeTranslations[i].z); } - s->write(nodeUniformScales.size()); - for (i=0;iwrite(nodeUniformScales[i]); - s->write(nodeAlignedScales.size()); - for (i=0;iwrite(mNodeUniformScales.size()); + for (i=0;iwrite(mNodeUniformScales[i]); + s->write(mNodeAlignedScales.size()); + for (i=0;iwrite(nodeAlignedScales[i].x); - s->write(nodeAlignedScales[i].y); - s->write(nodeAlignedScales[i].z); + s->write(mNodeAlignedScales[i].x); + s->write(mNodeAlignedScales[i].y); + s->write(mNodeAlignedScales[i].z); } - s->write(nodeArbitraryScaleRots.size()); - for (i=0;iwrite(mNodeArbitraryScaleRots.size()); + for (i=0;iwrite(nodeArbitraryScaleRots[i].x); - s->write(nodeArbitraryScaleRots[i].y); - s->write(nodeArbitraryScaleRots[i].z); - s->write(nodeArbitraryScaleRots[i].w); + s->write(mNodeArbitraryScaleRots[i].x); + s->write(mNodeArbitraryScaleRots[i].y); + s->write(mNodeArbitraryScaleRots[i].z); + s->write(mNodeArbitraryScaleRots[i].w); } - for (i=0;iwrite(nodeArbitraryScaleFactors[i].x); - s->write(nodeArbitraryScaleFactors[i].y); - s->write(nodeArbitraryScaleFactors[i].z); + s->write(mNodeArbitraryScaleFactors[i].x); + s->write(mNodeArbitraryScaleFactors[i].y); + s->write(mNodeArbitraryScaleFactors[i].z); } - s->write(groundTranslations.size()); - for (i=0;iwrite(mGroundTranslations.size()); + for (i=0;iwrite(groundTranslations[i].x); - s->write(groundTranslations[i].y); - s->write(groundTranslations[i].z); + s->write(mGroundTranslations[i].x); + s->write(mGroundTranslations[i].y); + s->write(mGroundTranslations[i].z); } - for (i=0;iwrite(groundRotations[i].x); - s->write(groundRotations[i].y); - s->write(groundRotations[i].z); - s->write(groundRotations[i].w); + s->write(mGroundRotations[i].x); + s->write(mGroundRotations[i].y); + s->write(mGroundRotations[i].z); + s->write(mGroundRotations[i].w); } // write object states -- legacy..no object states s->write((S32)0); // write sequences - s->write(sequences.size()); - for (i=0;iwrite(mSequences.size()); + for (i=0;iwrite(triggers.size()); - for (i=0; iwrite(mTriggers.size()); + for (i=0; iwrite(triggers[i].state); - s->write(triggers[i].pos); + s->write(mTriggers[i].state); + s->write(mTriggers[i].pos); } } @@ -303,9 +303,9 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save s->write(smVersion); // write node names - s->write( nodes.size() ); - for ( S32 i = 0; i < nodes.size(); i++ ) - writeName( s, nodes[i].nameIndex ); + s->write( mNodes.size() ); + for ( S32 i = 0; i < mNodes.size(); i++ ) + writeName( s, mNodes[i].nameIndex ); // legacy write -- write zero objects, don't pretend to support object export anymore s->write( (S32)0 ); @@ -313,26 +313,26 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save // on import, we will need to adjust keyframe data based on number of // nodes/objects in this shape...number of nodes can be inferred from // above, but number of objects cannot be. Write that quantity here: - s->write( objects.size() ); + s->write( mObjects.size() ); // write node states -- skip default node states S32 count = seq.rotationMatters.count() * seq.numKeyframes; s->write( count ); for ( S32 i = seq.baseRotation; i < seq.baseRotation + count; i++ ) { - s->write( nodeRotations[i].x ); - s->write( nodeRotations[i].y ); - s->write( nodeRotations[i].z ); - s->write( nodeRotations[i].w ); + s->write( mNodeRotations[i].x ); + s->write( mNodeRotations[i].y ); + s->write( mNodeRotations[i].z ); + s->write( mNodeRotations[i].w ); } count = seq.translationMatters.count() * seq.numKeyframes; s->write( count ); for ( S32 i = seq.baseTranslation; i < seq.baseTranslation + count; i++ ) { - s->write( nodeTranslations[i].x ); - s->write( nodeTranslations[i].y ); - s->write( nodeTranslations[i].z ); + s->write( mNodeTranslations[i].x ); + s->write( mNodeTranslations[i].y ); + s->write( mNodeTranslations[i].z ); } count = seq.scaleMatters.count() * seq.numKeyframes; @@ -340,7 +340,7 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save { s->write( count ); for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ ) - s->write( nodeUniformScales[i] ); + s->write( mNodeUniformScales[i] ); } else s->write( (S32)0 ); @@ -350,9 +350,9 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save s->write( count ); for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ ) { - s->write( nodeAlignedScales[i].x ); - s->write( nodeAlignedScales[i].y ); - s->write( nodeAlignedScales[i].z ); + s->write( mNodeAlignedScales[i].x ); + s->write( mNodeAlignedScales[i].y ); + s->write( mNodeAlignedScales[i].z ); } } else @@ -363,16 +363,16 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save s->write( count ); for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ ) { - s->write( nodeArbitraryScaleRots[i].x ); - s->write( nodeArbitraryScaleRots[i].y ); - s->write( nodeArbitraryScaleRots[i].z ); - s->write( nodeArbitraryScaleRots[i].w ); + s->write( mNodeArbitraryScaleRots[i].x ); + s->write( mNodeArbitraryScaleRots[i].y ); + s->write( mNodeArbitraryScaleRots[i].z ); + s->write( mNodeArbitraryScaleRots[i].w ); } for ( S32 i = seq.baseScale; i < seq.baseScale + count; i++ ) { - s->write( nodeArbitraryScaleFactors[i].x ); - s->write( nodeArbitraryScaleFactors[i].y ); - s->write( nodeArbitraryScaleFactors[i].z ); + s->write( mNodeArbitraryScaleFactors[i].x ); + s->write( mNodeArbitraryScaleFactors[i].y ); + s->write( mNodeArbitraryScaleFactors[i].z ); } } else @@ -381,16 +381,16 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save s->write( seq.numGroundFrames ); for ( S32 i = seq.firstGroundFrame; i < seq.firstGroundFrame + seq.numGroundFrames; i++ ) { - s->write( groundTranslations[i].x ); - s->write( groundTranslations[i].y ); - s->write( groundTranslations[i].z ); + s->write( mGroundTranslations[i].x ); + s->write( mGroundTranslations[i].y ); + s->write( mGroundTranslations[i].z ); } for ( S32 i = seq.firstGroundFrame; i < seq.firstGroundFrame + seq.numGroundFrames; i++ ) { - s->write( groundRotations[i].x ); - s->write( groundRotations[i].y ); - s->write( groundRotations[i].z ); - s->write( groundRotations[i].w ); + s->write( mGroundRotations[i].x ); + s->write( mGroundRotations[i].y ); + s->write( mGroundRotations[i].z ); + s->write( mGroundRotations[i].w ); } // write object states -- legacy..no object states @@ -417,8 +417,8 @@ void TSShape::exportSequence(Stream * s, const TSShape::Sequence& seq, bool save s->write( seq.numTriggers ); for ( S32 i = seq.firstTrigger; i < seq.firstTrigger + seq.numTriggers; i++ ) { - s->write( triggers[i].state ); - s->write( triggers[i].pos ); + s->write( mTriggers[i].state ); + s->write( mTriggers[i].pos ); } smVersion = currentVersion; @@ -460,7 +460,7 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) for (i=0;i remove the added node name - if (names.size() != startSize) + if (mNames.size() != startSize) { - names.decrement(); + mNames.decrement(); - if (names.size() != startSize) - Con::errorf(ConsoleLogEntry::General, "TSShape::importSequence: failed to remove unused node correctly for dsq %s.", names[nameIndex].c_str(), sequencePath.c_str()); + if (mNames.size() != startSize) + Con::errorf(ConsoleLogEntry::General, "TSShape::importSequence: failed to remove unused node correctly for dsq %s.", mNames[nameIndex].c_str(), sequencePath.c_str()); } } } @@ -487,9 +487,9 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) s->read(&oldShapeNumObjects); // adjust all the new keyframes - S32 adjNodeRots = smReadVersion<22 ? nodeRotations.size() - nodeMap.size() : nodeRotations.size(); - S32 adjNodeTrans = smReadVersion<22 ? nodeTranslations.size() - nodeMap.size() : nodeTranslations.size(); - S32 adjGroundStates = smReadVersion<22 ? 0 : groundTranslations.size(); // groundTrans==groundRot + S32 adjNodeRots = smReadVersion<22 ? mNodeRotations.size() - nodeMap.size() : mNodeRotations.size(); + S32 adjNodeTrans = smReadVersion<22 ? mNodeTranslations.size() - nodeMap.size() : mNodeTranslations.size(); + S32 adjGroundStates = smReadVersion<22 ? 0 : mGroundTranslations.size(); // groundTrans==groundRot // Read the node states into temporary vectors, then use the // nodeMap to discard unused transforms and map others to our nodes @@ -551,21 +551,21 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) // ground transforms can be read directly into the shape (none will be // discarded) s->read(&sz); - S32 oldSz = groundTranslations.size(); - groundTranslations.setSize(sz+oldSz); + S32 oldSz = mGroundTranslations.size(); + mGroundTranslations.setSize(sz+oldSz); for (i=oldSz;iread(&groundTranslations[i].x); - s->read(&groundTranslations[i].y); - s->read(&groundTranslations[i].z); + s->read(&mGroundTranslations[i].x); + s->read(&mGroundTranslations[i].y); + s->read(&mGroundTranslations[i].z); } - groundRotations.setSize(sz+oldSz); + mGroundRotations.setSize(sz+oldSz); for (i=oldSz;iread(&groundRotations[i].x); - s->read(&groundRotations[i].y); - s->read(&groundRotations[i].z); - s->read(&groundRotations[i].w); + s->read(&mGroundRotations[i].x); + s->read(&mGroundRotations[i].y); + s->read(&mGroundRotations[i].z); + s->read(&mGroundRotations[i].w); } } else @@ -590,28 +590,28 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) // read sequences s->read(&sz); - S32 startSeqNum = sequences.size(); + S32 startSeqNum = mSequences.size(); for (i=0;i 21) { if (seq.animatesUniformScale()) - seq.baseScale = nodeUniformScales.size(); + seq.baseScale = mNodeUniformScales.size(); else if (seq.animatesAlignedScale()) - seq.baseScale = nodeAlignedScales.size(); + seq.baseScale = mNodeAlignedScales.size(); else if (seq.animatesArbitraryScale()) - seq.baseScale = nodeArbitraryScaleFactors.size(); + seq.baseScale = mNodeArbitraryScaleFactors.size(); } // remap the node matters arrays @@ -633,18 +633,18 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) } // resize node transform arrays - nodeTranslations.increment(newTransMembership.count() * seq.numKeyframes); - nodeRotations.increment(newRotMembership.count() * seq.numKeyframes); + mNodeTranslations.increment(newTransMembership.count() * seq.numKeyframes); + mNodeRotations.increment(newRotMembership.count() * seq.numKeyframes); if (seq.flags & TSShape::ArbitraryScale) { S32 scaleCount = newScaleMembership.count() * seq.numKeyframes; - nodeArbitraryScaleRots.increment(scaleCount); - nodeArbitraryScaleFactors.increment(scaleCount); + mNodeArbitraryScaleRots.increment(scaleCount); + mNodeArbitraryScaleFactors.increment(scaleCount); } else if (seq.flags & TSShape::AlignedScale) - nodeAlignedScales.increment(newScaleMembership.count() * seq.numKeyframes); + mNodeAlignedScales.increment(newScaleMembership.count() * seq.numKeyframes); else - nodeUniformScales.increment(newScaleMembership.count() * seq.numKeyframes); + mNodeUniformScales.increment(newScaleMembership.count() * seq.numKeyframes); // remap node transforms from temporary arrays for (S32 j = 0; j < nodeMap.size(); j++) @@ -656,13 +656,13 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) { S32 src = seq.numKeyframes * seq.translationMatters.count(j); S32 dest = seq.baseTranslation + seq.numKeyframes * newTransMembership.count(nodeMap[j]); - dCopyArray(&nodeTranslations[dest], &seqTranslations[src], seq.numKeyframes); + dCopyArray(&mNodeTranslations[dest], &seqTranslations[src], seq.numKeyframes); } if (newRotMembership.test(nodeMap[j])) { S32 src = seq.numKeyframes * seq.rotationMatters.count(j); S32 dest = seq.baseRotation + seq.numKeyframes * newRotMembership.count(nodeMap[j]); - dCopyArray(&nodeRotations[dest], &seqRotations[src], seq.numKeyframes); + dCopyArray(&mNodeRotations[dest], &seqRotations[src], seq.numKeyframes); } if (newScaleMembership.test(nodeMap[j])) { @@ -670,13 +670,13 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) S32 dest = seq.baseScale + seq.numKeyframes * newScaleMembership.count(nodeMap[j]); if (seq.flags & TSShape::ArbitraryScale) { - dCopyArray(&nodeArbitraryScaleRots[dest], &seqArbitraryScaleRots[src], seq.numKeyframes); - dCopyArray(&nodeArbitraryScaleFactors[dest], &seqArbitraryScaleFactors[src], seq.numKeyframes); + dCopyArray(&mNodeArbitraryScaleRots[dest], &seqArbitraryScaleRots[src], seq.numKeyframes); + dCopyArray(&mNodeArbitraryScaleFactors[dest], &seqArbitraryScaleFactors[src], seq.numKeyframes); } else if (seq.flags & TSShape::AlignedScale) - dCopyArray(&nodeAlignedScales[dest], &seqAlignedScales[src], seq.numKeyframes); + dCopyArray(&mNodeAlignedScales[dest], &seqAlignedScales[src], seq.numKeyframes); else - dCopyArray(&nodeUniformScales[dest], &seqUniformScales[src], seq.numKeyframes); + dCopyArray(&mNodeUniformScales[dest], &seqUniformScales[src], seq.numKeyframes); } } @@ -685,7 +685,7 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) seq.scaleMatters = newScaleMembership; // adjust trigger numbers...we'll read triggers after sequences... - seq.firstTrigger += triggers.size(); + seq.firstTrigger += mTriggers.size(); // finally, adjust ground transform's nodes states seq.firstGroundFrame += adjGroundStates; @@ -693,30 +693,30 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) if (smReadVersion<22) { - for (i=startSeqNum; iread(&sz); - triggers.setSize(oldSz+sz); + mTriggers.setSize(oldSz+sz); for (S32 i=0; iread(&triggers[i+oldSz].state); - s->read(&triggers[i+oldSz].pos); + s->read(&mTriggers[i+oldSz].state); + s->read(&mTriggers[i+oldSz].pos); } if (smInitOnRead) @@ -846,7 +846,7 @@ void TSShape::writeName(Stream * s, S32 nameIndex) { const char * name = ""; if (nameIndex>=0) - name = names[nameIndex]; + name = mNames[nameIndex]; S32 sz = (S32)dStrlen(name); s->write(sz); if (sz) @@ -876,9 +876,9 @@ S32 TSShape::readName(Stream * s, bool addName) if (nameIndex<0 && addName) { - nameIndex = names.size(); - names.increment(); - names.last() = buffer; + nameIndex = mNames.size(); + mNames.increment(); + mNames.last() = buffer; } } diff --git a/Engine/source/ts/tsThread.cpp b/Engine/source/ts/tsThread.cpp index 7cb543c9e..03a82f40d 100644 --- a/Engine/source/ts/tsThread.cpp +++ b/Engine/source/ts/tsThread.cpp @@ -139,8 +139,8 @@ void TSThread::getGround(F32 t, MatrixF * pMat) // assumed to be ident. and not found in the list. if (frame) { - p1 = &mShapeInstance->mShape->groundTranslations[getSequence()->firstGroundFrame + frame - 1]; - q1 = &mShapeInstance->mShape->groundRotations[getSequence()->firstGroundFrame + frame - 1].getQuatF(&rot1); + p1 = &mShapeInstance->mShape->mGroundTranslations[getSequence()->firstGroundFrame + frame - 1]; + q1 = &mShapeInstance->mShape->mGroundRotations[getSequence()->firstGroundFrame + frame - 1].getQuatF(&rot1); } else { @@ -149,8 +149,8 @@ void TSThread::getGround(F32 t, MatrixF * pMat) } // similar to above, ground keyframe number 'frame+1' is actually offset by 'frame' - p2 = &mShapeInstance->mShape->groundTranslations[getSequence()->firstGroundFrame + frame]; - q2 = &mShapeInstance->mShape->groundRotations[getSequence()->firstGroundFrame + frame].getQuatF(&rot2); + p2 = &mShapeInstance->mShape->mGroundTranslations[getSequence()->firstGroundFrame + frame]; + q2 = &mShapeInstance->mShape->mGroundRotations[getSequence()->firstGroundFrame + frame].getQuatF(&rot2); QuatF q; Point3F p; @@ -163,7 +163,7 @@ void TSThread::setSequence(S32 seq, F32 toPos) { const TSShape * shape = mShapeInstance->mShape; - AssertFatal(shape && shape->sequences.size()>seq && toPos>=0.0f && toPos<=1.0f, + AssertFatal(shape && shape->mSequences.size()>seq && toPos>=0.0f && toPos<=1.0f, "TSThread::setSequence: invalid shape handle, sequence number, or position."); mShapeInstance->clearTransition(this); @@ -287,12 +287,12 @@ void TSThread::activateTriggers(F32 a, F32 b) for (i=firstTrigger; ilastPos && a<=shape->triggers[i].pos) + if (a>lastPos && a<=shape->mTriggers[i].pos) aIndex = i; // is b between this trigger and previous one... - if (b>lastPos && b<=shape->triggers[i].pos) + if (b>lastPos && b<=shape->mTriggers[i].pos) bIndex = i; - lastPos = shape->triggers[i].pos; + lastPos = shape->mTriggers[i].pos; } // activate triggers between aIndex and bIndex (depends on direction) @@ -300,7 +300,7 @@ void TSThread::activateTriggers(F32 a, F32 b) { for (i=aIndex; itriggers[i].state; + U32 state = shape->mTriggers[i].state; bool on = (state & TSShape::Trigger::StateOn)!=0; mShapeInstance->setTriggerStateBit(state & TSShape::Trigger::StateMask, on); } @@ -309,7 +309,7 @@ void TSThread::activateTriggers(F32 a, F32 b) { for (i=aIndex-1; i>=bIndex; i--) { - U32 state = shape->triggers[i].state; + U32 state = shape->mTriggers[i].state; bool on = (state & TSShape::Trigger::StateOn)!=0; if (state & TSShape::Trigger::InvertOnReverse) on = !on; @@ -354,7 +354,7 @@ void TSThread::advancePos(F32 delta) { // make dirty what this thread changes U32 dirtyFlags = getSequence()->dirtyFlags | (transitionData.inTransition ? TSShapeInstance::TransformDirty : 0); - for (S32 i=0; igetShape()->subShapeFirstNode.size(); i++) + for (S32 i=0; igetShape()->mSubShapeFirstNode.size(); i++) mShapeInstance->mDirtyFlags[i] |= dirtyFlags; } @@ -500,7 +500,7 @@ S32 TSThread::operator<(const TSThread & th2) const TSThread * TSShapeInstance::addThread() { - if (mShape->sequences.empty()) + if (mShape->mSequences.empty()) return NULL; mThreadList.increment(); @@ -656,9 +656,9 @@ void TSShapeInstance::updateTransitions() updateTransitionNodeTransforms(transitionNodes); S32 i; - mNodeReferenceRotations.setSize(mShape->nodes.size()); - mNodeReferenceTranslations.setSize(mShape->nodes.size()); - for (i=0; inodes.size(); i++) + mNodeReferenceRotations.setSize(mShape->mNodes.size()); + mNodeReferenceTranslations.setSize(mShape->mNodes.size()); + for (i=0; imNodes.size(); i++) { if (mTransitionRotationNodes.test(i)) mNodeReferenceRotations[i].set(smNodeCurrentRotations[i]); @@ -674,8 +674,8 @@ void TSShapeInstance::updateTransitions() if (animatesUniformScale()) { - mNodeReferenceUniformScales.setSize(mShape->nodes.size()); - for (i=0; inodes.size(); i++) + mNodeReferenceUniformScales.setSize(mShape->mNodes.size()); + for (i=0; imNodes.size(); i++) { if (mTransitionScaleNodes.test(i)) mNodeReferenceUniformScales[i] = smNodeCurrentUniformScales[i]; @@ -683,8 +683,8 @@ void TSShapeInstance::updateTransitions() } else if (animatesAlignedScale()) { - mNodeReferenceScaleFactors.setSize(mShape->nodes.size()); - for (i=0; inodes.size(); i++) + mNodeReferenceScaleFactors.setSize(mShape->mNodes.size()); + for (i=0; imNodes.size(); i++) { if (mTransitionScaleNodes.test(i)) mNodeReferenceScaleFactors[i] = smNodeCurrentAlignedScales[i]; @@ -692,9 +692,9 @@ void TSShapeInstance::updateTransitions() } else { - mNodeReferenceScaleFactors.setSize(mShape->nodes.size()); - mNodeReferenceArbitraryScaleRots.setSize(mShape->nodes.size()); - for (i=0; inodes.size(); i++) + mNodeReferenceScaleFactors.setSize(mShape->mNodes.size()); + mNodeReferenceArbitraryScaleRots.setSize(mShape->mNodes.size()); + for (i=0; imNodes.size(); i++) { if (mTransitionScaleNodes.test(i)) { From 75755e42c074152742d90799d10c2c9bbcd756bb Mon Sep 17 00:00:00 2001 From: bank Date: Tue, 13 May 2014 16:15:36 +0400 Subject: [PATCH 15/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSStaticPolysoupConvex --- Engine/source/T3D/tsStatic.cpp | 38 ++++++++++++++++---------------- Engine/source/T3D/tsStatic.h | 10 ++++----- Engine/source/ts/tsCollision.cpp | 20 ++++++++--------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 74911db79..3fb399d65 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -897,31 +897,31 @@ void TSStatic::buildConvex(const Box3F& box, Convex* convex) SceneObject* TSStaticPolysoupConvex::smCurObject = NULL; TSStaticPolysoupConvex::TSStaticPolysoupConvex() -: box( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f ), - normal( 0.0f, 0.0f, 0.0f, 0.0f ), - idx( 0 ), - mesh( NULL ) +: mBox( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f ), + mNormal( 0.0f, 0.0f, 0.0f, 0.0f ), + mIdx( 0 ), + mMesh( NULL ) { mType = TSPolysoupConvexType; for ( U32 i = 0; i < 4; ++i ) { - verts[i].set( 0.0f, 0.0f, 0.0f ); + mVerts[i].set( 0.0f, 0.0f, 0.0f ); } } Point3F TSStaticPolysoupConvex::support(const VectorF& vec) const { - F32 bestDot = mDot( verts[0], vec ); + F32 bestDot = mDot( mVerts[0], vec ); - const Point3F *bestP = &verts[0]; + const Point3F *bestP = &mVerts[0]; for(S32 i=1; i<4; i++) { - F32 newD = mDot(verts[i], vec); + F32 newD = mDot(mVerts[i], vec); if(newD > bestDot) { bestDot = newD; - bestP = &verts[i]; + bestP = &mVerts[i]; } } @@ -930,7 +930,7 @@ Point3F TSStaticPolysoupConvex::support(const VectorF& vec) const Box3F TSStaticPolysoupConvex::getBoundingBox() const { - Box3F wbox = box; + Box3F wbox = mBox; wbox.minExtents.convolve( mObject->getScale() ); wbox.maxExtents.convolve( mObject->getScale() ); mObject->getTransform().mul(wbox); @@ -940,7 +940,7 @@ Box3F TSStaticPolysoupConvex::getBoundingBox() const Box3F TSStaticPolysoupConvex::getBoundingBox(const MatrixF& mat, const Point3F& scale) const { AssertISV(false, "TSStaticPolysoupConvex::getBoundingBox(m,p) - Not implemented. -- XEA"); - return box; + return mBox; } void TSStaticPolysoupConvex::getPolyList(AbstractPolyList *list) @@ -952,11 +952,11 @@ void TSStaticPolysoupConvex::getPolyList(AbstractPolyList *list) list->setObject(mObject); // Add only the original collision triangle - S32 base = list->addPoint(verts[0]); - list->addPoint(verts[2]); - list->addPoint(verts[1]); + S32 base = list->addPoint(mVerts[0]); + list->addPoint(mVerts[2]); + list->addPoint(mVerts[1]); - list->begin(0, (U32)idx ^ (U32)mesh); + list->begin(0, (U32)mIdx ^ (U32)mMesh); list->vertex(base + 2); list->vertex(base + 1); list->vertex(base + 0); @@ -972,10 +972,10 @@ void TSStaticPolysoupConvex::getFeatures(const MatrixF& mat,const VectorF& n, Co // For a tetrahedron this is pretty easy... first // convert everything into world space. Point3F tverts[4]; - mat.mulP(verts[0], &tverts[0]); - mat.mulP(verts[1], &tverts[1]); - mat.mulP(verts[2], &tverts[2]); - mat.mulP(verts[3], &tverts[3]); + mat.mulP(mVerts[0], &tverts[0]); + mat.mulP(mVerts[1], &tverts[1]); + mat.mulP(mVerts[2], &tverts[2]); + mat.mulP(mVerts[3], &tverts[3]); // points... S32 firstVert = cf->mVertexList.size(); diff --git a/Engine/source/T3D/tsStatic.h b/Engine/source/T3D/tsStatic.h index fe7113294..bac444d12 100644 --- a/Engine/source/T3D/tsStatic.h +++ b/Engine/source/T3D/tsStatic.h @@ -56,11 +56,11 @@ public: ~TSStaticPolysoupConvex() {}; public: - Box3F box; - Point3F verts[4]; - PlaneF normal; - S32 idx; - TSMesh *mesh; + Box3F mBox; + Point3F mVerts[4]; + PlaneF mNormal; + S32 mIdx; + TSMesh *mMesh; static SceneObject* smCurObject; diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index fd3b17b06..01ceaad14 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1280,10 +1280,10 @@ bool TSMesh::buildConvexOpcode( const MatrixF &meshToObjectMat, const Box3F &nod if( chunkc->getObject() != TSStaticPolysoupConvex::smCurObject ) continue; - if( chunkc->mesh != this ) + if( chunkc->mMesh != this ) continue; - if( chunkc->idx != curIdx ) + if( chunkc->mIdx != curIdx ) continue; // A match! Don't need to add it. @@ -1315,18 +1315,18 @@ bool TSMesh::buildConvexOpcode( const MatrixF &meshToObjectMat, const Box3F &nod list->registerObject( cp ); convex->addToWorkingList( cp ); - cp->mesh = this; - cp->idx = curIdx; + cp->mMesh = this; + cp->mIdx = curIdx; cp->mObject = TSStaticPolysoupConvex::smCurObject; - cp->normal = p; - cp->verts[0] = a; - cp->verts[1] = b; - cp->verts[2] = c; - cp->verts[3] = peak; + cp->mNormal = p; + cp->mVerts[0] = a; + cp->mVerts[1] = b; + cp->mVerts[2] = c; + cp->mVerts[3] = peak; // Update the bounding box. - Box3F &bounds = cp->box; + Box3F &bounds = cp->mBox; bounds.minExtents.set( F32_MAX, F32_MAX, F32_MAX ); bounds.maxExtents.set( -F32_MAX, -F32_MAX, -F32_MAX ); From a310983e49e8d1bd6df27e5beeef8bd7ef9193e0 Mon Sep 17 00:00:00 2001 From: bank Date: Tue, 13 May 2014 16:33:37 +0400 Subject: [PATCH 16/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSSortedMesh --- Engine/source/ts/tsSortedMesh.cpp | 38 +++++++++++++++---------------- Engine/source/ts/tsSortedMesh.h | 12 +++++----- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Engine/source/ts/tsSortedMesh.cpp b/Engine/source/ts/tsSortedMesh.cpp index 8a88ff319..a2f5742a0 100644 --- a/Engine/source/ts/tsSortedMesh.cpp +++ b/Engine/source/ts/tsSortedMesh.cpp @@ -80,10 +80,10 @@ bool TSSortedMesh::buildConvexHull() S32 TSSortedMesh::getNumPolys() { S32 count = 0; - S32 cIdx = !clusters.size() ? -1 : 0; + S32 cIdx = !mClusters.size() ? -1 : 0; while (cIdx>=0) { - Cluster & cluster = clusters[cIdx]; + Cluster & cluster = mClusters[cIdx]; for (S32 i=cluster.startPrimitive; i clusters; ///< All of the clusters of primitives to be drawn - Vector startCluster; ///< indexed by frame number - Vector firstVerts; ///< indexed by frame number - Vector numVerts; ///< indexed by frame number - Vector firstTVerts; ///< indexed by frame number or matFrame number, depending on which one animates (never both) + Vector mClusters; ///< All of the clusters of primitives to be drawn + Vector mStartCluster; ///< indexed by frame number + Vector mFirstVerts; ///< indexed by frame number + Vector mNumVerts; ///< indexed by frame number + Vector mFirstTVerts; ///< indexed by frame number or matFrame number, depending on which one animates (never both) /// sometimes, we want to write the depth value to the frame buffer even when object is translucent - bool alwaysWriteDepth; + bool mAlwaysWriteDepth; // render methods.. void render(S32 frame, S32 matFrame, TSMaterialList *); From bcb0b8e088e920f6a965cc70a7a67315395c6bf4 Mon Sep 17 00:00:00 2001 From: bank Date: Tue, 13 May 2014 16:44:16 +0400 Subject: [PATCH 17/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class TSThread --- Engine/source/ts/tsAnimate.cpp | 118 ++++++++-------- Engine/source/ts/tsShapeInstance.h | 30 ++-- Engine/source/ts/tsThread.cpp | 220 ++++++++++++++--------------- 3 files changed, 184 insertions(+), 184 deletions(-) diff --git a/Engine/source/ts/tsAnimate.cpp b/Engine/source/ts/tsAnimate.cpp index 4d1a51a03..da08c7f85 100644 --- a/Engine/source/ts/tsAnimate.cpp +++ b/Engine/source/ts/tsAnimate.cpp @@ -157,9 +157,9 @@ void TSShapeInstance::animateNodes(S32 ss) if (!rotBeenSet.test(nodeIndex)) { QuatF q1,q2; - mShape->getRotation(*th->getSequence(),th->keyNum1,j,&q1); - mShape->getRotation(*th->getSequence(),th->keyNum2,j,&q2); - TSTransform::interpolate(q1,q2,th->keyPos,&smNodeCurrentRotations[nodeIndex]); + mShape->getRotation(*th->getSequence(),th->mKeyNum1,j,&q1); + mShape->getRotation(*th->getSequence(),th->mKeyNum2,j,&q2); + TSTransform::interpolate(q1,q2,th->mKeyPos,&smNodeCurrentRotations[nodeIndex]); rotBeenSet.set(nodeIndex); smRotationThreads[nodeIndex] = th; } @@ -178,9 +178,9 @@ void TSShapeInstance::animateNodes(S32 ss) handleMaskedPositionNode(th,nodeIndex,j); else { - const Point3F & p1 = mShape->getTranslation(*th->getSequence(),th->keyNum1,j); - const Point3F & p2 = mShape->getTranslation(*th->getSequence(),th->keyNum2,j); - TSTransform::interpolate(p1,p2,th->keyPos,&smNodeCurrentTranslations[nodeIndex]); + const Point3F & p1 = mShape->getTranslation(*th->getSequence(),th->mKeyNum1,j); + const Point3F & p2 = mShape->getTranslation(*th->getSequence(),th->mKeyNum2,j); + TSTransform::interpolate(p1,p2,th->mKeyPos,&smNodeCurrentTranslations[nodeIndex]); smTranslationThreads[nodeIndex] = th; } tranBeenSet.set(nodeIndex); @@ -222,7 +222,7 @@ void TSShapeInstance::animateNodes(S32 ss) for (i=firstBlend; iblendDisabled) + if (th->mBlendDisabled) continue; handleBlendSequence(th,a,b); @@ -330,7 +330,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b) if (nodeIndextransitionData.inTransition ? thread : NULL; + thread = thread && thread->mTransitionData.inTransition ? thread : NULL; if (!thread) { // if not controlled by a sequence in transition then there must be @@ -338,7 +338,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b) // transition now...use that thread to control interpolation for (S32 i=0; itransitionData.oldRotationNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->rotationMatters.test(nodeIndex)) + if (mTransitionThreads[i]->mTransitionData.oldRotationNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->rotationMatters.test(nodeIndex)) { thread = mTransitionThreads[i]; break; @@ -347,7 +347,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b) AssertFatal(thread!=NULL,"TSShapeInstance::handleRotTransitionNodes (rotation)"); } QuatF tmpQ; - TSTransform::interpolate(mNodeReferenceRotations[nodeIndex].getQuatF(&tmpQ),smNodeCurrentRotations[nodeIndex],thread->transitionData.pos,&smNodeCurrentRotations[nodeIndex]); + TSTransform::interpolate(mNodeReferenceRotations[nodeIndex].getQuatF(&tmpQ),smNodeCurrentRotations[nodeIndex],thread->mTransitionData.pos,&smNodeCurrentRotations[nodeIndex]); } // then translation @@ -356,7 +356,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b) for (nodeIndex=start; nodeIndextransitionData.inTransition ? thread : NULL; + thread = thread && thread->mTransitionData.inTransition ? thread : NULL; if (!thread) { // if not controlled by a sequence in transition then there must be @@ -364,7 +364,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b) // transition now...use that thread to control interpolation for (S32 i=0; itransitionData.oldTranslationNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->translationMatters.test(nodeIndex)) + if (mTransitionThreads[i]->mTransitionData.oldTranslationNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->translationMatters.test(nodeIndex)) { thread = mTransitionThreads[i]; break; @@ -375,7 +375,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b) Point3F & p = smNodeCurrentTranslations[nodeIndex]; Point3F & p1 = mNodeReferenceTranslations[nodeIndex]; Point3F & p2 = p; - F32 k = thread->transitionData.pos; + F32 k = thread->mTransitionData.pos; p.x = p1.x + k * (p2.x-p1.x); p.y = p1.y + k * (p2.y-p1.y); p.z = p1.z + k * (p2.z-p1.z); @@ -389,7 +389,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b) for (nodeIndex=start; nodeIndextransitionData.inTransition ? thread : NULL; + thread = thread && thread->mTransitionData.inTransition ? thread : NULL; if (!thread) { // if not controlled by a sequence in transition then there must be @@ -397,7 +397,7 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b) // transition now...use that thread to control interpolation for (S32 i=0; itransitionData.oldScaleNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->scaleMatters.test(nodeIndex)) + if (mTransitionThreads[i]->mTransitionData.oldScaleNodes.test(nodeIndex) || mTransitionThreads[i]->getSequence()->scaleMatters.test(nodeIndex)) { thread = mTransitionThreads[i]; break; @@ -406,14 +406,14 @@ void TSShapeInstance::handleTransitionNodes(S32 a, S32 b) AssertFatal(thread!=NULL,"TSShapeInstance::handleTransitionNodes (scale)."); } if (animatesUniformScale()) - smNodeCurrentUniformScales[nodeIndex] += thread->transitionData.pos * (mNodeReferenceUniformScales[nodeIndex]-smNodeCurrentUniformScales[nodeIndex]); + smNodeCurrentUniformScales[nodeIndex] += thread->mTransitionData.pos * (mNodeReferenceUniformScales[nodeIndex]-smNodeCurrentUniformScales[nodeIndex]); else if (animatesAlignedScale()) - TSTransform::interpolate(mNodeReferenceScaleFactors[nodeIndex],smNodeCurrentAlignedScales[nodeIndex],thread->transitionData.pos,&smNodeCurrentAlignedScales[nodeIndex]); + TSTransform::interpolate(mNodeReferenceScaleFactors[nodeIndex],smNodeCurrentAlignedScales[nodeIndex],thread->mTransitionData.pos,&smNodeCurrentAlignedScales[nodeIndex]); else { QuatF q; - TSTransform::interpolate(mNodeReferenceScaleFactors[nodeIndex],smNodeCurrentArbitraryScales[nodeIndex].mScale,thread->transitionData.pos,&smNodeCurrentArbitraryScales[nodeIndex].mScale); - TSTransform::interpolate(mNodeReferenceArbitraryScaleRots[nodeIndex].getQuatF(&q),smNodeCurrentArbitraryScales[nodeIndex].mRotate,thread->transitionData.pos,&smNodeCurrentArbitraryScales[nodeIndex].mRotate); + TSTransform::interpolate(mNodeReferenceScaleFactors[nodeIndex],smNodeCurrentArbitraryScales[nodeIndex].mScale,thread->mTransitionData.pos,&smNodeCurrentArbitraryScales[nodeIndex].mScale); + TSTransform::interpolate(mNodeReferenceArbitraryScaleRots[nodeIndex].getQuatF(&q),smNodeCurrentArbitraryScales[nodeIndex].mRotate,thread->mTransitionData.pos,&smNodeCurrentArbitraryScales[nodeIndex].mRotate); } } } @@ -498,26 +498,26 @@ void TSShapeInstance::handleAnimatedScale(TSThread * thread, S32 a, S32 b, TSInt case 4: // uniform -> aligned case 8: // uniform -> arbitrary { - F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum1,j); - F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum2,j); - uniformScale = TSTransform::interpolate(s1,s2,thread->keyPos); + F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->mKeyNum1,j); + F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->mKeyNum2,j); + uniformScale = TSTransform::interpolate(s1,s2,thread->mKeyPos); alignedScale.set(uniformScale,uniformScale,uniformScale); break; } case 5: // aligned -> aligned case 9: // aligned -> arbitrary { - const Point3F & s1 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum1,j); - const Point3F & s2 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum2,j); - TSTransform::interpolate(s1,s2,thread->keyPos,&alignedScale); + const Point3F & s1 = mShape->getAlignedScale(*thread->getSequence(),thread->mKeyNum1,j); + const Point3F & s2 = mShape->getAlignedScale(*thread->getSequence(),thread->mKeyNum2,j); + TSTransform::interpolate(s1,s2,thread->mKeyPos,&alignedScale); break; } case 10: // arbitrary -> arbitary { TSScale s1,s2; - mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum1,j,&s1); - mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum2,j,&s2); - TSTransform::interpolate(s1,s2,thread->keyPos,&arbitraryScale); + mShape->getArbitraryScale(*thread->getSequence(),thread->mKeyNum1,j,&s1); + mShape->getArbitraryScale(*thread->getSequence(),thread->mKeyNum2,j,&s2); + TSTransform::interpolate(s1,s2,thread->mKeyPos,&arbitraryScale); break; } default: AssertFatal(0,"TSShapeInstance::handleAnimatedScale"); break; @@ -556,10 +556,10 @@ void TSShapeInstance::handleAnimatedScale(TSThread * thread, S32 a, S32 b, TSInt void TSShapeInstance::handleMaskedPositionNode(TSThread * th, S32 nodeIndex, S32 offset) { - const Point3F & p1 = mShape->getTranslation(*th->getSequence(),th->keyNum1,offset); - const Point3F & p2 = mShape->getTranslation(*th->getSequence(),th->keyNum2,offset); + const Point3F & p1 = mShape->getTranslation(*th->getSequence(),th->mKeyNum1,offset); + const Point3F & p2 = mShape->getTranslation(*th->getSequence(),th->mKeyNum2,offset); Point3F p; - TSTransform::interpolate(p1,p2,th->keyPos,&p); + TSTransform::interpolate(p1,p2,th->mKeyPos,&p); if (!mMaskPosXNodes.test(nodeIndex)) smNodeCurrentTranslations[nodeIndex].x = p.x; @@ -600,20 +600,20 @@ void TSShapeInstance::handleBlendSequence(TSThread * thread, S32 a, S32 b) if (thread->getSequence()->rotationMatters.test(nodeIndex)) { QuatF q1,q2; - mShape->getRotation(*thread->getSequence(),thread->keyNum1,jrot,&q1); - mShape->getRotation(*thread->getSequence(),thread->keyNum2,jrot,&q2); + mShape->getRotation(*thread->getSequence(),thread->mKeyNum1,jrot,&q1); + mShape->getRotation(*thread->getSequence(),thread->mKeyNum2,jrot,&q2); QuatF quat; - TSTransform::interpolate(q1,q2,thread->keyPos,&quat); + TSTransform::interpolate(q1,q2,thread->mKeyPos,&quat); TSTransform::setMatrix(quat,&mat); jrot++; } if (thread->getSequence()->translationMatters.test(nodeIndex)) { - const Point3F & p1 = mShape->getTranslation(*thread->getSequence(),thread->keyNum1,jtrans); - const Point3F & p2 = mShape->getTranslation(*thread->getSequence(),thread->keyNum2,jtrans); + const Point3F & p1 = mShape->getTranslation(*thread->getSequence(),thread->mKeyNum1,jtrans); + const Point3F & p2 = mShape->getTranslation(*thread->getSequence(),thread->mKeyNum2,jtrans); Point3F p; - TSTransform::interpolate(p1,p2,thread->keyPos,&p); + TSTransform::interpolate(p1,p2,thread->mKeyPos,&p); mat.setColumn(3,p); jtrans++; } @@ -622,26 +622,26 @@ void TSShapeInstance::handleBlendSequence(TSThread * thread, S32 a, S32 b) { if (thread->getSequence()->animatesUniformScale()) { - F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum1,jscale); - F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum2,jscale); - F32 scale = TSTransform::interpolate(s1,s2,thread->keyPos); + F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->mKeyNum1,jscale); + F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->mKeyNum2,jscale); + F32 scale = TSTransform::interpolate(s1,s2,thread->mKeyPos); TSTransform::applyScale(scale,&mat); } else if (animatesAlignedScale()) { - Point3F s1 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum1,jscale); - Point3F s2 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum2,jscale); + Point3F s1 = mShape->getAlignedScale(*thread->getSequence(),thread->mKeyNum1,jscale); + Point3F s2 = mShape->getAlignedScale(*thread->getSequence(),thread->mKeyNum2,jscale); Point3F scale; - TSTransform::interpolate(s1,s2,thread->keyPos,&scale); + TSTransform::interpolate(s1,s2,thread->mKeyPos,&scale); TSTransform::applyScale(scale,&mat); } else { TSScale s1,s2; - mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum1,jscale,&s1); - mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum2,jscale,&s2); + mShape->getArbitraryScale(*thread->getSequence(),thread->mKeyNum1,jscale,&s1); + mShape->getArbitraryScale(*thread->getSequence(),thread->mKeyNum2,jscale,&s2); TSScale scale; - TSTransform::interpolate(s1,s2,thread->keyPos,&scale); + TSTransform::interpolate(s1,s2,thread->mKeyPos,&scale); TSTransform::applyScale(scale,&mat); } jscale++; @@ -704,14 +704,14 @@ void TSShapeInstance::animateVisibility(S32 ss) { if (!beenSet.test(objectIndex) && th->getSequence()->visMatters.test(objectIndex)) { - F32 state1 = mShape->getObjectState(*th->getSequence(),th->keyNum1,j).vis; - F32 state2 = mShape->getObjectState(*th->getSequence(),th->keyNum2,j).vis; + F32 state1 = mShape->getObjectState(*th->getSequence(),th->mKeyNum1,j).vis; + F32 state2 = mShape->getObjectState(*th->getSequence(),th->mKeyNum2,j).vis; if ((state1-state2) * (state1-state2) > 0.99f) // goes from 0 to 1 -- discreet jump - mMeshObjects[objectIndex].visible = th->keyPos<0.5f ? state1 : state2; + mMeshObjects[objectIndex].visible = th->mKeyPos<0.5f ? state1 : state2; else // interpolate between keyframes when visibility change is gradual - mMeshObjects[objectIndex].visible = (1.0f-th->keyPos) * state1 + th->keyPos * state2; + mMeshObjects[objectIndex].visible = (1.0f-th->mKeyPos) * state1 + th->mKeyPos * state2; // record change so that later threads don't over-write us... beenSet.set(objectIndex); @@ -765,7 +765,7 @@ void TSShapeInstance::animateFrame(S32 ss) { if (!beenSet.test(objectIndex) && th->getSequence()->frameMatters.test(objectIndex)) { - S32 key = (th->keyPos<0.5f) ? th->keyNum1 : th->keyNum2; + S32 key = (th->mKeyPos<0.5f) ? th->mKeyNum1 : th->mKeyNum2; mMeshObjects[objectIndex].frame = mShape->getObjectState(*th->getSequence(),key,j).frameIndex; // record change so that later threads don't over-write us... @@ -820,7 +820,7 @@ void TSShapeInstance::animateMatFrame(S32 ss) { if (!beenSet.test(objectIndex) && th->getSequence()->matFrameMatters.test(objectIndex)) { - S32 key = (th->keyPos<0.5f) ? th->keyNum1 : th->keyNum2; + S32 key = (th->mKeyPos<0.5f) ? th->mKeyNum1 : th->mKeyNum2; mMeshObjects[objectIndex].matFrame = mShape->getObjectState(*th->getSequence(),key,j).matFrameIndex; // record change so that later threads don't over-write us... @@ -909,7 +909,7 @@ void TSShapeInstance::animateSubtrees(bool forceFull) void TSShapeInstance::addPath(TSThread *gt, F32 start, F32 end, MatrixF *mat) { // never get here while in transition... - AssertFatal(!gt->transitionData.inTransition,"TSShapeInstance::addPath"); + AssertFatal(!gt->mTransitionData.inTransition,"TSShapeInstance::addPath"); if (!mat) mat = &mGroundTransform; @@ -932,7 +932,7 @@ bool TSShapeInstance::initGround() for (S32 i=0; itransitionData.inTransition && th->getSequence()->numGroundFrames>0) + if (!th->mTransitionData.inTransition && th->getSequence()->numGroundFrames>0) { mGroundThread = th; return true; @@ -950,9 +950,9 @@ void TSShapeInstance::animateGround() if (!mGroundThread && !initGround()) return; - S32 & loop = mGroundThread->path.loop; - F32 & start = mGroundThread->path.start; - F32 & end = mGroundThread->path.end; + S32 & loop = mGroundThread->mPath.loop; + F32 & start = mGroundThread->mPath.start; + F32 & end = mGroundThread->mPath.end; // accumulate path transform if (loop>0) @@ -980,7 +980,7 @@ void TSShapeInstance::deltaGround(TSThread * thread, F32 start, F32 end, MatrixF mat = &mGroundTransform; mat->identity(); - if (thread->transitionData.inTransition) + if (thread->mTransitionData.inTransition) return; F32 invDuration = 1.0f / thread->getDuration(); @@ -994,7 +994,7 @@ void TSShapeInstance::deltaGround(TSThread * thread, F32 start, F32 end, MatrixF void TSShapeInstance::deltaGround1(TSThread * thread, F32 start, F32 end, MatrixF& mat) { mat.identity(); - if (thread->transitionData.inTransition) + if (thread->mTransitionData.inTransition) return; addPath(thread, start, end, &mat); } diff --git a/Engine/source/ts/tsShapeInstance.h b/Engine/source/ts/tsShapeInstance.h index c526aeff0..46023b8a0 100644 --- a/Engine/source/ts/tsShapeInstance.h +++ b/Engine/source/ts/tsShapeInstance.h @@ -696,20 +696,20 @@ class TSThread { friend class TSShapeInstance; - S32 priority; + S32 mPriority; TSShapeInstance * mShapeInstance; ///< Instance of the shape that this thread animates - S32 sequence; ///< Sequence this thread will perform - F32 pos; + S32 mSequence; ///< Sequence this thread will perform + F32 mPos; - F32 timeScale; ///< How fast to play through the sequence + F32 mTimeScale; ///< How fast to play through the sequence - S32 keyNum1; ///< Keyframe at or before current position - S32 keyNum2; ///< Keyframe at or after current position - F32 keyPos; + S32 mKeyNum1; ///< Keyframe at or before current position + S32 mKeyNum2; ///< Keyframe at or after current position + F32 mKeyPos; - bool blendDisabled; ///< Blend with other sequences? + bool mBlendDisabled; ///< Blend with other sequences? /// if in transition... struct TransitionData @@ -726,15 +726,15 @@ class TSThread TSIntegerSet oldScaleNodes; ///< nodes controlled by this thread pre-transition U32 oldSequence; ///< sequence that was set before transition began F32 oldPos; ///< position of sequence before transition began - } transitionData; + } mTransitionData; struct { F32 start; F32 end; S32 loop; - } path; - bool makePath; + } mPath; + bool mMakePath; /// given a position on the thread, choose correct keyframes /// slight difference between one-shot and cyclic sequences -- see comments below for details @@ -783,10 +783,10 @@ class TSThread public: TSShapeInstance * getShapeInstance() { return mShapeInstance; } - bool hasSequence() const { return sequence >= 0; } - U32 getSeqIndex() const { return sequence; } - const TSSequence* getSequence() const { return &(mShapeInstance->mShape->mSequences[sequence]); } - const String& getSequenceName() const { return mShapeInstance->mShape->getSequenceName(sequence); } + bool hasSequence() const { return mSequence >= 0; } + U32 getSeqIndex() const { return mSequence; } + const TSSequence* getSequence() const { return &(mShapeInstance->mShape->mSequences[mSequence]); } + const String& getSequenceName() const { return mShapeInstance->mShape->getSequenceName(mSequence); } S32 operator<(const TSThread &) const; }; diff --git a/Engine/source/ts/tsThread.cpp b/Engine/source/ts/tsThread.cpp index 03a82f40d..02773d873 100644 --- a/Engine/source/ts/tsThread.cpp +++ b/Engine/source/ts/tsThread.cpp @@ -168,19 +168,19 @@ void TSThread::setSequence(S32 seq, F32 toPos) mShapeInstance->clearTransition(this); - sequence = seq; - priority = getSequence()->priority; - pos = toPos; - makePath = getSequence()->makePath(); - path.start = path.end = 0; - path.loop = 0; + mSequence = seq; + mPriority = getSequence()->priority; + mPos = toPos; + mMakePath = getSequence()->makePath(); + mPath.start = mPath.end = 0; + mPath.loop = 0; // 1.0f doesn't exist on cyclic sequences - if (pos>0.9999f && getSequence()->isCyclic()) - pos = 0.9999f; + if (mPos>0.9999f && getSequence()->isCyclic()) + mPos = 0.9999f; // select keyframes - selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos); + selectKeyframes(mPos,getSequence(),&mKeyNum1,&mKeyNum2,&mKeyPos); } void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool continuePlay) @@ -192,49 +192,49 @@ void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool conti // of the transition is interpolated. If we start to transtion from A to B, // but before reaching B we transtion to C, we interpolate all nodes controlled // by A, B, or C to their new position. - if (transitionData.inTransition) + if (mTransitionData.inTransition) { - transitionData.oldRotationNodes.overlap(getSequence()->rotationMatters); - transitionData.oldTranslationNodes.overlap(getSequence()->translationMatters); - transitionData.oldScaleNodes.overlap(getSequence()->scaleMatters); + mTransitionData.oldRotationNodes.overlap(getSequence()->rotationMatters); + mTransitionData.oldTranslationNodes.overlap(getSequence()->translationMatters); + mTransitionData.oldScaleNodes.overlap(getSequence()->scaleMatters); } else { - transitionData.oldRotationNodes = getSequence()->rotationMatters; - transitionData.oldTranslationNodes = getSequence()->translationMatters; - transitionData.oldScaleNodes = getSequence()->scaleMatters; + mTransitionData.oldRotationNodes = getSequence()->rotationMatters; + mTransitionData.oldTranslationNodes = getSequence()->translationMatters; + mTransitionData.oldScaleNodes = getSequence()->scaleMatters; } // set time characteristics of transition - transitionData.oldSequence = sequence; - transitionData.oldPos = pos; - transitionData.duration = duration; - transitionData.pos = 0.0f; - transitionData.direction = timeScale>0.0f ? 1.0f : -1.0f; - transitionData.targetScale = continuePlay ? 1.0f : 0.0f; + mTransitionData.oldSequence = mSequence; + mTransitionData.oldPos = mPos; + mTransitionData.duration = duration; + mTransitionData.pos = 0.0f; + mTransitionData.direction = mTimeScale>0.0f ? 1.0f : -1.0f; + mTransitionData.targetScale = continuePlay ? 1.0f : 0.0f; // in transition... - transitionData.inTransition = true; + mTransitionData.inTransition = true; // set target sequence data - sequence = seq; - priority = getSequence()->priority; - pos = toPos; - makePath = getSequence()->makePath(); - path.start = path.end = 0; - path.loop = 0; + mSequence = seq; + mPriority = getSequence()->priority; + mPos = toPos; + mMakePath = getSequence()->makePath(); + mPath.start = mPath.end = 0; + mPath.loop = 0; // 1.0f doesn't exist on cyclic sequences - if (pos>0.9999f && getSequence()->isCyclic()) - pos = 0.9999f; + if (mPos>0.9999f && getSequence()->isCyclic()) + mPos = 0.9999f; // select keyframes - selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos); + selectKeyframes(mPos,getSequence(),&mKeyNum1,&mKeyNum2,&mKeyPos); } bool TSThread::isInTransition() { - return transitionData.inTransition; + return mTransitionData.inTransition; } void TSThread::animateTriggers() @@ -242,30 +242,30 @@ void TSThread::animateTriggers() if (!getSequence()->numTriggers) return; - switch (path.loop) + switch (mPath.loop) { case -1 : - activateTriggers(path.start,0); - activateTriggers(1,path.end); + activateTriggers(mPath.start,0); + activateTriggers(1,mPath.end); break; case 0 : - activateTriggers(path.start,path.end); + activateTriggers(mPath.start,mPath.end); break; case 1 : - activateTriggers(path.start,1); - activateTriggers(0,path.end); + activateTriggers(mPath.start,1); + activateTriggers(0,mPath.end); break; default: { - if (path.loop>0) + if (mPath.loop>0) { - activateTriggers(path.end,1); - activateTriggers(0,path.end); + activateTriggers(mPath.end,1); + activateTriggers(0,mPath.end); } else { - activateTriggers(path.end,0); - activateTriggers(1,path.end); + activateTriggers(mPath.end,0); + activateTriggers(1,mPath.end); } } } @@ -320,32 +320,32 @@ void TSThread::activateTriggers(F32 a, F32 b) F32 TSThread::getPos() { - return transitionData.inTransition ? transitionData.pos : pos; + return mTransitionData.inTransition ? mTransitionData.pos : mPos; } F32 TSThread::getTime() { - return transitionData.inTransition ? transitionData.pos * transitionData.duration : pos * getSequence()->duration; + return mTransitionData.inTransition ? mTransitionData.pos * mTransitionData.duration : mPos * getSequence()->duration; } F32 TSThread::getDuration() { - return transitionData.inTransition ? transitionData.duration : getSequence()->duration; + return mTransitionData.inTransition ? mTransitionData.duration : getSequence()->duration; } F32 TSThread::getScaledDuration() { - return getDuration() / mFabs(timeScale); + return getDuration() / mFabs(mTimeScale); } F32 TSThread::getTimeScale() { - return timeScale; + return mTimeScale; } void TSThread::setTimeScale(F32 ts) { - timeScale = ts; + mTimeScale = ts; } void TSThread::advancePos(F32 delta) @@ -353,76 +353,76 @@ void TSThread::advancePos(F32 delta) if (mFabs(delta)>0.00001f) { // make dirty what this thread changes - U32 dirtyFlags = getSequence()->dirtyFlags | (transitionData.inTransition ? TSShapeInstance::TransformDirty : 0); + U32 dirtyFlags = getSequence()->dirtyFlags | (mTransitionData.inTransition ? TSShapeInstance::TransformDirty : 0); for (S32 i=0; igetShape()->mSubShapeFirstNode.size(); i++) mShapeInstance->mDirtyFlags[i] |= dirtyFlags; } - if (transitionData.inTransition) + if (mTransitionData.inTransition) { - transitionData.pos += transitionData.direction * delta; - if (transitionData.pos<0 || transitionData.pos>=1.0f) + mTransitionData.pos += mTransitionData.direction * delta; + if (mTransitionData.pos<0 || mTransitionData.pos>=1.0f) { mShapeInstance->clearTransition(this); - if (transitionData.pos<0.0f) + if (mTransitionData.pos<0.0f) // return to old sequence - mShapeInstance->setSequence(this,transitionData.oldSequence,transitionData.oldPos); + mShapeInstance->setSequence(this,mTransitionData.oldSequence,mTransitionData.oldPos); } // re-adjust delta to be correct time-wise - delta *= transitionData.targetScale * transitionData.duration / getSequence()->duration; + delta *= mTransitionData.targetScale * mTransitionData.duration / getSequence()->duration; } // even if we are in a transition, keep playing the sequence - if (makePath) + if (mMakePath) { - path.start = pos; - pos += delta; + mPath.start = mPos; + mPos += delta; if (!getSequence()->isCyclic()) { - pos = mClampF(pos , 0.0f, 1.0f); - path.loop = 0; + mPos = mClampF(mPos , 0.0f, 1.0f); + mPath.loop = 0; } else { - path.loop = (S32)pos; - if (pos < 0.0f) - path.loop--; - pos -= path.loop; + mPath.loop = (S32)mPos; + if (mPos < 0.0f) + mPath.loop--; + mPos -= mPath.loop; // following necessary because of floating point roundoff errors - if (pos < 0.0f) pos += 1.0f; - if (pos >= 1.0f) pos -= 1.0f; + if (mPos < 0.0f) mPos += 1.0f; + if (mPos >= 1.0f) mPos -= 1.0f; } - path.end = pos; + mPath.end = mPos; animateTriggers(); // do this automatically...no need for user to call it - AssertFatal(pos>=0.0f && pos<=1.0f,"TSThread::advancePos (1)"); - AssertFatal(!getSequence()->isCyclic() || pos<1.0f,"TSThread::advancePos (2)"); + AssertFatal(mPos>=0.0f && mPos<=1.0f,"TSThread::advancePos (1)"); + AssertFatal(!getSequence()->isCyclic() || mPos<1.0f,"TSThread::advancePos (2)"); } else { - pos += delta; + mPos += delta; if (!getSequence()->isCyclic()) - pos = mClampF(pos, 0.0f, 1.0f); + mPos = mClampF(mPos, 0.0f, 1.0f); else { - pos -= S32(pos); + mPos -= S32(mPos); // following necessary because of floating point roundoff errors - if (pos < 0.0f) pos += 1.0f; - if (pos >= 1.0f) pos -= 1.0f; + if (mPos < 0.0f) mPos += 1.0f; + if (mPos >= 1.0f) mPos -= 1.0f; } - AssertFatal(pos>=0.0f && pos<=1.0f,"TSThread::advancePos (3)"); - AssertFatal(!getSequence()->isCyclic() || pos<1.0f,"TSThread::advancePos (4)"); + AssertFatal(mPos>=0.0f && mPos<=1.0f,"TSThread::advancePos (3)"); + AssertFatal(!getSequence()->isCyclic() || mPos<1.0f,"TSThread::advancePos (4)"); } // select keyframes - selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos); + selectKeyframes(mPos,getSequence(),&mKeyNum1,&mKeyNum2,&mKeyPos); } void TSThread::advanceTime(F32 delta) { - advancePos(timeScale * delta / getDuration()); + advancePos(mTimeScale * delta / getDuration()); } void TSThread::setPos(F32 pos) @@ -432,40 +432,40 @@ void TSThread::setPos(F32 pos) void TSThread::setTime(F32 time) { - setPos(timeScale * time/getDuration()); + setPos(mTimeScale * time/getDuration()); } S32 TSThread::getKeyframeCount() { - AssertFatal(!transitionData.inTransition,"TSThread::getKeyframeCount: not while in transition"); + AssertFatal(!mTransitionData.inTransition,"TSThread::getKeyframeCount: not while in transition"); return getSequence()->numKeyframes + 1; } S32 TSThread::getKeyframeNumber() { - AssertFatal(!transitionData.inTransition,"TSThread::getKeyframeNumber: not while in transition"); + AssertFatal(!mTransitionData.inTransition,"TSThread::getKeyframeNumber: not while in transition"); - return keyNum1; + return mKeyNum1; } void TSThread::setKeyframeNumber(S32 kf) { AssertFatal(kf>=0 && kf<= getSequence()->numKeyframes, "TSThread::setKeyframeNumber: invalid frame specified."); - AssertFatal(!transitionData.inTransition,"TSThread::setKeyframeNumber: not while in transition"); + AssertFatal(!mTransitionData.inTransition,"TSThread::setKeyframeNumber: not while in transition"); - keyNum1 = keyNum2 = kf; - keyPos = 0; - pos = 0; + mKeyNum1 = mKeyNum2 = kf; + mKeyPos = 0; + mPos = 0; } TSThread::TSThread(TSShapeInstance * _shapeInst) { - timeScale = 1.0f; + mTimeScale = 1.0f; mShapeInstance = _shapeInst; - transitionData.inTransition = false; - blendDisabled = false; + mTransitionData.inTransition = false; + mBlendDisabled = false; setSequence(0,0.0f); } @@ -475,9 +475,9 @@ S32 TSThread::operator<(const TSThread & th2) const { // both blend or neither blend, sort based on priority only -- higher priority first S32 ret = 0; // do it this way to (hopefully) take advantage of 'conditional move' assembly instruction - if (priority > th2.priority) + if (mPriority > th2.mPriority) ret = -1; - if (th2.priority > priority) + if (th2.mPriority > mPriority) ret = 1; return ret; } @@ -542,7 +542,7 @@ U32 TSShapeInstance::threadCount() void TSShapeInstance::setSequence(TSThread * thread, S32 seq, F32 pos) { - if ( (thread->transitionData.inTransition && mTransitionThreads.size()>1) || mTransitionThreads.size()>0) + if ( (thread->mTransitionData.inTransition && mTransitionThreads.size()>1) || mTransitionThreads.size()>0) { // if we have transitions, make sure transforms are up to date... sortThreads(); @@ -565,7 +565,7 @@ U32 TSShapeInstance::getSequence(TSThread * thread) { //AssertFatal( thread->sequence >= 0, "TSShapeInstance::getSequence: range error A"); //AssertFatal( thread->sequence < mShape->sequences.size(), "TSShapeInstance::getSequence: range error B"); - return (U32)thread->sequence; + return (U32)thread->mSequence; } void TSShapeInstance::transitionToSequence(TSThread * thread, S32 seq, F32 pos, F32 duration, bool continuePlay) @@ -583,13 +583,13 @@ void TSShapeInstance::transitionToSequence(TSThread * thread, S32 seq, F32 pos, else if (!mScaleCurrentlyAnimated && thread->getSequence()->animatesScale()) mScaleCurrentlyAnimated=true; - mTransitionRotationNodes.overlap(thread->transitionData.oldRotationNodes); + mTransitionRotationNodes.overlap(thread->mTransitionData.oldRotationNodes); mTransitionRotationNodes.overlap(thread->getSequence()->rotationMatters); - mTransitionTranslationNodes.overlap(thread->transitionData.oldTranslationNodes); + mTransitionTranslationNodes.overlap(thread->mTransitionData.oldTranslationNodes); mTransitionTranslationNodes.overlap(thread->getSequence()->translationMatters); - mTransitionScaleNodes.overlap(thread->transitionData.oldScaleNodes); + mTransitionScaleNodes.overlap(thread->mTransitionData.oldScaleNodes); mTransitionScaleNodes.overlap(thread->getSequence()->scaleMatters); // if we aren't already in the list of transition threads, add us now @@ -605,7 +605,7 @@ void TSShapeInstance::transitionToSequence(TSThread * thread, S32 seq, F32 pos, void TSShapeInstance::clearTransition(TSThread * thread) { - if (!thread->transitionData.inTransition) + if (!thread->mTransitionData.inTransition) return; // if other transitions are still playing, @@ -614,7 +614,7 @@ void TSShapeInstance::clearTransition(TSThread * thread) animateNodeSubtrees(); // turn off transition... - thread->transitionData.inTransition = false; + thread->mTransitionData.inTransition = false; // remove us from transition list S32 i; @@ -632,13 +632,13 @@ void TSShapeInstance::clearTransition(TSThread * thread) mTransitionScaleNodes.clearAll(); for (i=0; itransitionData.oldRotationNodes); + mTransitionRotationNodes.overlap(mTransitionThreads[i]->mTransitionData.oldRotationNodes); mTransitionRotationNodes.overlap(mTransitionThreads[i]->getSequence()->rotationMatters); - mTransitionTranslationNodes.overlap(mTransitionThreads[i]->transitionData.oldTranslationNodes); + mTransitionTranslationNodes.overlap(mTransitionThreads[i]->mTransitionData.oldTranslationNodes); mTransitionTranslationNodes.overlap(mTransitionThreads[i]->getSequence()->translationMatters); - mTransitionScaleNodes.overlap(mTransitionThreads[i]->transitionData.oldScaleNodes); + mTransitionScaleNodes.overlap(mTransitionThreads[i]->mTransitionData.oldScaleNodes); mTransitionScaleNodes.overlap(mTransitionThreads[i]->getSequence()->scaleMatters); } @@ -709,10 +709,10 @@ void TSShapeInstance::updateTransitions() for (i=0; itransitionData.inTransition) + if (th->mTransitionData.inTransition) { - th->transitionData.duration *= 1.0f - th->transitionData.pos; - th->transitionData.pos = 0.0f; + th->mTransitionData.duration *= 1.0f - th->mTransitionData.pos; + th->mTransitionData.pos = 0.0f; } } } @@ -728,22 +728,22 @@ void TSShapeInstance::checkScaleCurrentlyAnimated() void TSShapeInstance::setBlendEnabled(TSThread * thread, bool blendOn) { - thread->blendDisabled = !blendOn; + thread->mBlendDisabled = !blendOn; } bool TSShapeInstance::getBlendEnabled(TSThread * thread) { - return !thread->blendDisabled; + return !thread->mBlendDisabled; } void TSShapeInstance::setPriority(TSThread * thread, F32 priority) { - thread->priority = priority; + thread->mPriority = priority; } F32 TSShapeInstance::getPriority(TSThread * thread) { - return thread->priority; + return thread->mPriority; } F32 TSShapeInstance::getTime(TSThread * thread) From d6b003e50883958537e8973ece5b9df544152707 Mon Sep 17 00:00:00 2001 From: bank Date: Tue, 13 May 2014 16:58:06 +0400 Subject: [PATCH 18/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class NetStringTable --- Engine/source/sim/netStringTable.cpp | 144 +++++++++++++-------------- Engine/source/sim/netStringTable.h | 14 +-- 2 files changed, 79 insertions(+), 79 deletions(-) diff --git a/Engine/source/sim/netStringTable.cpp b/Engine/source/sim/netStringTable.cpp index 880c72e1e..ac8780757 100644 --- a/Engine/source/sim/netStringTable.cpp +++ b/Engine/source/sim/netStringTable.cpp @@ -31,79 +31,79 @@ NetStringTable *gNetStringTable = NULL; NetStringTable::NetStringTable() { - firstFree = 1; - firstValid = 1; + mFirstFree = 1; + mFirstValid = 1; - table = (Entry *) dMalloc(sizeof(Entry) * InitialSize); - size = InitialSize; + mTable = (Entry *) dMalloc(sizeof(Entry) * InitialSize); + mSize = InitialSize; for(U32 i = 0; i < InitialSize; i++) { - table[i].next = i + 1; - table[i].refCount = 0; - table[i].scriptRefCount = 0; + mTable[i].next = i + 1; + mTable[i].refCount = 0; + mTable[i].scriptRefCount = 0; } - table[InitialSize-1].next = InvalidEntry; + mTable[InitialSize-1].next = InvalidEntry; for(U32 j = 0; j < HashTableSize; j++) - hashTable[j] = 0; - allocator = new DataChunker(DataChunkerSize); + mHashTable[j] = 0; + mAllocator = new DataChunker(DataChunkerSize); } NetStringTable::~NetStringTable() { - delete allocator; - dFree( table ); + delete mAllocator; + dFree( mTable ); } void NetStringTable::incStringRef(U32 id) { - AssertFatal(table[id].refCount != 0 || table[id].scriptRefCount != 0 , "Cannot inc ref count from zero."); - table[id].refCount++; + AssertFatal(mTable[id].refCount != 0 || mTable[id].scriptRefCount != 0 , "Cannot inc ref count from zero."); + mTable[id].refCount++; } void NetStringTable::incStringRefScript(U32 id) { - AssertFatal(table[id].refCount != 0 || table[id].scriptRefCount != 0 , "Cannot inc ref count from zero."); - table[id].scriptRefCount++; + AssertFatal(mTable[id].refCount != 0 || mTable[id].scriptRefCount != 0 , "Cannot inc ref count from zero."); + mTable[id].scriptRefCount++; } U32 NetStringTable::addString(const char *string) { U32 hash = _StringTable::hashString(string); U32 bucket = hash % HashTableSize; - for(U32 walk = hashTable[bucket];walk; walk = table[walk].next) + for(U32 walk = mHashTable[bucket];walk; walk = mTable[walk].next) { - if(!dStrcmp(table[walk].string, string)) + if(!dStrcmp(mTable[walk].string, string)) { - table[walk].refCount++; + mTable[walk].refCount++; return walk; } } - U32 e = firstFree; - firstFree = table[e].next; - if(firstFree == InvalidEntry) + U32 e = mFirstFree; + mFirstFree = mTable[e].next; + if(mFirstFree == InvalidEntry) { // in this case, we should expand the table for next time... - U32 newSize = size * 2; - table = (Entry *) dRealloc(table, newSize * sizeof(Entry)); - for(U32 i = size; i < newSize; i++) + U32 newSize = mSize * 2; + mTable = (Entry *) dRealloc(mTable, newSize * sizeof(Entry)); + for(U32 i = mSize; i < newSize; i++) { - table[i].next = i + 1; - table[i].refCount = 0; - table[i].scriptRefCount = 0; + mTable[i].next = i + 1; + mTable[i].refCount = 0; + mTable[i].scriptRefCount = 0; } - firstFree = size; - table[newSize - 1].next = InvalidEntry; - size = newSize; + mFirstFree = mSize; + mTable[newSize - 1].next = InvalidEntry; + mSize = newSize; } - table[e].refCount++; - table[e].string = (char *) allocator->alloc(dStrlen(string) + 1); - dStrcpy(table[e].string, string); - table[e].next = hashTable[bucket]; - hashTable[bucket] = e; - table[e].link = firstValid; - table[firstValid].prevLink = e; - firstValid = e; - table[e].prevLink = 0; + mTable[e].refCount++; + mTable[e].string = (char *) mAllocator->alloc(dStrlen(string) + 1); + dStrcpy(mTable[e].string, string); + mTable[e].next = mHashTable[bucket]; + mHashTable[bucket] = e; + mTable[e].link = mFirstValid; + mTable[mFirstValid].prevLink = e; + mFirstValid = e; + mTable[e].prevLink = 0; return e; } @@ -114,75 +114,75 @@ U32 GameAddTaggedString(const char *string) const char *NetStringTable::lookupString(U32 id) { - if(table[id].refCount == 0 && table[id].scriptRefCount == 0) + if(mTable[id].refCount == 0 && mTable[id].scriptRefCount == 0) return NULL; - return table[id].string; + return mTable[id].string; } void NetStringTable::removeString(U32 id, bool script) { if(!script) { - AssertFatal(table[id].refCount != 0, "Error, ref count is already 0!!"); - if(--table[id].refCount) + AssertFatal(mTable[id].refCount != 0, "Error, ref count is already 0!!"); + if(--mTable[id].refCount) return; - if(table[id].scriptRefCount) + if(mTable[id].scriptRefCount) return; } else { // If both ref counts are already 0, this id is not valid. Ignore // the remove - if (table[id].scriptRefCount == 0 && table[id].refCount == 0) + if (mTable[id].scriptRefCount == 0 && mTable[id].refCount == 0) return; - if(table[id].scriptRefCount == 0 && table[id].refCount) + if(mTable[id].scriptRefCount == 0 && mTable[id].refCount) { - Con::errorf("removeTaggedString failed! Ref count is already 0 for string: %s", table[id].string); + Con::errorf("removeTaggedString failed! Ref count is already 0 for string: %s", mTable[id].string); return; } - if(--table[id].scriptRefCount) + if(--mTable[id].scriptRefCount) return; - if(table[id].refCount) + if(mTable[id].refCount) return; } // unlink first: - U32 prev = table[id].prevLink; - U32 next = table[id].link; + U32 prev = mTable[id].prevLink; + U32 next = mTable[id].link; if(next) - table[next].prevLink = prev; + mTable[next].prevLink = prev; if(prev) - table[prev].link = next; + mTable[prev].link = next; else - firstValid = next; + mFirstValid = next; // remove it from the hash table - U32 hash = _StringTable::hashString(table[id].string); + U32 hash = _StringTable::hashString(mTable[id].string); U32 bucket = hash % HashTableSize; - for(U32 *walk = &hashTable[bucket];*walk; walk = &table[*walk].next) + for(U32 *walk = &mHashTable[bucket];*walk; walk = &mTable[*walk].next) { if(*walk == id) { - *walk = table[id].next; + *walk = mTable[id].next; break; } } - table[id].next = firstFree; - firstFree = id; + mTable[id].next = mFirstFree; + mFirstFree = id; } void NetStringTable::repack() { DataChunker *newAllocator = new DataChunker(DataChunkerSize); - for(U32 walk = firstValid; walk; walk = table[walk].link) + for(U32 walk = mFirstValid; walk; walk = mTable[walk].link) { - const char *prevStr = table[walk].string; + const char *prevStr = mTable[walk].string; - table[walk].string = (char *) newAllocator->alloc(dStrlen(prevStr) + 1); - dStrcpy(table[walk].string, prevStr); + mTable[walk].string = (char *) newAllocator->alloc(dStrlen(prevStr) + 1); + dStrcpy(mTable[walk].string, prevStr); } - delete allocator; - allocator = newAllocator; + delete mAllocator; + mAllocator = newAllocator; } void NetStringTable::create() @@ -249,21 +249,21 @@ void NetStringTable::dumpToConsole() { U32 count = 0; S32 maxIndex = -1; - for ( U32 i = 0; i < size; i++ ) + for ( U32 i = 0; i < mSize; i++ ) { - if ( table[i].refCount > 0 || table[i].scriptRefCount > 0) + if ( mTable[i].refCount > 0 || mTable[i].scriptRefCount > 0) { - Con::printf( "%d: \"%c%s%c\" REF: %d", i, 0x10, table[i].string, 0x11, table[i].refCount ); - if ( maxIndex == -1 || table[i].refCount > table[maxIndex].refCount ) + Con::printf( "%d: \"%c%s%c\" REF: %d", i, 0x10, mTable[i].string, 0x11, mTable[i].refCount ); + if ( maxIndex == -1 || mTable[i].refCount > mTable[maxIndex].refCount ) maxIndex = i; count++; } } Con::printf( ">> STRINGS: %d MAX REF COUNT: %d \"%c%s%c\" <<", count, - ( maxIndex == -1 ) ? 0 : table[maxIndex].refCount, + ( maxIndex == -1 ) ? 0 : mTable[maxIndex].refCount, 0x10, - ( maxIndex == -1 ) ? "" : table[maxIndex].string, + ( maxIndex == -1 ) ? "" : mTable[maxIndex].string, 0x11 ); } diff --git a/Engine/source/sim/netStringTable.h b/Engine/source/sim/netStringTable.h index 629d691bb..d888c484d 100644 --- a/Engine/source/sim/netStringTable.h +++ b/Engine/source/sim/netStringTable.h @@ -60,14 +60,14 @@ class NetStringTable U32 prevLink; U32 seq; }; - U32 size; - U32 firstFree; - U32 firstValid; - U32 sequenceCount; + U32 mSize; + U32 mFirstFree; + U32 mFirstValid; + U32 mSequenceCount; - Entry *table; - U32 hashTable[HashTableSize]; - DataChunker *allocator; + Entry *mTable; + U32 mHashTable[HashTableSize]; + DataChunker *mAllocator; NetStringTable(); ~NetStringTable(); From 3e21f5f67791751b6564fb24f6a6cdeef175968b Mon Sep 17 00:00:00 2001 From: bank Date: Tue, 13 May 2014 18:25:47 +0400 Subject: [PATCH 19/19] Rename all member variables to follow the style guidelines (prefixed with the 'm') - class BitStream --- Engine/source/core/stream/bitStream.cpp | 124 ++++++++++++------------ Engine/source/core/stream/bitStream.h | 38 ++++---- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/Engine/source/core/stream/bitStream.cpp b/Engine/source/core/stream/bitStream.cpp index 4ea46b6f5..56e0c85c8 100644 --- a/Engine/source/core/stream/bitStream.cpp +++ b/Engine/source/core/stream/bitStream.cpp @@ -78,18 +78,18 @@ ResizeBitStream::ResizeBitStream(U32 minSpace, U32 initialSize) : BitStream(NULL ResizeBitStream::~ResizeBitStream() { - dFree(dataPtr); + dFree(mDataPtr); } void ResizeBitStream::validate() { - if(getPosition() + mMinSpace > bufSize) + if(getPosition() + mMinSpace > mBufSize) { - bufSize = getPosition() + mMinSpace * 2; - dataPtr = (U8 *) dRealloc(dataPtr, bufSize); + mBufSize = getPosition() + mMinSpace * 2; + mDataPtr = (U8 *) dRealloc(mDataPtr, mBufSize); - maxReadBitNum = bufSize << 3; - maxWriteBitNum = bufSize << 3; + mMaxReadBitNum = mBufSize << 3; + mMaxWriteBitNum = mBufSize << 3; } } @@ -148,53 +148,53 @@ HuffmanProcessor HuffmanProcessor::g_huffProcessor; void BitStream::setBuffer(void *bufPtr, S32 size, S32 maxSize) { - dataPtr = (U8 *) bufPtr; - bitNum = 0; - bufSize = size; - maxReadBitNum = size << 3; + mDataPtr = (U8 *) bufPtr; + mBitNum = 0; + mBufSize = size; + mMaxReadBitNum = size << 3; if(maxSize < 0) maxSize = size; - maxWriteBitNum = maxSize << 3; - error = false; + mMaxWriteBitNum = maxSize << 3; + mError = false; clearCompressionPoint(); } U32 BitStream::getPosition() const { - return (bitNum + 7) >> 3; + return (mBitNum + 7) >> 3; } bool BitStream::setPosition(const U32 pos) { - bitNum = pos << 3; + mBitNum = pos << 3; return (true); } U32 BitStream::getStreamSize() { - return bufSize; + return mBufSize; } U8 *BitStream::getBytePtr() { - return dataPtr + getPosition(); + return mDataPtr + getPosition(); } U32 BitStream::getReadByteSize() { - return (maxReadBitNum >> 3) - getPosition(); + return (mMaxReadBitNum >> 3) - getPosition(); } U32 BitStream::getWriteByteSize() { - return (maxWriteBitNum >> 3) - getPosition(); + return (mMaxWriteBitNum >> 3) - getPosition(); } void BitStream::clear() { - dMemset(dataPtr, 0, bufSize); + dMemset(mDataPtr, 0, mBufSize); } void BitStream::writeClassId(U32 classId, U32 classType, U32 classGroup) @@ -228,9 +228,9 @@ void BitStream::writeBits(S32 bitCount, const void *bitPtr) if(!bitCount) return; - if(bitCount + bitNum > maxWriteBitNum) + if(bitCount + mBitNum > mMaxWriteBitNum) { - error = true; + mError = true; AssertFatal(false, "Out of range write"); return; } @@ -242,39 +242,39 @@ void BitStream::writeBits(S32 bitCount, const void *bitPtr) for(S32 srcBitNum = 0;srcBitNum < bitCount;srcBitNum++) { if((*(ptr + (srcBitNum >> 3)) & (1 << (srcBitNum & 0x7))) != 0) - *(dataPtr + (bitNum >> 3)) |= (1 << (bitNum & 0x7)); + *(mDataPtr + (mBitNum >> 3)) |= (1 << (mBitNum & 0x7)); else - *(dataPtr + (bitNum >> 3)) &= ~(1 << (bitNum & 0x7)); - bitNum++; + *(mDataPtr + (mBitNum >> 3)) &= ~(1 << (mBitNum & 0x7)); + mBitNum++; } } void BitStream::setBit(S32 bitCount, bool set) { if(set) - *(dataPtr + (bitCount >> 3)) |= (1 << (bitCount & 0x7)); + *(mDataPtr + (bitCount >> 3)) |= (1 << (bitCount & 0x7)); else - *(dataPtr + (bitCount >> 3)) &= ~(1 << (bitCount & 0x7)); + *(mDataPtr + (bitCount >> 3)) &= ~(1 << (bitCount & 0x7)); } bool BitStream::testBit(S32 bitCount) { - return (*(dataPtr + (bitCount >> 3)) & (1 << (bitCount & 0x7))) != 0; + return (*(mDataPtr + (bitCount >> 3)) & (1 << (bitCount & 0x7))) != 0; } bool BitStream::writeFlag(bool val) { - if(bitNum + 1 > maxWriteBitNum) + if(mBitNum + 1 > mMaxWriteBitNum) { - error = true; + mError = true; AssertFatal(false, "Out of range write"); return false; } if(val) - *(dataPtr + (bitNum >> 3)) |= (1 << (bitNum & 0x7)); + *(mDataPtr + (mBitNum >> 3)) |= (1 << (mBitNum & 0x7)); else - *(dataPtr + (bitNum >> 3)) &= ~(1 << (bitNum & 0x7)); - bitNum++; + *(mDataPtr + (mBitNum >> 3)) &= ~(1 << (mBitNum & 0x7)); + mBitNum++; return (val); } @@ -282,23 +282,23 @@ void BitStream::readBits(S32 bitCount, void *bitPtr) { if(!bitCount) return; - if(bitCount + bitNum > maxReadBitNum) + if(bitCount + mBitNum > mMaxReadBitNum) { - error = true; + mError = true; //AssertFatal(false, "Out of range read"); AssertWarn(false, "Out of range read"); return; } - U8 *stPtr = dataPtr + (bitNum >> 3); + U8 *stPtr = mDataPtr + (mBitNum >> 3); S32 byteCount = (bitCount + 7) >> 3; U8 *ptr = (U8 *) bitPtr; - S32 downShift = bitNum & 0x7; + S32 downShift = mBitNum & 0x7; S32 upShift = 8 - downShift; U8 curB = *stPtr; - const U8 *stEnd = dataPtr + bufSize; + const U8 *stEnd = mDataPtr + mBufSize; while(byteCount--) { stPtr++; @@ -307,7 +307,7 @@ void BitStream::readBits(S32 bitCount, void *bitPtr) curB = nextB; } - bitNum += bitCount; + mBitNum += bitCount; } bool BitStream::_read(U32 size, void *dataPtr) @@ -625,69 +625,69 @@ void InfiniteBitStream::reset() void InfiniteBitStream::validate(U32 upcomingBytes) { - if(getPosition() + upcomingBytes + mMinSpace > bufSize) + if(getPosition() + upcomingBytes + mMinSpace > mBufSize) { - bufSize = getPosition() + upcomingBytes + mMinSpace; - dataPtr = (U8 *) dRealloc(dataPtr, bufSize); + mBufSize = getPosition() + upcomingBytes + mMinSpace; + mDataPtr = (U8 *) dRealloc(mDataPtr, mBufSize); - maxReadBitNum = bufSize << 3; - maxWriteBitNum = bufSize << 3; + mMaxReadBitNum = mBufSize << 3; + mMaxWriteBitNum = mBufSize << 3; } } void InfiniteBitStream::compact() { // Prepare to copy... - U32 oldSize = bufSize; - U8 *tmp = (U8*)dMalloc(bufSize); + U32 oldSize = mBufSize; + U8 *tmp = (U8*)dMalloc(mBufSize); // Copy things... - bufSize = getPosition() + mMinSpace * 2; - dMemcpy(tmp, dataPtr, oldSize); + mBufSize = getPosition() + mMinSpace * 2; + dMemcpy(tmp, mDataPtr, oldSize); // And clean up. - dFree(dataPtr); - dataPtr = tmp; + dFree(mDataPtr); + mDataPtr = tmp; - maxReadBitNum = bufSize << 3; - maxWriteBitNum = bufSize << 3; + mMaxReadBitNum = mBufSize << 3; + mMaxWriteBitNum = mBufSize << 3; } void InfiniteBitStream::writeToStream(Stream &s) { - s.write(getPosition(), dataPtr); + s.write(getPosition(), mDataPtr); } //------------------------------------------------------------------------------ void BitStream::readString(char buf[256]) { - if(stringBuffer) + if(mStringBuffer) { if(readFlag()) { S32 offset = readInt(8); - HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, stringBuffer + offset); - dStrcpy(buf, stringBuffer); + HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, mStringBuffer + offset); + dStrcpy(buf, mStringBuffer); return; } } HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, buf); - if(stringBuffer) - dStrcpy(stringBuffer, buf); + if(mStringBuffer) + dStrcpy(mStringBuffer, buf); } void BitStream::writeString(const char *string, S32 maxLen) { if(!string) string = ""; - if(stringBuffer) + if(mStringBuffer) { S32 j; - for(j = 0; j < maxLen && stringBuffer[j] == string[j] && string[j];j++) + for(j = 0; j < maxLen && mStringBuffer[j] == string[j] && string[j];j++) ; - dStrncpy(stringBuffer, string, maxLen); - stringBuffer[maxLen] = 0; + dStrncpy(mStringBuffer, string, maxLen); + mStringBuffer[maxLen] = 0; if(writeFlag(j > 2)) { @@ -781,7 +781,7 @@ void HuffmanProcessor::generateCodes(BitStream& rBS, S32 index, S32 depth) // leaf node, copy the code in, and back out... HuffLeaf& rLeaf = m_huffLeaves[-(index + 1)]; - dMemcpy(&rLeaf.code, rBS.dataPtr, sizeof(rLeaf.code)); + dMemcpy(&rLeaf.code, rBS.mDataPtr, sizeof(rLeaf.code)); rLeaf.numBits = depth; } else { HuffNode& rNode = m_huffNodes[index]; diff --git a/Engine/source/core/stream/bitStream.h b/Engine/source/core/stream/bitStream.h index 7f6fe82ca..666fb960b 100644 --- a/Engine/source/core/stream/bitStream.h +++ b/Engine/source/core/stream/bitStream.h @@ -48,13 +48,13 @@ class QuatF; class BitStream : public Stream { protected: - U8 *dataPtr; - S32 bitNum; - S32 bufSize; - bool error; - S32 maxReadBitNum; - S32 maxWriteBitNum; - char *stringBuffer; + U8 *mDataPtr; + S32 mBitNum; + S32 mBufSize; + bool mError; + S32 mMaxReadBitNum; + S32 mMaxWriteBitNum; + char *mStringBuffer; Point3F mCompressPoint; friend class HuffmanProcessor; @@ -63,7 +63,7 @@ public: static void sendPacketStream(const NetAddress *addr); void setBuffer(void *bufPtr, S32 bufSize, S32 maxSize = 0); - U8* getBuffer() { return dataPtr; } + U8* getBuffer() { return mDataPtr; } U8* getBytePtr(); U32 getReadByteSize(); @@ -83,7 +83,7 @@ public: S32 getBitPosition() const { return getCurPos(); } void clearStringBuffer(); - BitStream(void *bufPtr, S32 bufSize, S32 maxWriteSize = -1) { setBuffer(bufPtr, bufSize,maxWriteSize); stringBuffer = NULL; } + BitStream(void *bufPtr, S32 bufSize, S32 maxWriteSize = -1) { setBuffer(bufPtr, bufSize,maxWriteSize); mStringBuffer = NULL; } void clear(); void setStringBuffer(char buffer[256]); @@ -241,8 +241,8 @@ public: void setBit(S32 bitCount, bool set); bool testBit(S32 bitCount); - bool isFull() { return bitNum > (bufSize << 3); } - bool isValid() { return !error; } + bool isFull() { return mBitNum > (mBufSize << 3); } + bool isValid() { return !mError; } bool _read (const U32 size,void* d); bool _write(const U32 size,const void* d); @@ -313,26 +313,26 @@ public: // inline S32 BitStream::getCurPos() const { - return bitNum; + return mBitNum; } inline void BitStream::setCurPos(const U32 in_position) { - AssertFatal(in_position < (U32)(bufSize << 3), "Out of range bitposition"); - bitNum = S32(in_position); + AssertFatal(in_position < (U32)(mBufSize << 3), "Out of range bitposition"); + mBitNum = S32(in_position); } inline bool BitStream::readFlag() { - if(bitNum > maxReadBitNum) + if(mBitNum > mMaxReadBitNum) { - error = true; + mError = true; AssertFatal(false, "Out of range read"); return false; } - S32 mask = 1 << (bitNum & 0x7); - bool ret = (*(dataPtr + (bitNum >> 3)) & mask) != 0; - bitNum++; + S32 mask = 1 << (mBitNum & 0x7); + bool ret = (*(mDataPtr + (mBitNum >> 3)) & mask) != 0; + mBitNum++; return ret; }