Merge branch 'master' into console-func-refactor

Conflicts:
	Engine/source/app/net/net.cpp
	Engine/source/console/astNodes.cpp
	Engine/source/console/compiledEval.cpp
	Engine/source/console/console.h
	Engine/source/console/consoleInternal.h
	Engine/source/console/engineAPI.h
This commit is contained in:
Daniel Buckmaster 2014-10-14 14:40:17 +11:00
commit b507dc9555
6487 changed files with 315149 additions and 609761 deletions

View file

@ -179,7 +179,7 @@ private:
const domVertices* vertices = daeSafeCast<domVertices>(element);
// Search for the input with the desired semantic
const char* semantic = SourceTypeToSemantic( type );
for (int iInput = 0; iInput < vertices->getInput_array().getCount(); iInput++)
for (S32 iInput = 0; iInput < vertices->getInput_array().getCount(); iInput++)
{
domInputLocal* input = vertices->getInput_array().get(iInput);
if (dStrEqual(input->getSemantic(), semantic))
@ -230,12 +230,12 @@ public:
*maxOffset = 0;
// Clear output array
for (int i = 0; i < NumStreams; i++)
for (S32 i = 0; i < NumStreams; i++)
sortedInputs[i] = 0;
// Separate inputs by type, and sort by set (ie. lowest TEXCOORD set becomes UV,
// next TEXCOORD set becomes UV2 etc)
for (int iInput = 0; iInput < inputs.getCount(); iInput++) {
for (S32 iInput = 0; iInput < inputs.getCount(); iInput++) {
const T& input = inputs[iInput];
const daeString semantic = input->getSemantic();
@ -247,7 +247,7 @@ public:
// The <vertices> element may contain multiple inputs (eg. POSITION, NORMAL etc)
domInputLocalRef verticesInputs[NumStreams];
classifyInputs(vertices->getInput_array(), verticesInputs);
for (int iStream = 0; iStream < NumStreams; iStream++)
for (S32 iStream = 0; iStream < NumStreams; iStream++)
{
if (verticesInputs[iStream] != 0)
sortedInputs[iStream] = input;
@ -367,7 +367,7 @@ 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 (int iMat = 0; iMat < appMaterials.size(); iMat++) {
for (S32 iMat = 0; iMat < appMaterials.size(); iMat++) {
ColladaAppMaterial* appMat = static_cast<ColladaAppMaterial*>(appMaterials[iMat]);
if (appMat->effectExt &&
appMat->effectExt->animatesTextureTransform(appSeq->getStart(), appSeq->getEnd()))
@ -379,7 +379,7 @@ bool ColladaAppMesh::animatesMatFrame(const AppSequence* appSeq)
bool animated = false;
bool differentUVs = false;
if (const domMorph* morph = getMorph()) {
for (int iInput = 0; iInput < morph->getTargets()->getInput_array().getCount(); iInput++) {
for (S32 iInput = 0; iInput < morph->getTargets()->getInput_array().getCount(); iInput++) {
const domInputLocal* input = morph->getTargets()->getInput_array()[iInput];
if (dStrEqual(input->getSemantic(), "MORPH_TARGET")) {
// @todo: Check if morph targets have different UVs to base geometry
@ -402,7 +402,7 @@ bool ColladaAppMesh::animatesFrame(const AppSequence* appSeq)
// the morph weights are animated within the sequence interval
bool animated = false;
if (const domMorph* morph = getMorph()) {
for (int iInput = 0; iInput < morph->getTargets()->getInput_array().getCount(); iInput++) {
for (S32 iInput = 0; iInput < morph->getTargets()->getInput_array().getCount(); iInput++) {
const domInputLocal* input = morph->getTargets()->getInput_array()[iInput];
if (dStrEqual(input->getSemantic(), "MORPH_WEIGHT")) {
const domSource* source = daeSafeCast<domSource>(findInputSource(input));
@ -441,7 +441,7 @@ S32 ColladaAppMesh::addMaterial(const char* symbol)
instanceCtrl->getBind_material();
if (binds) {
const domInstance_material_Array& matArray = binds->getTechnique_common()->getInstance_material_array();
for (int iBind = 0; iBind < matArray.getCount(); iBind++) {
for (S32 iBind = 0; iBind < matArray.getCount(); iBind++) {
if (dStrEqual(matArray[iBind]->getSymbol(), symbol)) {
// Find the index of the bound material in the shape global list
@ -488,7 +488,7 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry)
// about unsupported elements
Vector<BasePrimitive*> meshPrims;
const daeElementRefArray& contents = geometry->getMesh()->getContents();
for (int iElem = 0; iElem < contents.getCount(); iElem++) {
for (S32 iElem = 0; iElem < contents.getCount(); iElem++) {
if (BasePrimitive::isPrimitive(contents[iElem])) {
if (BasePrimitive::isSupportedPrimitive(contents[iElem]))
@ -505,7 +505,7 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry)
VertTupleMap tupleMap;
// Create Torque primitives
for (int iPrim = 0; iPrim < meshPrims.size(); iPrim++) {
for (S32 iPrim = 0; iPrim < meshPrims.size(); iPrim++) {
// Primitive element must have at least 1 triangle
const domListOfUInts* pTriData = meshPrims[iPrim]->getTriangleData();
@ -619,11 +619,11 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry)
}
}
for (int iPrim = 0; iPrim < meshPrims.size(); iPrim++)
for (S32 iPrim = 0; iPrim < meshPrims.size(); iPrim++)
delete meshPrims[iPrim];
}
void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const MatrixF& objectOffset,
void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const MatrixF& objOffset,
Vector<Point3F>& v_points,
Vector<Point3F>& v_norms,
Vector<ColorI>& v_colors,
@ -641,7 +641,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const
// Get the supported primitive elements for this geometry
Vector<BasePrimitive*> meshPrims;
const daeElementRefArray& contents = geometry->getMesh()->getContents();
for (int iElem = 0; iElem < contents.getCount(); iElem++) {
for (S32 iElem = 0; iElem < contents.getCount(); iElem++) {
if (BasePrimitive::isSupportedPrimitive(contents[iElem]))
meshPrims.push_back(BasePrimitive::get(contents[iElem]));
}
@ -659,7 +659,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const
ColorI* colors_array = NULL;
Point2F* uv2s_array = NULL;
for (int iVert = 0; iVert < vertTuples.size(); iVert++) {
for (S32 iVert = 0; iVert < vertTuples.size(); iVert++) {
const VertTuple& tuple = vertTuples[iVert];
@ -693,7 +693,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const
if (appNode->invertMeshes)
points_array[iVert].z = -points_array[iVert].z;
objectOffset.mulP(points_array[iVert]);
objOffset.mulP(points_array[iVert]);
}
if (appendValues || ((tuple.uv >= 0) && (tuple.uv < streams.uvs.size()))) {
@ -751,11 +751,11 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const
}
}
for (int iPrim = 0; iPrim < meshPrims.size(); iPrim++)
for (S32 iPrim = 0; iPrim < meshPrims.size(); iPrim++)
delete meshPrims[iPrim];
}
void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const MatrixF& objectOffset,
void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const MatrixF& objOffset,
Vector<Point3F>& v_points,
Vector<Point3F>& v_norms,
Vector<ColorI>& v_colors,
@ -768,7 +768,7 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M
Vector<const domGeometry*> targetGeoms;
domListOfFloats targetWeights;
for (int iInput = 0; iInput < morph->getTargets()->getInput_array().getCount(); iInput++) {
for (S32 iInput = 0; iInput < morph->getTargets()->getInput_array().getCount(); iInput++) {
const domInputLocal* input = morph->getTargets()->getInput_array()[iInput];
const domSource* source = daeSafeCast<domSource>(findInputSource(input));
@ -777,7 +777,7 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M
_SourceReader srcTargets;
srcTargets.initFromSource(source);
for (int iTarget = 0; iTarget < srcTargets.size(); iTarget++) {
for (S32 iTarget = 0; iTarget < srcTargets.size(); iTarget++) {
// Lookup the element and add to the targets list
daeIDRef idref(srcTargets.getStringValue(iTarget));
idref.setContainer(morph->getDocument()->getDomRoot());
@ -807,7 +807,7 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M
return;
getPrimitives(baseGeometry);
getVertexData(baseGeometry, time, objectOffset, v_points, v_norms, v_colors, v_uvs, v_uv2s, true);
getVertexData(baseGeometry, time, objOffset, 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()];
@ -820,27 +820,27 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M
if (morph->getMethod() == MORPHMETHODTYPE_NORMALIZED) {
F32 weightSum = 0.0f;
for (int iWeight = 0; iWeight < targetWeights.getCount(); iWeight++) {
for (S32 iWeight = 0; iWeight < targetWeights.getCount(); iWeight++) {
weightSum += targetWeights[iWeight];
}
// Result = Base*(1.0-w1-w2 ... -wN) + w1*Target1 + w2*Target2 ... + wN*TargetN
weightSum = mClampF(1.0f - weightSum, 0.0f, 1.0f);
for (int iVert = 0; iVert < vertTuples.size(); iVert++) {
for (S32 iVert = 0; iVert < vertTuples.size(); iVert++) {
points_array[iVert] *= weightSum;
norms_array[iVert] *= weightSum;
uvs_array[iVert] *= weightSum;
}
if (uv2s_array) {
for (int iVert = 0; iVert < vertTuples.size(); iVert++)
for (S32 iVert = 0; iVert < vertTuples.size(); iVert++)
uv2s_array[iVert] *= weightSum;
}
}
// Interpolate using the target geometry and weights
for (int iTarget = 0; iTarget < targetGeoms.size(); iTarget++) {
for (S32 iTarget = 0; iTarget < targetGeoms.size(); iTarget++) {
// Ignore empty weights
if (targetWeights[iTarget] == 0.0f)
@ -863,27 +863,27 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M
if (uv2s_array)
targetUv2s.set(uv2s_array, vertTuples.size());
getVertexData(targetGeoms[iTarget], time, objectOffset, targetPoints, targetNorms, targetColors, targetUvs, targetUv2s, false);
getVertexData(targetGeoms[iTarget], time, objOffset, targetPoints, targetNorms, targetColors, targetUvs, targetUv2s, false);
// Combine with base geometry
for (int iVert = 0; iVert < vertTuples.size(); iVert++) {
for (S32 iVert = 0; iVert < vertTuples.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 (int iVert = 0; iVert < vertTuples.size(); iVert++)
for (S32 iVert = 0; iVert < vertTuples.size(); iVert++)
uv2s_array[iVert] += targetUv2s[iVert] * targetWeights[iTarget];
}
if (colors_array) {
for (int iVert = 0; iVert < vertTuples.size(); iVert++)
for (S32 iVert = 0; iVert < vertTuples.size(); iVert++)
colors_array[iVert] += targetColors[iVert] * (F32)targetWeights[iTarget];
}
}
}
void ColladaAppMesh::lockMesh(F32 t, const MatrixF& objectOffset)
void ColladaAppMesh::lockMesh(F32 t, const MatrixF& objOffset)
{
// Find the geometry element for this mesh. Could be one of 3 things:
// 1) a simple static mesh (Collada <geometry> element)
@ -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<domGeometry>(geometry));
getVertexData(daeSafeCast<domGeometry>(geometry), t, objectOffset, points, normals, colors, uvs, uv2s, true);
getVertexData(daeSafeCast<domGeometry>(geometry), t, objOffset, points, normals, colors, uvs, uv2s, true);
}
else if (geometry->getElementType() == COLLADA_TYPE::MORPH) {
getMorphVertexData(daeSafeCast<domMorph>(geometry), t, objectOffset, points, normals, colors, uvs, uv2s);
getMorphVertexData(daeSafeCast<domMorph>(geometry), t, objOffset, points, normals, colors, uvs, uv2s);
}
else {
daeErrorHandler::get()->handleWarning(avar("Unsupported geometry type "
@ -963,7 +963,7 @@ void ColladaAppMesh::lookupSkinData()
// vertex may have multiple [bone, weight] pairs in the array)
Vector<U32> vindicesOffset;
const domInt* vindices = (domInt*)weights_v.getRaw(0);
for (int iWeight = 0; iWeight < weights_vcount.getCount(); iWeight++) {
for (S32 iWeight = 0; iWeight < weights_vcount.getCount(); iWeight++) {
// Store the offset into the vindices array for this vertex
vindicesOffset.push_back(vindices - (domInt*)weights_v.getRaw(0));
vindices += (weights_vcount[iWeight]*2); // 2 indices [bone, weight] per vert
@ -971,14 +971,14 @@ void ColladaAppMesh::lookupSkinData()
// Set vertex weights
bool tooManyWeightsWarning = false;
for (int iVert = 0; iVert < vertsPerFrame; iVert++) {
for (S32 iVert = 0; iVert < vertsPerFrame; iVert++) {
const domUint* vcount = (domUint*)weights_vcount.getRaw(0);
const domInt* vindices = (domInt*)weights_v.getRaw(0);
vindices += vindicesOffset[vertTuples[iVert].vertex];
S32 nonZeroWeightCount = 0;
for (int iWeight = 0; iWeight < vcount[vertTuples[iVert].vertex]; iWeight++) {
for (S32 iWeight = 0; iWeight < vcount[vertTuples[iVert].vertex]; iWeight++) {
S32 bIndex = vindices[iWeight*2];
F32 bWeight = streams.weights.getFloatValue( vindices[iWeight*2 + 1] );
@ -1027,12 +1027,12 @@ void ColladaAppMesh::lookupSkinData()
}
// Normalize vertex weights (force weights for each vert to sum to 1)
int iWeight = 0;
S32 iWeight = 0;
while (iWeight < weight.size()) {
// Find the last weight with the same vertex number, and sum all weights for
// that vertex
F32 invTotalWeight = 0;
int iLast;
S32 iLast;
for (iLast = iWeight; iLast < weight.size(); iLast++) {
if (vertexIndex[iLast] != vertexIndex[iWeight])
break;
@ -1048,7 +1048,7 @@ void ColladaAppMesh::lookupSkinData()
// Add dummy AppNodes to allow Collada joints to be mapped to 3space nodes
bones.setSize(streams.joints.size());
initialTransforms.setSize(streams.joints.size());
for (int iJoint = 0; iJoint < streams.joints.size(); iJoint++)
for (S32 iJoint = 0; iJoint < streams.joints.size(); iJoint++)
{
const char* jointName = streams.joints.getStringValue(iJoint);
@ -1056,7 +1056,7 @@ void ColladaAppMesh::lookupSkinData()
const domNode* joint = 0;
if (instanceCtrl->getSkeleton_array().getCount()) {
// Search for the node using the <skeleton> as the base element
for (int iSkel = 0; iSkel < instanceCtrl->getSkeleton_array().getCount(); iSkel++) {
for (S32 iSkel = 0; iSkel < instanceCtrl->getSkeleton_array().getCount(); iSkel++) {
xsAnyURI skeleton = instanceCtrl->getSkeleton_array()[iSkel]->getValue();
daeSIDResolver resolver(skeleton.getElement(), jointName);
joint = daeSafeCast<domNode>(resolver.getElement());

View file

@ -109,11 +109,11 @@ protected:
bool checkGeometryType(const daeElement* element);
void getPrimitives(const domGeometry* geometry);
void getVertexData( const domGeometry* geometry, F32 time, const MatrixF& objectOffset,
void getVertexData( const domGeometry* geometry, F32 time, const MatrixF& objOffset,
Vector<Point3F>& points, Vector<Point3F>& norms, Vector<ColorI>& colors,
Vector<Point2F>& uvs, Vector<Point2F>& uv2s, bool appendValues);
void getMorphVertexData( const domMorph* morph, F32 time, const MatrixF& objectOffset,
void getMorphVertexData( const domMorph* morph, F32 time, const MatrixF& objOffset,
Vector<Point3F>& points, Vector<Point3F>& norms, Vector<ColorI>& colors,
Vector<Point2F>& uvs, Vector<Point2F>& uv2s );
@ -211,8 +211,8 @@ public:
/// Generate the vertex, normal and triangle data for the mesh.
///
/// @param time Time at which to generate the mesh data
/// @param objectOffset Transform to apply to the generated data (bounds transform)
void lockMesh(F32 time, const MatrixF& objectOffset);
/// @param objOffset Transform to apply to the generated data (bounds transform)
void lockMesh(F32 time, const MatrixF& objOffset);
/// Get the transform of this mesh at a certain time
///

View file

@ -90,7 +90,7 @@ ColladaAppNode::ColladaAppNode(const domNode* node, ColladaAppNode* parent)
dFree( properties );
// Create vector of transform elements
for (int iChild = 0; iChild < node->getContents().getCount(); iChild++) {
for (S32 iChild = 0; iChild < node->getContents().getCount(); iChild++) {
switch (node->getContents()[iChild]->getElementType()) {
case COLLADA_TYPE::TRANSLATE:
case COLLADA_TYPE::ROTATE:
@ -109,7 +109,7 @@ ColladaAppNode::ColladaAppNode(const domNode* node, ColladaAppNode* parent)
void ColladaAppNode::buildChildList()
{
// Process children: collect <node> and <instance_node> elements
for (int iChild = 0; iChild < p_domNode->getContents().getCount(); iChild++) {
for (S32 iChild = 0; iChild < p_domNode->getContents().getCount(); iChild++) {
daeElement* child = p_domNode->getContents()[iChild];
switch (child->getElementType()) {
@ -139,7 +139,7 @@ void ColladaAppNode::buildChildList()
void ColladaAppNode::buildMeshList()
{
// Process children: collect <instance_geometry> and <instance_controller> elements
for (int iChild = 0; iChild < p_domNode->getContents().getCount(); iChild++) {
for (S32 iChild = 0; iChild < p_domNode->getContents().getCount(); iChild++) {
daeElement* child = p_domNode->getContents()[iChild];
switch (child->getElementType()) {
@ -167,7 +167,7 @@ bool ColladaAppNode::animatesTransform(const AppSequence* appSeq)
{
// Check if any of this node's transform elements are animated during the
// sequence interval
for (int iTxfm = 0; iTxfm < nodeTransforms.size(); iTxfm++) {
for (S32 iTxfm = 0; iTxfm < nodeTransforms.size(); iTxfm++) {
if (nodeTransforms[iTxfm].isAnimated(appSeq->getStart(), appSeq->getEnd()))
return true;
}
@ -227,7 +227,7 @@ MatrixF ColladaAppNode::getTransform(F32 time)
}
// Multiply by local node transform elements
for (int iTxfm = 0; iTxfm < nodeTransforms.size(); iTxfm++) {
for (S32 iTxfm = 0; iTxfm < nodeTransforms.size(); iTxfm++) {
MatrixF mat(true);

View file

@ -74,7 +74,7 @@ F32 ColladaAppSequence::getBlendRefTime()
void ColladaAppSequence::setActive(bool active)
{
for (int iAnim = 0; iAnim < getClip()->getInstance_animation_array().getCount(); iAnim++) {
for (S32 iAnim = 0; iAnim < getClip()->getInstance_animation_array().getCount(); iAnim++) {
domAnimation* anim = daeSafeCast<domAnimation>(getClip()->getInstance_animation_array()[iAnim]->getUrl().getElement());
if (anim)
setAnimationActive(anim, active);
@ -84,7 +84,7 @@ void ColladaAppSequence::setActive(bool active)
void ColladaAppSequence::setAnimationActive(const domAnimation* anim, bool active)
{
// Enabled/disable data channels for this animation
for (int iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) {
for (S32 iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) {
domChannel* channel = anim->getChannel_array()[iChannel];
AnimData* animData = reinterpret_cast<AnimData*>(channel->getUserData());
if (animData)
@ -92,6 +92,6 @@ void ColladaAppSequence::setAnimationActive(const domAnimation* anim, bool activ
}
// Recurse into child animations
for (int iAnim = 0; iAnim < anim->getAnimation_array().getCount(); iAnim++)
for (S32 iAnim = 0; iAnim < anim->getAnimation_array().getCount(); iAnim++)
setAnimationActive(anim->getAnimation_array()[iAnim], active);
}

View file

@ -59,8 +59,8 @@ protected:
template<class T> const domTechnique* findExtraTechnique(const T* element, const char* name) const
{
if (element) {
for (int iExt = 0; iExt < element->getExtra_array().getCount(); iExt++) {
for (int iTech = 0; iTech < element->getExtra_array()[iExt]->getTechnique_array().getCount(); iTech++) {
for (S32 iExt = 0; iExt < element->getExtra_array().getCount(); iExt++) {
for (S32 iTech = 0; iTech < element->getExtra_array()[iExt]->getTechnique_array().getCount(); iTech++) {
if (dStrEqual(element->getExtra_array()[iExt]->getTechnique_array()[iTech]->getProfile(), name))
return element->getExtra_array()[iExt]->getTechnique_array()[iTech];
}
@ -75,7 +75,7 @@ protected:
const domCommon_color_or_texture_type_complexType::domTexture* element, const char* name) const
{
if (element && element->getExtra()) {
for (int iTech = 0; iTech < element->getExtra()->getTechnique_array().getCount(); iTech++) {
for (S32 iTech = 0; iTech < element->getExtra()->getTechnique_array().getCount(); iTech++) {
if (dStrEqual(element->getExtra()->getTechnique_array()[iTech]->getProfile(), name))
return element->getExtra()->getTechnique_array()[iTech];
}
@ -88,7 +88,7 @@ protected:
{
if (pTechnique) {
// search the technique contents for the desired parameter
for (int iParam = 0; iParam < pTechnique->getContents().getCount(); iParam++) {
for (S32 iParam = 0; iParam < pTechnique->getContents().getCount(); iParam++) {
const domAny* param = daeSafeCast<domAny>(pTechnique->getContents()[iParam]);
if (param && !dStrcmp(param->getElementName(), name))
return param;
@ -290,7 +290,7 @@ public:
// Torque profile
pTechnique = findExtraTechnique(clip, "Torque");
GET_EXTRA_PARAM(num_triggers, 0);
for (int iTrigger = 0; iTrigger < num_triggers; iTrigger++) {
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);

View file

@ -50,7 +50,7 @@ static void processNode(GuiTreeViewCtrl* tree, domNode* node, S32 parentID, Scen
S32 nodeID = tree->insertItem(parentID, _GetNameOrId(node), "node", "", 0, 0);
// Update mesh and poly counts
for (int i = 0; i < node->getContents().getCount(); i++)
for (S32 i = 0; i < node->getContents().getCount(); i++)
{
domGeometry* geom = 0;
const char* elemName = "";
@ -178,13 +178,13 @@ ConsoleFunction( enumColladaForImport, bool, 3, 3,
SceneStats stats;
// Query DOM for shape summary details
for (int i = 0; i < root->getLibrary_visual_scenes_array().getCount(); i++)
for (S32 i = 0; i < root->getLibrary_visual_scenes_array().getCount(); i++)
{
const domLibrary_visual_scenes* libScenes = root->getLibrary_visual_scenes_array()[i];
for (int j = 0; j < libScenes->getVisual_scene_array().getCount(); j++)
for (S32 j = 0; j < libScenes->getVisual_scene_array().getCount(); j++)
{
const domVisual_scene* visualScene = libScenes->getVisual_scene_array()[j];
for (int k = 0; k < visualScene->getNode_array().getCount(); k++)
for (S32 k = 0; k < visualScene->getNode_array().getCount(); k++)
processNode(tree, visualScene->getNode_array()[k], nodesID, stats);
}
}

View file

@ -215,11 +215,11 @@ ConsoleFunction( loadColladaLights, bool, 2, 4,
// First grab all of the top-level nodes
Vector<ColladaAppNode*> sceneNodes;
for (int iSceneLib = 0; iSceneLib < root->getLibrary_visual_scenes_array().getCount(); iSceneLib++) {
for (S32 iSceneLib = 0; iSceneLib < root->getLibrary_visual_scenes_array().getCount(); iSceneLib++) {
const domLibrary_visual_scenes* libScenes = root->getLibrary_visual_scenes_array()[iSceneLib];
for (int iScene = 0; iScene < libScenes->getVisual_scene_array().getCount(); iScene++) {
for (S32 iScene = 0; iScene < libScenes->getVisual_scene_array().getCount(); iScene++) {
const domVisual_scene* visualScene = libScenes->getVisual_scene_array()[iScene];
for (int iNode = 0; iNode < visualScene->getNode_array().getCount(); iNode++)
for (S32 iNode = 0; iNode < visualScene->getNode_array().getCount(); iNode++)
sceneNodes.push_back(new ColladaAppNode(visualScene->getNode_array()[iNode]));
}
}

View file

@ -50,6 +50,15 @@
#include "core/util/zip/zipVolume.h"
#include "gfx/bitmap/gBitmap.h"
MODULE_BEGIN( ColladaShapeLoader )
MODULE_INIT_AFTER( ShapeLoader )
MODULE_INIT
{
TSShapeLoader::addFormat("Collada", "dae");
TSShapeLoader::addFormat("Google Earth", "kmz");
}
MODULE_END;
//
static DAE sDAE; // Collada model database (holds the last loaded file)
static Torque::Path sLastPath; // Path of the last loaded Collada file
@ -96,8 +105,8 @@ ColladaShapeLoader::ColladaShapeLoader(domCOLLADA* _root)
ColladaShapeLoader::~ColladaShapeLoader()
{
// Delete all of the animation channels
for (int iAnim = 0; iAnim < animations.size(); iAnim++) {
for (int iChannel = 0; iChannel < animations[iAnim]->size(); iChannel++)
for (S32 iAnim = 0; iAnim < animations.size(); iAnim++) {
for (S32 iChannel = 0; iChannel < animations[iAnim]->size(); iChannel++)
delete (*animations[iAnim])[iChannel];
delete animations[iAnim];
}
@ -113,7 +122,7 @@ void ColladaShapeLoader::processAnimation(const domAnimation* anim, F32& maxEndT
const char* sSKEWNames[] = { ".ROTATEX", ".ROTATEY", ".ROTATEZ", ".AROUNDX", ".AROUNDY", ".AROUNDZ", ".ANGLE", "" };
const char* sNullNames[] = { "" };
for (int iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) {
for (S32 iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) {
// Get the animation elements: <channel>, <sampler>
domChannel* channel = anim->getChannel_array()[iChannel];
@ -150,7 +159,7 @@ void ColladaShapeLoader::processAnimation(const domAnimation* anim, F32& maxEndT
channel->setUserData(targetChannels->last());
AnimData& data = *targetChannels->last();
for (int iInput = 0; iInput < sampler->getInput_array().getCount(); iInput++) {
for (S32 iInput = 0; iInput < sampler->getInput_array().getCount(); iInput++) {
const domInputLocal* input = sampler->getInput_array()[iInput];
const domSource* source = daeSafeCast<domSource>(input->getSource().getElement());
@ -219,7 +228,7 @@ void ColladaShapeLoader::processAnimation(const domAnimation* anim, F32& maxEndT
}
// Process child animations
for (int iAnim = 0; iAnim < anim->getAnimation_array().getCount(); iAnim++)
for (S32 iAnim = 0; iAnim < anim->getAnimation_array().getCount(); iAnim++)
processAnimation(anim->getAnimation_array()[iAnim], maxEndTime, minFrameTime);
}
@ -227,20 +236,20 @@ void ColladaShapeLoader::enumerateScene()
{
// Get animation clips
Vector<const domAnimation_clip*> animationClips;
for (int iClipLib = 0; iClipLib < root->getLibrary_animation_clips_array().getCount(); iClipLib++) {
for (S32 iClipLib = 0; iClipLib < root->getLibrary_animation_clips_array().getCount(); iClipLib++) {
const domLibrary_animation_clips* libraryClips = root->getLibrary_animation_clips_array()[iClipLib];
for (int iClip = 0; iClip < libraryClips->getAnimation_clip_array().getCount(); iClip++)
for (S32 iClip = 0; iClip < libraryClips->getAnimation_clip_array().getCount(); iClip++)
appSequences.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 <animation_clip> element
for (int iSeq = 0; iSeq < appSequences.size(); iSeq++) {
for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) {
ColladaAppSequence* appSeq = dynamic_cast<ColladaAppSequence*>(appSequences[iSeq]);
F32 maxEndTime = 0;
F32 minFrameTime = 1000.0f;
for (int iAnim = 0; iAnim < appSeq->getClip()->getInstance_animation_array().getCount(); iAnim++) {
for (S32 iAnim = 0; iAnim < appSeq->getClip()->getInstance_animation_array().getCount(); iAnim++) {
domAnimation* anim = daeSafeCast<domAnimation>(appSeq->getClip()->getInstance_animation_array()[iAnim]->getUrl().getElement());
if (anim)
processAnimation(anim, maxEndTime, minFrameTime);
@ -256,11 +265,11 @@ void ColladaShapeLoader::enumerateScene()
// First grab all of the top-level nodes
Vector<domNode*> sceneNodes;
for (int iSceneLib = 0; iSceneLib < root->getLibrary_visual_scenes_array().getCount(); iSceneLib++) {
for (S32 iSceneLib = 0; iSceneLib < root->getLibrary_visual_scenes_array().getCount(); iSceneLib++) {
const domLibrary_visual_scenes* libScenes = root->getLibrary_visual_scenes_array()[iSceneLib];
for (int iScene = 0; iScene < libScenes->getVisual_scene_array().getCount(); iScene++) {
for (S32 iScene = 0; iScene < libScenes->getVisual_scene_array().getCount(); iScene++) {
const domVisual_scene* visualScene = libScenes->getVisual_scene_array()[iScene];
for (int iNode = 0; iNode < visualScene->getNode_array().getCount(); iNode++)
for (S32 iNode = 0; iNode < visualScene->getNode_array().getCount(); iNode++)
sceneNodes.push_back(visualScene->getNode_array()[iNode]);
}
}
@ -272,10 +281,10 @@ void ColladaShapeLoader::enumerateScene()
case ColladaUtils::ImportOptions::DetectDTS:
// Check for a baseXX->startXX hierarchy at the top-level, if we find
// one, use trailing numbers for LOD, otherwise use a single size
for (int iNode = 0; singleDetail && (iNode < sceneNodes.size()); iNode++) {
for (S32 iNode = 0; singleDetail && (iNode < sceneNodes.size()); iNode++) {
domNode* node = sceneNodes[iNode];
if (dStrStartsWith(_GetNameOrId(node), "base")) {
for (int iChild = 0; iChild < node->getNode_array().getCount(); iChild++) {
for (S32 iChild = 0; iChild < node->getNode_array().getCount(); iChild++) {
domNode* child = node->getNode_array()[iChild];
if (dStrStartsWith(_GetNameOrId(child), "start")) {
singleDetail = false;
@ -484,7 +493,7 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false)
// If importing a sketchup file, the paths will point inside the KMZ so we need to cache them.
if (copyTextures)
{
for (int iMat = 0; iMat < persistMgr.getDirtyList().size(); iMat++)
for (S32 iMat = 0; iMat < persistMgr.getDirtyList().size(); iMat++)
{
Material *mat = dynamic_cast<Material*>( persistMgr.getDirtyList()[iMat].getObject() );

View file

@ -84,7 +84,7 @@ const domProfile_COMMON* ColladaUtils::findEffectCommonProfile(const domEffect*
if (effect) {
// Find the COMMON profile
const domFx_profile_abstract_Array& profiles = effect->getFx_profile_abstract_array();
for (int iProfile = 0; iProfile < profiles.getCount(); iProfile++) {
for (S32 iProfile = 0; iProfile < profiles.getCount(); iProfile++) {
if (profiles[iProfile]->getElementType() == COLLADA_TYPE::PROFILE_COMMON)
return daeSafeCast<domProfile_COMMON>(profiles[iProfile]);
}
@ -245,7 +245,7 @@ BasePrimitive* BasePrimitive::get(const daeElement* element)
// Collada animation curves
/// Determine which elements are being targeted
void AnimData::parseTargetString(const char* target, int fullCount, const char* elements[])
void AnimData::parseTargetString(const char* target, S32 fullCount, const char* elements[])
{
// Assume targeting all elements at offset 0
targetValueCount = fullCount;
@ -253,7 +253,7 @@ void AnimData::parseTargetString(const char* target, int fullCount, const char*
// Check for array syntax: (n) or (n)(m)
if (const char* p = dStrchr(target, '(')) {
int indN, indM;
S32 indN, indM;
if (dSscanf(p, "(%d)(%d)", &indN, &indM) == 2) {
targetValueOffset = (indN * 4) + indM; // @todo: 4x4 matrix only
targetValueCount = 1;
@ -265,7 +265,7 @@ void AnimData::parseTargetString(const char* target, int fullCount, const char*
}
else if (const char* p = dStrrchr(target, '.')) {
// Check for named elements
for (int iElem = 0; elements[iElem][0] != 0; iElem++) {
for (S32 iElem = 0; elements[iElem][0] != 0; iElem++) {
if (!dStrcmp(p, elements[iElem])) {
targetValueOffset = iElem;
targetValueCount = 1;
@ -278,9 +278,9 @@ void AnimData::parseTargetString(const char* target, int fullCount, const char*
/// Solve the cubic spline B(s) = param for s
F32 AnimData::invertParamCubic(F32 param, F32 x0, F32 x1, F32 x2, F32 x3) const
{
const double INVERTPARAMCUBIC_TOL = 1.0e-09;
const double INVERTPARAMCUBIC_SMALLERTOL = 1.0e-20;
const double INVERTPARAMCUBIC_MAXIT = 100;
const F64 INVERTPARAMCUBIC_TOL = 1.0e-09;
const F64 INVERTPARAMCUBIC_SMALLERTOL = 1.0e-20;
const F64 INVERTPARAMCUBIC_MAXIT = 100;
// check input value for outside range
if ((param - x0) < INVERTPARAMCUBIC_SMALLERTOL)
@ -295,12 +295,12 @@ F32 AnimData::invertParamCubic(F32 param, F32 x0, F32 x1, F32 x2, F32 x3) const
F32 v = 1.0f;
while (iterations < INVERTPARAMCUBIC_MAXIT) {
double a = (x0 + x1)*0.5f;
double b = (x1 + x2)*0.5f;
double c = (x2 + x3)*0.5f;
double d = (a + b)*0.5f;
double e = (b + c)*0.5f;
double f = (d + e)*0.5f;
F64 a = (x0 + x1)*0.5f;
F64 b = (x1 + x2)*0.5f;
F64 c = (x2 + x3)*0.5f;
F64 d = (a + b)*0.5f;
F64 e = (b + c)*0.5f;
F64 f = (d + e)*0.5f;
if (mFabs(f - param) < INVERTPARAMCUBIC_TOL)
break;
@ -344,7 +344,7 @@ void AnimData::interpValue(F32 t, U32 offset, double* value) const
t = mClampF(t, curveStart, curveEnd);
// find the index of the input keyframe BEFORE 't'
int index;
S32 index;
for (index = 0; index < input.size()-2; index++) {
if (input.getFloatValue(index + 1) > t)
break;
@ -470,7 +470,7 @@ void AnimData::interpValue(F32 t, U32 offset, const char** value) const
t = mClampF(t, curveStart, curveEnd);
// find the index of the input keyframe BEFORE 't'
int index;
S32 index;
for (index = 0; index < input.size()-2; index++) {
if (input.getFloatValue(index + 1) > t)
break;
@ -487,9 +487,9 @@ void AnimData::interpValue(F32 t, U32 offset, const char** value) const
static void conditioner_fixupTextureSIDs(domCOLLADA* root)
{
for (int iLib = 0; iLib < root->getLibrary_effects_array().getCount(); iLib++) {
for (S32 iLib = 0; iLib < root->getLibrary_effects_array().getCount(); iLib++) {
domLibrary_effects* lib = root->getLibrary_effects_array()[iLib];
for (int iEffect = 0; iEffect < lib->getEffect_array().getCount(); iEffect++) {
for (S32 iEffect = 0; iEffect < lib->getEffect_array().getCount(); iEffect++) {
domEffect* effect = lib->getEffect_array()[iEffect];
const domCommon_color_or_texture_type_complexType* diffuse = findEffectDiffuse(effect);
if (!diffuse || !diffuse->getTexture())
@ -542,9 +542,9 @@ static void conditioner_fixupTextureSIDs(domCOLLADA* root)
static void conditioner_fixupImageURIs(domCOLLADA* root)
{
for (int iLib = 0; iLib < root->getLibrary_images_array().getCount(); iLib++) {
for (S32 iLib = 0; iLib < root->getLibrary_images_array().getCount(); iLib++) {
domLibrary_images* lib = root->getLibrary_images_array()[iLib];
for (int iImage = 0; iImage < lib->getImage_array().getCount(); iImage++) {
for (S32 iImage = 0; iImage < lib->getImage_array().getCount(); iImage++) {
domImage* image = lib->getImage_array()[iImage];
if (image->getInit_from()) {
xsAnyURI& uri = image->getInit_from()->getValue();
@ -595,7 +595,7 @@ static void conditioner_fixupTransparency(domCOLLADA* root)
// Get the <authoring_tool> string
const char *authoringTool = "";
if (const domAsset* asset = root->getAsset()) {
for (int iContrib = 0; iContrib < asset->getContributor_array().getCount(); iContrib++) {
for (S32 iContrib = 0; iContrib < asset->getContributor_array().getCount(); iContrib++) {
const domAsset::domContributor* contrib = asset->getContributor_array()[iContrib];
if (contrib->getAuthoring_tool()) {
authoringTool = contrib->getAuthoring_tool()->getValue();
@ -608,7 +608,7 @@ static void conditioner_fixupTransparency(domCOLLADA* root)
bool invertTransparency = false;
const char *toolNames[] = { "FBX COLLADA exporter", "Google SketchUp",
"Illusoft Collada Exporter", "FCollada" };
for (int iName = 0; iName < (sizeof(toolNames)/sizeof(toolNames[0])); iName++) {
for (S32 iName = 0; iName < (sizeof(toolNames)/sizeof(toolNames[0])); iName++) {
if (dStrstr(authoringTool, toolNames[iName])) {
invertTransparency = true;
break;
@ -619,9 +619,9 @@ static void conditioner_fixupTransparency(domCOLLADA* root)
return;
// Invert transparency as required for each effect
for (int iLib = 0; iLib < root->getLibrary_effects_array().getCount(); iLib++) {
for (S32 iLib = 0; iLib < root->getLibrary_effects_array().getCount(); iLib++) {
domLibrary_effects* lib = root->getLibrary_effects_array()[iLib];
for (int iEffect = 0; iEffect < lib->getEffect_array().getCount(); iEffect++) {
for (S32 iEffect = 0; iEffect < lib->getEffect_array().getCount(); iEffect++) {
domEffect* effect = lib->getEffect_array()[iEffect];
// Find the common profile
@ -658,9 +658,9 @@ static void conditioner_fixupTransparency(domCOLLADA* root)
static void conditioner_checkBindShapeMatrix(domCOLLADA* root)
{
for (int iLib = 0; iLib < root->getLibrary_controllers_array().getCount(); iLib++) {
for (S32 iLib = 0; iLib < root->getLibrary_controllers_array().getCount(); iLib++) {
domLibrary_controllers* lib = root->getLibrary_controllers_array().get(iLib);
for (int iCon = 0; iCon < lib->getController_array().getCount(); iCon++) {
for (S32 iCon = 0; iCon < lib->getController_array().getCount(); iCon++) {
domController* con = lib->getController_array().get(iCon);
if (con->getSkin() && con->getSkin()->getBind_shape_matrix()) {
@ -677,14 +677,14 @@ static void conditioner_checkBindShapeMatrix(domCOLLADA* root)
static void conditioner_fixupVertexWeightJoints(domCOLLADA* root)
{
for (int iLib = 0; iLib < root->getLibrary_controllers_array().getCount(); iLib++) {
for (S32 iLib = 0; iLib < root->getLibrary_controllers_array().getCount(); iLib++) {
domLibrary_controllers* lib = root->getLibrary_controllers_array().get(iLib);
for (int iCon = 0; iCon < lib->getController_array().getCount(); iCon++) {
for (S32 iCon = 0; iCon < lib->getController_array().getCount(); iCon++) {
domController* con = lib->getController_array().get(iCon);
if (con->getSkin() && con->getSkin()->getVertex_weights())
{
domInputLocalOffset_Array& vw_inputs = con->getSkin()->getVertex_weights()->getInput_array();
for (int vInput = 0; vInput < vw_inputs.getCount(); vInput++) {
for (S32 vInput = 0; vInput < vw_inputs.getCount(); vInput++) {
domInputLocalOffset *vw_input = vw_inputs.get(vInput);
if (dStrEqual(vw_input->getSemantic(), "JOINT")) {
@ -695,7 +695,7 @@ static void conditioner_fixupVertexWeightJoints(domCOLLADA* root)
// Copy the value from the <joints> JOINTS input instead
domInputLocal_Array& joint_inputs = con->getSkin()->getJoints()->getInput_array();
for (int jInput = 0; jInput < joint_inputs.getCount(); jInput++) {
for (S32 jInput = 0; jInput < joint_inputs.getCount(); jInput++) {
domInputLocal *joint_input = joint_inputs.get(jInput);
if (dStrEqual(joint_input->getSemantic(), "JOINT")) {
@ -714,16 +714,16 @@ static void conditioner_fixupVertexWeightJoints(domCOLLADA* root)
static void conditioner_createDefaultClip(domCOLLADA* root)
{
// Check if the document has any <animation_clip>s
for (int iLib = 0; iLib < root->getLibrary_animation_clips_array().getCount(); iLib++) {
for (S32 iLib = 0; iLib < root->getLibrary_animation_clips_array().getCount(); iLib++) {
if (root->getLibrary_animation_clips_array()[iLib]->getAnimation_clip_array().getCount())
return;
}
// Get all top-level <animation>s into an array
domAnimation_Array animations;
for (int iAnimLib = 0; iAnimLib < root->getLibrary_animations_array().getCount(); iAnimLib++) {
for (S32 iAnimLib = 0; iAnimLib < root->getLibrary_animations_array().getCount(); iAnimLib++) {
const domLibrary_animations* libraryAnims = root->getLibrary_animations_array()[iAnimLib];
for (int iAnim = 0; iAnim < libraryAnims->getAnimation_array().getCount(); iAnim++)
for (S32 iAnim = 0; iAnim < libraryAnims->getAnimation_array().getCount(); iAnim++)
animations.append(libraryAnims->getAnimation_array()[iAnim]);
}
@ -748,7 +748,7 @@ static void conditioner_createDefaultClip(domCOLLADA* root)
// Add all top_level animations to the clip (sub-animations will be included
// when the clip is procesed)
for (int iAnim = 0; iAnim < animations.getCount(); iAnim++) {
for (S32 iAnim = 0; iAnim < animations.getCount(); iAnim++) {
if (!animations[iAnim]->getId())
animations[iAnim]->setId(avar("dummy-animation-id%d", iAnim));
CREATE_ELEMENT(animation_clip, instance_animation, domInstanceWithExtra)
@ -767,7 +767,7 @@ static void conditioner_createDefaultClip(domCOLLADA* root)
static void conditioner_fixupAnimation(domAnimation* anim)
{
for (int iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) {
for (S32 iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) {
// Get the animation elements: <channel>, <sampler>
domChannel* channel = anim->getChannel_array()[iChannel];
@ -848,7 +848,7 @@ static void conditioner_fixupAnimation(domAnimation* anim)
}
// Process child animations
for (int iAnim = 0; iAnim < anim->getAnimation_array().getCount(); iAnim++)
for (S32 iAnim = 0; iAnim < anim->getAnimation_array().getCount(); iAnim++)
conditioner_fixupAnimation(anim->getAnimation_array()[iAnim]);
}
@ -893,9 +893,9 @@ void ColladaUtils::applyConditioners(domCOLLADA* root)
// 2) Some exporters generate visibility animations but don't add the FCOLLADA
// extension, so the target doesn't actually exist! Detect this situation
// and add the extension manually so the animation still works.
for (int iLib = 0; iLib < root->getLibrary_animations_array().getCount(); iLib++) {
for (S32 iLib = 0; iLib < root->getLibrary_animations_array().getCount(); iLib++) {
const domLibrary_animations* lib = root->getLibrary_animations_array()[iLib];
for (int iAnim = 0; iAnim < lib->getAnimation_array().getCount(); iAnim++)
for (S32 iAnim = 0; iAnim < lib->getAnimation_array().getCount(); iAnim++)
conditioner_fixupAnimation(lib->getAnimation_array()[iAnim]);
}
}
@ -946,7 +946,7 @@ void ColladaUtils::exportColladaHeader(TiXmlElement* rootNode)
TiXmlElement* authoringToolNode = new TiXmlElement("authoring_tool");
contributorNode->LinkEndChild(authoringToolNode);
TiXmlText* authorText = new TiXmlText(avar("%s %s Interior Exporter", getEngineProductString(), getVersionString()));
TiXmlText* authorText = new TiXmlText(avar("%s %s Object Exporter", getEngineProductString(), getVersionString()));
authoringToolNode->LinkEndChild(authorText);
TiXmlElement* commentsNode = new TiXmlElement("comments");

View file

@ -185,7 +185,7 @@ template<> inline MatrixF vecToMatrixF<domRotate>(const domListOfFloats& vec)
template<> inline MatrixF vecToMatrixF<domMatrix>(const domListOfFloats& vec)
{
MatrixF mat;
for (int i = 0; i < 16; i++)
for (S32 i = 0; i < 16; i++)
mat[i] = vec[i];
return mat;
}
@ -332,7 +332,7 @@ public:
// If no input params were specified, just map the source params directly
if (!offsets.size()) {
for (int iParam = 0; iParam < accessor->getParam_array().getCount(); iParam++)
for (S32 iParam = 0; iParam < accessor->getParam_array().getCount(); iParam++)
offsets.push_back(iParam);
}
@ -348,9 +348,9 @@ public:
//------------------------------------------------------
// Get a pointer to the start of a group of values (index advances by stride)
//template<class T> T getArrayData(int index) const { return 0; }
//template<class T> T getArrayData(S32 index) const { return 0; }
const double* getStringArrayData(int index) const
const double* getStringArrayData(S32 index) const
{
if ((index >= 0) && (index < size())) {
if (source->getFloat_array())
@ -361,9 +361,9 @@ public:
//------------------------------------------------------
// Read a single value from the source array
//template<class T> T getValue(int index) const { return T; }
//template<class T> T getValue(S32 index) const { return T; }
const char* getStringValue(int index) const
const char* getStringValue(S32 index) const
{
if ((index >= 0) && (index < size())) {
// could be plain strings or IDREFs
@ -375,7 +375,7 @@ public:
return "";
}
F32 getFloatValue(int index) const
F32 getFloatValue(S32 index) const
{
F32 value(0);
if (const double* data = getStringArrayData(index))
@ -383,7 +383,7 @@ public:
return value;
}
Point2F getPoint2FValue(int index) const
Point2F getPoint2FValue(S32 index) const
{
Point2F value(0, 0);
if (const double* data = getStringArrayData(index))
@ -391,7 +391,7 @@ public:
return value;
}
Point3F getPoint3FValue(int index) const
Point3F getPoint3FValue(S32 index) const
{
Point3F value(1, 0, 0);
if (const double* data = getStringArrayData(index))
@ -399,7 +399,7 @@ public:
return value;
}
ColorI getColorIValue(int index) const
ColorI getColorIValue(S32 index) const
{
ColorI value(255, 255, 255, 255);
if (const double* data = getStringArrayData(index))
@ -413,11 +413,11 @@ public:
return value;
}
MatrixF getMatrixFValue(int index) const
MatrixF getMatrixFValue(S32 index) const
{
MatrixF value(true);
if (const double* data = getStringArrayData(index)) {
for (int i = 0; i < 16; i++)
for (S32 i = 0; i < 16; i++)
value[i] = data[i];
}
return value;
@ -430,6 +430,8 @@ public:
class BasePrimitive
{
public:
virtual ~BasePrimitive() { }
/// Return true if the element is a geometric primitive type
static bool isPrimitive(const daeElement* element)
{
@ -486,7 +488,7 @@ public:
// Determine stride
stride = 0;
for (int iInput = 0; iInput < getInputs().getCount(); iInput++) {
for (S32 iInput = 0; iInput < getInputs().getCount(); iInput++) {
if (getInputs()[iInput]->getOffset() >= stride)
stride = getInputs()[iInput]->getOffset() + 1;
}
@ -524,7 +526,7 @@ template<> inline const domListOfUInts *ColladaPrimitive<domTristrips>::getTrian
// Convert strips to triangles
pTriangleData = new domListOfUInts();
for (int iStrip = 0; iStrip < primitive->getCount(); iStrip++) {
for (S32 iStrip = 0; iStrip < primitive->getCount(); iStrip++) {
domP* P = primitive->getP_array()[iStrip];
@ -537,7 +539,7 @@ template<> inline const domListOfUInts *ColladaPrimitive<domTristrips>::getTrian
// Convert the strip back to a triangle list
domUint* v0 = pSrcData;
for (int iTri = 0; iTri < numTriangles; iTri++, v0 += stride) {
for (S32 iTri = 0; iTri < numTriangles; iTri++, v0 += stride) {
if (iTri & 0x1)
{
// CW triangle
@ -565,7 +567,7 @@ template<> inline const domListOfUInts *ColladaPrimitive<domTrifans>::getTriangl
// Convert strips to triangles
pTriangleData = new domListOfUInts();
for (int iStrip = 0; iStrip < primitive->getCount(); iStrip++) {
for (S32 iStrip = 0; iStrip < primitive->getCount(); iStrip++) {
domP* P = primitive->getP_array()[iStrip];
@ -578,7 +580,7 @@ template<> inline const domListOfUInts *ColladaPrimitive<domTrifans>::getTriangl
// Convert the fan back to a triangle list
domUint* v0 = pSrcData + stride;
for (int iTri = 0; iTri < numTriangles; iTri++, v0 += 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
@ -597,7 +599,7 @@ template<> inline const domListOfUInts *ColladaPrimitive<domPolygons>::getTriang
// Convert polygons to triangles
pTriangleData = new domListOfUInts();
for (int iPoly = 0; iPoly < primitive->getCount(); iPoly++) {
for (S32 iPoly = 0; iPoly < primitive->getCount(); iPoly++) {
domP* P = primitive->getP_array()[iPoly];
@ -612,7 +614,7 @@ template<> inline const domListOfUInts *ColladaPrimitive<domPolygons>::getTriang
// converting the polygon to triangles.
domUint* v0 = pSrcData;
pSrcData += stride;
for (int iTri = 0; iTri < numPoints-2; iTri++) {
for (S32 iTri = 0; iTri < numPoints-2; iTri++) {
pTriangleData->appendArray(stride, v0);
pTriangleData->appendArray(stride*2, pSrcData);
pSrcData += stride;
@ -636,7 +638,7 @@ template<> inline const domListOfUInts *ColladaPrimitive<domPolylist>::getTriang
const domListOfUInts& vcount = primitive->getVcount()->getValue();
U32 expectedCount = 0;
for (int iPoly = 0; iPoly < vcount.getCount(); iPoly++)
for (S32 iPoly = 0; iPoly < vcount.getCount(); iPoly++)
expectedCount += vcount[iPoly];
expectedCount *= stride;
@ -648,13 +650,13 @@ template<> inline const domListOfUInts *ColladaPrimitive<domPolylist>::getTriang
}
domUint* pSrcData = &(primitive->getP()->getValue()[0]);
for (int iPoly = 0; iPoly < vcount.getCount(); iPoly++) {
for (S32 iPoly = 0; iPoly < vcount.getCount(); iPoly++) {
// Use a simple tri-fan (centered at the first point) method of
// converting the polygon to triangles.
domUint* v0 = pSrcData;
pSrcData += stride;
for (int iTri = 0; iTri < vcount[iPoly]-2; iTri++) {
for (S32 iTri = 0; iTri < vcount[iPoly]-2; iTri++) {
pTriangleData->appendArray(stride, v0);
pTriangleData->appendArray(stride*2, pSrcData);
pSrcData += stride;
@ -671,7 +673,7 @@ template<> inline const domListOfUInts *ColladaPrimitive<domPolylist>::getTriang
template<typename T> inline T convert(const char* value) { return value; }
template<> inline bool convert(const char* value) { return dAtob(value); }
template<> inline S32 convert(const char* value) { return dAtoi(value); }
template<> inline double convert(const char* value) { return dAtof(value); }
template<> inline F64 convert(const char* value) { return dAtof(value); }
template<> inline F32 convert(const char* value) { return convert<double>(value); }
//-----------------------------------------------------------------------------
@ -713,7 +715,7 @@ struct AnimData
AnimData() : enabled(false) { }
void parseTargetString(const char* target, int fullCount, const char* elements[]);
void parseTargetString(const char* target, S32 fullCount, const char* elements[]);
F32 invertParamCubic(F32 param, F32 x0, F32 x1, F32 x2, F32 x3) const;
void interpValue(F32 t, U32 offset, double* value) const;
@ -757,7 +759,7 @@ struct AnimatedElement
// Animate the value
const AnimChannels* channels = AnimData::getAnimChannels(element);
if (channels && (time >= 0)) {
for (int iChannel = 0; iChannel < channels->size(); iChannel++) {
for (S32 iChannel = 0; iChannel < channels->size(); iChannel++) {
const AnimData* animData = (*channels)[iChannel];
if (animData->enabled)
animData->interpValue(time, 0, &value);
@ -787,10 +789,10 @@ template<class T> struct AnimatedElementList : public AnimatedElement<T>
// Animate the vector
const AnimChannels* channels = AnimData::getAnimChannels(this->element);
if (channels && (time >= 0)) {
for (int iChannel = 0; iChannel < channels->size(); iChannel++) {
for (S32 iChannel = 0; iChannel < channels->size(); iChannel++) {
const AnimData* animData = (*channels)[iChannel];
if (animData->enabled) {
for (int iValue = 0; iValue < animData->targetValueCount; iValue++)
for (S32 iValue = 0; iValue < animData->targetValueCount; iValue++)
animData->interpValue(time, iValue, &vec[animData->targetValueOffset + iValue]);
}
}