fix compiler warning.

pull/3012/head
kimkulling 2020-03-19 15:25:34 +01:00
parent 4de4c34fb2
commit 9ba014739a
2 changed files with 502 additions and 557 deletions

View File

@ -16,41 +16,33 @@
using namespace std;
namespace Assimp
{
namespace Assimp {
void ExportSceneX3D(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties)
{
void ExportSceneX3D(const char *pFile, IOSystem *pIOSystem, const aiScene *pScene, const ExportProperties *pProperties) {
X3DExporter exporter(pFile, pIOSystem, pScene, pProperties);
}
} // namespace Assimp
namespace Assimp
{
namespace Assimp {
void X3DExporter::IndentationStringSet(const size_t pNewLevel)
{
if(pNewLevel > mIndentationString.size())
{
void X3DExporter::IndentationStringSet(const size_t pNewLevel) {
if (pNewLevel > mIndentationString.size()) {
if (pNewLevel > mIndentationString.capacity()) mIndentationString.reserve(pNewLevel + 1);
for(size_t i = 0, i_e = pNewLevel - mIndentationString.size(); i < i_e; i++) mIndentationString.push_back('\t');
}
else if(pNewLevel < mIndentationString.size())
{
for (size_t i = 0, i_e = pNewLevel - mIndentationString.size(); i < i_e; i++)
mIndentationString.push_back('\t');
} else if (pNewLevel < mIndentationString.size()) {
mIndentationString.resize(pNewLevel);
}
}
void X3DExporter::XML_Write(const string& pData)
{
void X3DExporter::XML_Write(const string &pData) {
if (pData.size() == 0) return;
if (mOutFile->Write((void *)pData.data(), pData.length(), 1) != 1) throw DeadlyExportError("Failed to write scene data!");
}
aiMatrix4x4 X3DExporter::Matrix_GlobalToCurrent(const aiNode& pNode) const
{
aiMatrix4x4 X3DExporter::Matrix_GlobalToCurrent(const aiNode &pNode) const {
aiNode *cur_node;
std::list<aiMatrix4x4> matr;
aiMatrix4x4 out_matr;
@ -58,29 +50,26 @@ aiMatrix4x4 out_matr;
// starting walk from current element to root
matr.push_back(pNode.mTransformation);
cur_node = pNode.mParent;
if(cur_node != nullptr)
{
do
{
if (cur_node != nullptr) {
do {
matr.push_back(cur_node->mTransformation);
cur_node = cur_node->mParent;
} while (cur_node != nullptr);
}
// multiplicate all matrices in reverse order
for(std::list<aiMatrix4x4>::reverse_iterator rit = matr.rbegin(); rit != matr.rend(); ++rit) out_matr = out_matr * (*rit);
for (std::list<aiMatrix4x4>::reverse_iterator rit = matr.rbegin(); rit != matr.rend(); ++rit)
out_matr = out_matr * (*rit);
return out_matr;
}
void X3DExporter::AttrHelper_FloatToString(const float pValue, std::string& pTargetString)
{
void X3DExporter::AttrHelper_FloatToString(const float pValue, std::string &pTargetString) {
pTargetString = to_string(pValue);
AttrHelper_CommaToPoint(pTargetString);
}
void X3DExporter::AttrHelper_Vec3DArrToString(const aiVector3D* pArray, const size_t pArray_Size, string& pTargetString)
{
void X3DExporter::AttrHelper_Vec3DArrToString(const aiVector3D *pArray, const size_t pArray_Size, string &pTargetString) {
pTargetString.clear();
pTargetString.reserve(pArray_Size * 6); // (Number + space) * 3.
for (size_t idx = 0; idx < pArray_Size; idx++)
@ -91,8 +80,7 @@ void X3DExporter::AttrHelper_Vec3DArrToString(const aiVector3D* pArray, const si
AttrHelper_CommaToPoint(pTargetString);
}
void X3DExporter::AttrHelper_Vec2DArrToString(const aiVector2D* pArray, const size_t pArray_Size, std::string& pTargetString)
{
void X3DExporter::AttrHelper_Vec2DArrToString(const aiVector2D *pArray, const size_t pArray_Size, std::string &pTargetString) {
pTargetString.clear();
pTargetString.reserve(pArray_Size * 4); // (Number + space) * 2.
for (size_t idx = 0; idx < pArray_Size; idx++)
@ -103,8 +91,7 @@ void X3DExporter::AttrHelper_Vec2DArrToString(const aiVector2D* pArray, const si
AttrHelper_CommaToPoint(pTargetString);
}
void X3DExporter::AttrHelper_Vec3DAsVec2fArrToString(const aiVector3D* pArray, const size_t pArray_Size, string& pTargetString)
{
void X3DExporter::AttrHelper_Vec3DAsVec2fArrToString(const aiVector3D *pArray, const size_t pArray_Size, string &pTargetString) {
pTargetString.clear();
pTargetString.reserve(pArray_Size * 4); // (Number + space) * 2.
for (size_t idx = 0; idx < pArray_Size; idx++)
@ -115,8 +102,7 @@ void X3DExporter::AttrHelper_Vec3DAsVec2fArrToString(const aiVector3D* pArray, c
AttrHelper_CommaToPoint(pTargetString);
}
void X3DExporter::AttrHelper_Col4DArrToString(const aiColor4D* pArray, const size_t pArray_Size, string& pTargetString)
{
void X3DExporter::AttrHelper_Col4DArrToString(const aiColor4D *pArray, const size_t pArray_Size, string &pTargetString) {
pTargetString.clear();
pTargetString.reserve(pArray_Size * 8); // (Number + space) * 4.
for (size_t idx = 0; idx < pArray_Size; idx++)
@ -128,8 +114,7 @@ void X3DExporter::AttrHelper_Col4DArrToString(const aiColor4D* pArray, const siz
AttrHelper_CommaToPoint(pTargetString);
}
void X3DExporter::AttrHelper_Col3DArrToString(const aiColor3D* pArray, const size_t pArray_Size, std::string& pTargetString)
{
void X3DExporter::AttrHelper_Col3DArrToString(const aiColor3D *pArray, const size_t pArray_Size, std::string &pTargetString) {
pTargetString.clear();
pTargetString.reserve(pArray_Size * 6); // (Number + space) * 3.
for (size_t idx = 0; idx < pArray_Size; idx++)
@ -140,8 +125,7 @@ void X3DExporter::AttrHelper_Col3DArrToString(const aiColor3D* pArray, const siz
AttrHelper_CommaToPoint(pTargetString);
}
void X3DExporter::AttrHelper_Color3ToAttrList(std::list<SAttribute>& pList, const std::string& pName, const aiColor3D& pValue, const aiColor3D& pDefaultValue)
{
void X3DExporter::AttrHelper_Color3ToAttrList(std::list<SAttribute> &pList, const std::string &pName, const aiColor3D &pValue, const aiColor3D &pDefaultValue) {
string tstr;
if (pValue == pDefaultValue) return;
@ -150,8 +134,7 @@ string tstr;
pList.push_back({ pName, tstr });
}
void X3DExporter::AttrHelper_FloatToAttrList(std::list<SAttribute>& pList, const string& pName, const float pValue, const float pDefaultValue)
{
void X3DExporter::AttrHelper_FloatToAttrList(std::list<SAttribute> &pList, const string &pName, const float pValue, const float pDefaultValue) {
string tstr;
if (pValue == pDefaultValue) return;
@ -160,36 +143,32 @@ string tstr;
pList.push_back({ pName, tstr });
}
void X3DExporter::NodeHelper_OpenNode(const string& pNodeName, const size_t pTabLevel, const bool pEmptyElement, const list<SAttribute>& pAttrList)
{
void X3DExporter::NodeHelper_OpenNode(const string &pNodeName, const size_t pTabLevel, const bool pEmptyElement, const list<SAttribute> &pAttrList) {
// Write indentation.
IndentationStringSet(pTabLevel);
XML_Write(mIndentationString);
// Begin of the element
XML_Write("<" + pNodeName);
// Write attributes
for(const SAttribute& attr: pAttrList) { XML_Write(" " + attr.Name + "='" + attr.Value + "'"); }
for (const SAttribute &attr : pAttrList) {
XML_Write(" " + attr.Name + "='" + attr.Value + "'");
}
// End of the element
if(pEmptyElement)
{
if (pEmptyElement) {
XML_Write("/>\n");
}
else
{
} else {
XML_Write(">\n");
}
}
void X3DExporter::NodeHelper_OpenNode(const string& pNodeName, const size_t pTabLevel, const bool pEmptyElement)
{
void X3DExporter::NodeHelper_OpenNode(const string &pNodeName, const size_t pTabLevel, const bool pEmptyElement) {
const list<SAttribute> attr_list;
NodeHelper_OpenNode(pNodeName, pTabLevel, pEmptyElement, attr_list);
}
void X3DExporter::NodeHelper_CloseNode(const string& pNodeName, const size_t pTabLevel)
{
void X3DExporter::NodeHelper_CloseNode(const string &pNodeName, const size_t pTabLevel) {
// Write indentation.
IndentationStringSet(pTabLevel);
XML_Write(mIndentationString);
@ -197,8 +176,7 @@ void X3DExporter::NodeHelper_CloseNode(const string& pNodeName, const size_t pTa
XML_Write("</" + pNodeName + ">\n");
}
void X3DExporter::Export_Node(const aiNode *pNode, const size_t pTabLevel)
{
void X3DExporter::Export_Node(const aiNode *pNode, const size_t pTabLevel) {
bool transform = false;
list<SAttribute> attr_list;
@ -211,10 +189,8 @@ list<SAttribute> attr_list;
if (pNode->mName.length) attr_list.push_back({ "DEF", pNode->mName.C_Str() });
// Check if need <Transformation> node against <Group>.
if(!pNode->mTransformation.IsIdentity())
{
auto Vector2String = [this](const aiVector3D pVector) -> string
{
if (!pNode->mTransformation.IsIdentity()) {
auto Vector2String = [this](const aiVector3D pVector) -> string {
string tstr = to_string(pVector.x) + " " + to_string(pVector.y) + " " + to_string(pVector.z);
AttrHelper_CommaToPoint(tstr);
@ -222,8 +198,7 @@ list<SAttribute> attr_list;
return tstr;
};
auto Rotation2String = [this](const aiVector3D pAxis, const ai_real pAngle) -> string
{
auto Rotation2String = [this](const aiVector3D pAxis, const ai_real pAngle) -> string {
string tstr = to_string(pAxis.x) + " " + to_string(pAxis.y) + " " + to_string(pAxis.z) + " " + to_string(pAngle);
AttrHelper_CommaToPoint(tstr);
@ -255,17 +230,13 @@ list<SAttribute> attr_list;
NodeHelper_OpenNode("Group", pTabLevel);
// Export metadata
if(pNode->mMetaData != nullptr)
{
for(size_t idx_prop = 0; idx_prop < pNode->mMetaData->mNumProperties; idx_prop++)
{
if (pNode->mMetaData != nullptr) {
for (size_t idx_prop = 0; idx_prop < pNode->mMetaData->mNumProperties; idx_prop++) {
const aiString *key;
const aiMetadataEntry *entry;
if(pNode->mMetaData->Get(idx_prop, key, entry))
{
switch(entry->mType)
{
if (pNode->mMetaData->Get(idx_prop, key, entry)) {
switch (entry->mType) {
case AI_BOOL:
Export_MetadataBoolean(*key, *static_cast<bool *>(entry->mData), pTabLevel + 1);
break;
@ -290,9 +261,11 @@ list<SAttribute> attr_list;
} // if(pNode->mMetaData != nullptr)
// Export meshes.
for(size_t idx_mesh = 0; idx_mesh < pNode->mNumMeshes; idx_mesh++) Export_Mesh(pNode->mMeshes[idx_mesh], pTabLevel + 1);
for (size_t idx_mesh = 0; idx_mesh < pNode->mNumMeshes; idx_mesh++)
Export_Mesh(pNode->mMeshes[idx_mesh], pTabLevel + 1);
// Export children.
for(size_t idx_node = 0; idx_node < pNode->mNumChildren; idx_node++) Export_Node(pNode->mChildren[idx_node], pTabLevel + 1);
for (size_t idx_node = 0; idx_node < pNode->mNumChildren; idx_node++)
Export_Node(pNode->mChildren[idx_node], pTabLevel + 1);
// End node if need.
if (transform)
@ -301,8 +274,7 @@ list<SAttribute> attr_list;
NodeHelper_CloseNode("Group", pTabLevel);
}
void X3DExporter::Export_Mesh(const size_t pIdxMesh, const size_t pTabLevel)
{
void X3DExporter::Export_Mesh(const size_t pIdxMesh, const size_t pTabLevel) {
const char *NodeName_IFS = "IndexedFaceSet";
const char *NodeName_Shape = "Shape";
@ -310,8 +282,7 @@ list<SAttribute> attr_list;
aiMesh &mesh = *mScene->mMeshes[pIdxMesh]; // create alias for conveniance.
// Check if mesh already defined early.
if(mDEF_Map_Mesh.find(pIdxMesh) != mDEF_Map_Mesh.end())
{
if (mDEF_Map_Mesh.find(pIdxMesh) != mDEF_Map_Mesh.end()) {
// Mesh already defined, just refer to it
attr_list.push_back({ "USE", mDEF_Map_Mesh.at(pIdxMesh) });
NodeHelper_OpenNode(NodeName_Shape, pTabLevel, true, attr_list);
@ -344,12 +315,10 @@ aiMesh& mesh = *mScene->mMeshes[pIdxMesh];// create alias for conveniance.
// fill coordinates index.
coordIndex.reserve(mesh.mNumVertices * 4); // Index + space + Face delimiter
for(size_t idx_face = 0; idx_face < mesh.mNumFaces; idx_face++)
{
for (size_t idx_face = 0; idx_face < mesh.mNumFaces; idx_face++) {
const aiFace &face_cur = mesh.mFaces[idx_face];
for(size_t idx_vert = 0; idx_vert < face_cur.mNumIndices; idx_vert++)
{
for (size_t idx_vert = 0; idx_vert < face_cur.mNumIndices; idx_vert++) {
coordIndex.append(to_string(face_cur.mIndices[idx_vert]) + " ");
}
@ -372,8 +341,7 @@ aiMesh& mesh = *mScene->mMeshes[pIdxMesh];// create alias for conveniance.
attr_list.clear();
// Export <ColorRGBA>
if(mesh.HasVertexColors(0))
{
if (mesh.HasVertexColors(0)) {
AttrHelper_Col4DArrToString(mesh.mColors[0], mesh.mNumVertices, attr_value);
attr_list.push_back({ "color", attr_value });
NodeHelper_OpenNode("ColorRGBA", pTabLevel + 2, true, attr_list);
@ -381,8 +349,7 @@ aiMesh& mesh = *mScene->mMeshes[pIdxMesh];// create alias for conveniance.
}
// Export <TextureCoordinate>
if(mesh.HasTextureCoords(0))
{
if (mesh.HasTextureCoords(0)) {
AttrHelper_Vec3DAsVec2fArrToString(mesh.mTextureCoords[0], mesh.mNumVertices, attr_value);
attr_list.push_back({ "point", attr_value });
NodeHelper_OpenNode("TextureCoordinate", pTabLevel + 2, true, attr_list);
@ -390,8 +357,7 @@ aiMesh& mesh = *mScene->mMeshes[pIdxMesh];// create alias for conveniance.
}
// Export <Normal>
if(mesh.HasNormals())
{
if (mesh.HasNormals()) {
AttrHelper_Vec3DArrToString(mesh.mNormals, mesh.mNumVertices, attr_value);
attr_list.push_back({ "vector", attr_value });
NodeHelper_OpenNode("Normal", pTabLevel + 2, true, attr_list);
@ -405,16 +371,14 @@ aiMesh& mesh = *mScene->mMeshes[pIdxMesh];// create alias for conveniance.
NodeHelper_CloseNode(NodeName_Shape, pTabLevel);
}
void X3DExporter::Export_Material(const size_t pIdxMaterial, const size_t pTabLevel)
{
void X3DExporter::Export_Material(const size_t pIdxMaterial, const size_t pTabLevel) {
const char *NodeName_A = "Appearance";
list<SAttribute> attr_list;
aiMaterial &material = *mScene->mMaterials[pIdxMaterial]; // create alias for conveniance.
// Check if material already defined early.
if(mDEF_Map_Material.find(pIdxMaterial) != mDEF_Map_Material.end())
{
if (mDEF_Map_Material.find(pIdxMaterial) != mDEF_Map_Material.end()) {
// Material already defined, just refer to it
attr_list.push_back({ "USE", mDEF_Map_Material.at(pIdxMaterial) });
NodeHelper_OpenNode(NodeName_A, pTabLevel, true, attr_list);
@ -441,12 +405,10 @@ aiMaterial& material = *mScene->mMaterials[pIdxMaterial];// create alias for con
// "Material" node.
//
{
auto Color4ToAttrList = [&](const string& pAttrName, const aiColor4D& pAttrValue, const aiColor3D& pAttrDefaultValue)
{
auto Color4ToAttrList = [&](const string &pAttrName, const aiColor4D &pAttrValue, const aiColor3D &pAttrDefaultValue) {
string tstr;
if(aiColor3D(pAttrValue.r, pAttrValue.g, pAttrValue.b) != pAttrDefaultValue)
{
if (aiColor3D(pAttrValue.r, pAttrValue.g, pAttrValue.b) != pAttrDefaultValue) {
AttrHelper_Col4DArrToString(&pAttrValue, 1, tstr);
attr_list.push_back({ pAttrName, tstr });
}
@ -484,8 +446,7 @@ aiMaterial& material = *mScene->mMaterials[pIdxMaterial];// create alias for con
Color4ToAttrList("specularColor", color4, aiColor3D(0, 0, 0));
// transparency="0" SFFloat [inputOutput]
if(material.Get(AI_MATKEY_OPACITY, tvalf) == AI_SUCCESS)
{
if (material.Get(AI_MATKEY_OPACITY, tvalf) == AI_SUCCESS) {
if (tvalf > 1) tvalf = 1;
tvalf = 1.0f - tvalf;
@ -500,8 +461,7 @@ aiMaterial& material = *mScene->mMaterials[pIdxMaterial];// create alias for con
// "ImageTexture" node.
//
{
auto RepeatToAttrList = [&](const string& pAttrName, const bool pAttrValue)
{
auto RepeatToAttrList = [&](const string &pAttrName, const bool pAttrValue) {
if (!pAttrValue) attr_list.push_back({ pAttrName, "false" });
};
@ -509,8 +469,7 @@ aiMaterial& material = *mScene->mMaterials[pIdxMaterial];// create alias for con
aiString tstring;
// url="" MFString
if(material.Get(AI_MATKEY_TEXTURE_DIFFUSE(0), tstring) == AI_SUCCESS)
{
if (material.Get(AI_MATKEY_TEXTURE_DIFFUSE(0), tstring) == AI_SUCCESS) {
if (strncmp(tstring.C_Str(), AI_EMBEDDED_TEXNAME_PREFIX, strlen(AI_EMBEDDED_TEXNAME_PREFIX)) == 0)
LogError("Embedded texture is not supported");
else
@ -531,12 +490,10 @@ aiMaterial& material = *mScene->mMaterials[pIdxMaterial];// create alias for con
// "TextureTransform" node.
//
{
auto Vec2ToAttrList = [&](const string& pAttrName, const aiVector2D& pAttrValue, const aiVector2D& pAttrDefaultValue)
{
auto Vec2ToAttrList = [&](const string &pAttrName, const aiVector2D &pAttrValue, const aiVector2D &pAttrDefaultValue) {
string tstr;
if(pAttrValue != pAttrDefaultValue)
{
if (pAttrValue != pAttrDefaultValue) {
AttrHelper_Vec2DArrToString(&pAttrValue, 1, tstr);
attr_list.push_back({ pAttrName, tstr });
}
@ -544,8 +501,7 @@ aiMaterial& material = *mScene->mMaterials[pIdxMaterial];// create alias for con
aiUVTransform transform;
if(material.Get(AI_MATKEY_UVTRANSFORM_DIFFUSE(0), transform) == AI_SUCCESS)
{
if (material.Get(AI_MATKEY_UVTRANSFORM_DIFFUSE(0), transform) == AI_SUCCESS) {
Vec2ToAttrList("translation", transform.mTranslation, aiVector2D(0, 0));
AttrHelper_FloatToAttrList(attr_list, "rotation", transform.mRotation, 0);
Vec2ToAttrList("scale", transform.mScaling, aiVector2D(1, 1));
@ -559,11 +515,9 @@ aiMaterial& material = *mScene->mMaterials[pIdxMaterial];// create alias for con
// Close opened nodes.
//
NodeHelper_CloseNode(NodeName_A, pTabLevel);
}
void X3DExporter::Export_MetadataBoolean(const aiString& pKey, const bool pValue, const size_t pTabLevel)
{
void X3DExporter::Export_MetadataBoolean(const aiString &pKey, const bool pValue, const size_t pTabLevel) {
list<SAttribute> attr_list;
attr_list.push_back({ "name", pKey.C_Str() });
@ -571,8 +525,7 @@ list<SAttribute> attr_list;
NodeHelper_OpenNode("MetadataBoolean", pTabLevel, true, attr_list);
}
void X3DExporter::Export_MetadataDouble(const aiString& pKey, const double pValue, const size_t pTabLevel)
{
void X3DExporter::Export_MetadataDouble(const aiString &pKey, const double pValue, const size_t pTabLevel) {
list<SAttribute> attr_list;
attr_list.push_back({ "name", pKey.C_Str() });
@ -580,8 +533,7 @@ list<SAttribute> attr_list;
NodeHelper_OpenNode("MetadataDouble", pTabLevel, true, attr_list);
}
void X3DExporter::Export_MetadataFloat(const aiString& pKey, const float pValue, const size_t pTabLevel)
{
void X3DExporter::Export_MetadataFloat(const aiString &pKey, const float pValue, const size_t pTabLevel) {
list<SAttribute> attr_list;
attr_list.push_back({ "name", pKey.C_Str() });
@ -589,8 +541,7 @@ list<SAttribute> attr_list;
NodeHelper_OpenNode("MetadataFloat", pTabLevel, true, attr_list);
}
void X3DExporter::Export_MetadataInteger(const aiString& pKey, const int32_t pValue, const size_t pTabLevel)
{
void X3DExporter::Export_MetadataInteger(const aiString &pKey, const int32_t pValue, const size_t pTabLevel) {
list<SAttribute> attr_list;
attr_list.push_back({ "name", pKey.C_Str() });
@ -598,8 +549,7 @@ list<SAttribute> attr_list;
NodeHelper_OpenNode("MetadataInteger", pTabLevel, true, attr_list);
}
void X3DExporter::Export_MetadataString(const aiString& pKey, const aiString& pValue, const size_t pTabLevel)
{
void X3DExporter::Export_MetadataString(const aiString &pKey, const aiString &pValue, const size_t pTabLevel) {
list<SAttribute> attr_list;
attr_list.push_back({ "name", pKey.C_Str() });
@ -607,16 +557,13 @@ list<SAttribute> attr_list;
NodeHelper_OpenNode("MetadataString", pTabLevel, true, attr_list);
}
bool X3DExporter::CheckAndExport_Light(const aiNode& pNode, const size_t pTabLevel)
{
bool X3DExporter::CheckAndExport_Light(const aiNode &pNode, const size_t pTabLevel) {
list<SAttribute> attr_list;
auto Vec3ToAttrList = [&](const string& pAttrName, const aiVector3D& pAttrValue, const aiVector3D& pAttrDefaultValue)
{
auto Vec3ToAttrList = [&](const string &pAttrName, const aiVector3D &pAttrValue, const aiVector3D &pAttrDefaultValue) {
string tstr;
if(pAttrValue != pAttrDefaultValue)
{
if (pAttrValue != pAttrDefaultValue) {
AttrHelper_Vec3DArrToString(&pAttrValue, 1, tstr);
attr_list.push_back({ pAttrName, tstr });
}
@ -629,10 +576,8 @@ bool found = false;
if (pNode.mName.length == 0) return false;
// search for light with name like node has.
for(idx_light = 0; mScene->mNumLights; idx_light++)
{
if(pNode.mName == mScene->mLights[idx_light]->mName)
{
for (idx_light = 0; mScene->mNumLights; idx_light++) {
if (pNode.mName == mScene->mLights[idx_light]->mName) {
found = true;
break;
}
@ -652,10 +597,8 @@ bool found = false;
// color="1 1 1" SFColor [inputOutput]
AttrHelper_Color3ToAttrList(attr_list, "color", light.mColorDiffuse, aiColor3D(1, 1, 1));
switch(light.mType)
{
case aiLightSource_DIRECTIONAL:
{
switch (light.mType) {
case aiLightSource_DIRECTIONAL: {
aiVector3D direction = trafo_mat * light.mDirection;
Vec3ToAttrList("direction", direction, aiVector3D(0, 0, -1));
@ -663,8 +606,7 @@ bool found = false;
}
break;
case aiLightSource_POINT:
{
case aiLightSource_POINT: {
aiVector3D attenuation(light.mAttenuationConstant, light.mAttenuationLinear, light.mAttenuationQuadratic);
aiVector3D location = trafo_mat * light.mPosition;
@ -674,8 +616,7 @@ bool found = false;
}
break;
case aiLightSource_SPOT:
{
case aiLightSource_SPOT: {
aiVector3D attenuation(light.mAttenuationConstant, light.mAttenuationLinear, light.mAttenuationQuadratic);
aiVector3D location = trafo_mat * light.mPosition;
aiVector3D direction = trafo_mat * light.mDirection;
@ -696,9 +637,8 @@ bool found = false;
return true;
}
X3DExporter::X3DExporter(const char* pFileName, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/)
: mScene(pScene)
{
X3DExporter::X3DExporter(const char *pFileName, IOSystem *pIOSystem, const aiScene *pScene, const ExportProperties * /*pProperties*/) :
mScene(pScene) {
list<SAttribute> attr_list;
mOutFile = pIOSystem->Open(pFileName, "wt");

View File

@ -55,6 +55,11 @@ class X3DExporter
{
const std::string Name;
const std::string Value;
SAttribute() :
Name(),
Value() {
// empty
}
};
/***********************************************/