added initial Collada 1.4 Physics support

This commit is contained in:
ejcoumans
2006-06-01 03:27:01 +00:00
parent 5299170dca
commit b5d0520c58
11 changed files with 3430 additions and 2683 deletions

View File

@@ -15,7 +15,7 @@
#include "FCDocument/FCDEntity.h"
#include "FCDocument/FCDGeometry.h"
#include "FCDocument/FCDGeometryInstance.h"
#include "FCDocument/FCDGeometryMesh.h"
#include "FCDocument/FCDGeometryMesh.h"
#include "FCDocument/FCDGeometryPolygons.h"
#include "FCDocument/FCDMaterialInstance.h"
#include "FUtils/FUDaeParser.h"
@@ -23,38 +23,38 @@
using namespace FUDaeParser;
using namespace FUDaeWriter;
// Parasitic: Write out the instantiation information to the xml node tree
xmlNode* FCDEntityInstance::WriteToXML(xmlNode* parentNode) const
{
xmlNode* instanceNode = NULL;
if (entity != NULL)
{
const char* instanceEntityName;
switch (entity->GetType())
{
case FCDEntity::ANIMATION: instanceEntityName = DAE_INSTANCE_ANIMATION_ELEMENT; break;
case FCDEntity::CAMERA: instanceEntityName = DAE_INSTANCE_CAMERA_ELEMENT; break;
case FCDEntity::CONTROLLER: instanceEntityName = DAE_INSTANCE_CONTROLLER_ELEMENT; break;
case FCDEntity::EFFECT: instanceEntityName = DAE_INSTANCE_EFFECT_ELEMENT; break;
case FCDEntity::GEOMETRY: instanceEntityName = DAE_INSTANCE_GEOMETRY_ELEMENT; break;
case FCDEntity::LIGHT: instanceEntityName = DAE_INSTANCE_LIGHT_ELEMENT; break;
case FCDEntity::MATERIAL: instanceEntityName = DAE_INSTANCE_MATERIAL_ELEMENT; break;
case FCDEntity::PHYSICS_MODEL: instanceEntityName = DAE_INSTANCE_PHYSICS_MODEL_ELEMENT; break;
case FCDEntity::PHYSICS_RIGID_BODY: instanceEntityName = DAE_INSTANCE_RIGID_BODY_ELEMENT; break;
case FCDEntity::PHYSICS_RIGID_CONSTRAINT: instanceEntityName = DAE_INSTANCE_RIGID_CONSTRAINT_ELEMENT; break;
case FCDEntity::SCENE_NODE: instanceEntityName = DAE_INSTANCE_NODE_ELEMENT; break;
case FCDEntity::ANIMATION_CLIP:
case FCDEntity::ENTITY:
case FCDEntity::IMAGE:
case FCDEntity::TEXTURE:
default: instanceEntityName = DAEERR_UNKNOWN_ELEMENT;
}
instanceNode = AddChild(parentNode, instanceEntityName);
AddAttribute(instanceNode, DAE_URL_ATTRIBUTE, string("#") + entity->GetDaeId());
}
return instanceNode;
// Parasitic: Write out the instantiation information to the xml node tree
xmlNode* FCDEntityInstance::WriteToXML(xmlNode* parentNode) const
{
xmlNode* instanceNode = NULL;
if (entity != NULL)
{
const char* instanceEntityName;
switch (entity->GetType())
{
case FCDEntity::ANIMATION: instanceEntityName = DAE_INSTANCE_ANIMATION_ELEMENT; break;
case FCDEntity::CAMERA: instanceEntityName = DAE_INSTANCE_CAMERA_ELEMENT; break;
case FCDEntity::CONTROLLER: instanceEntityName = DAE_INSTANCE_CONTROLLER_ELEMENT; break;
case FCDEntity::EFFECT: instanceEntityName = DAE_INSTANCE_EFFECT_ELEMENT; break;
case FCDEntity::GEOMETRY: instanceEntityName = DAE_INSTANCE_GEOMETRY_ELEMENT; break;
case FCDEntity::LIGHT: instanceEntityName = DAE_INSTANCE_LIGHT_ELEMENT; break;
case FCDEntity::MATERIAL: instanceEntityName = DAE_INSTANCE_MATERIAL_ELEMENT; break;
case FCDEntity::PHYSICS_MODEL: instanceEntityName = DAE_INSTANCE_PHYSICS_MODEL_ELEMENT; break;
case FCDEntity::PHYSICS_RIGID_BODY: instanceEntityName = DAE_INSTANCE_RIGID_BODY_ELEMENT; break;
case FCDEntity::PHYSICS_RIGID_CONSTRAINT: instanceEntityName = DAE_INSTANCE_RIGID_CONSTRAINT_ELEMENT; break;
case FCDEntity::SCENE_NODE: instanceEntityName = DAE_INSTANCE_NODE_ELEMENT; break;
case FCDEntity::ANIMATION_CLIP:
case FCDEntity::ENTITY:
case FCDEntity::IMAGE:
case FCDEntity::TEXTURE:
default: instanceEntityName = DAEERR_UNKNOWN_ELEMENT;
}
instanceNode = AddChild(parentNode, instanceEntityName);
AddAttribute(instanceNode, DAE_URL_ATTRIBUTE, string("#") + entity->GetDaeId());
}
return instanceNode;
}
FCDGeometryInstance::FCDGeometryInstance(FCDocument* document, FCDEntity* entity) : FCDEntityInstance(document, entity)
@@ -150,19 +150,19 @@ FUStatus FCDGeometryInstance::LoadFromXML(xmlNode* instanceNode)
return status;
}
// Write out the instantiation information to the xml node tree
xmlNode* FCDGeometryInstance::WriteToXML(xmlNode* parentNode) const
{
xmlNode* instanceNode = FCDEntityInstance::WriteToXML(parentNode);
if (!materials.empty())
{
xmlNode* bindMaterialNode = AddChild(instanceNode, DAE_BINDMATERIAL_ELEMENT);
xmlNode* techniqueCommonNode = AddChild(bindMaterialNode, DAE_TECHNIQUE_COMMON_ELEMENT);
for (FCDMaterialInstanceList::const_iterator itM = materials.begin(); itM != materials.end(); ++itM)
{
(*itM)->WriteToXML(techniqueCommonNode);
}
}
return instanceNode;
}
// Write out the instantiation information to the xml node tree
xmlNode* FCDGeometryInstance::WriteToXML(xmlNode* parentNode) const
{
xmlNode* instanceNode = FCDEntityInstance::WriteToXML(parentNode);
if (!materials.empty())
{
xmlNode* bindMaterialNode = AddChild(instanceNode, DAE_BINDMATERIAL_ELEMENT);
xmlNode* techniqueCommonNode = AddChild(bindMaterialNode, DAE_TECHNIQUE_COMMON_ELEMENT);
for (FCDMaterialInstanceList::const_iterator itM = materials.begin(); itM != materials.end(); ++itM)
{
(*itM)->WriteToXML(techniqueCommonNode);
}
}
return instanceNode;
}