Fixed POV-Ray warnings.

This commit is contained in:
Leonardo Zide 2017-11-04 14:32:21 -07:00
parent 1436037f7b
commit f2fc6b3a8d
2 changed files with 23 additions and 25 deletions

View file

@ -252,7 +252,20 @@ void lcMesh::ExportPOVRay(lcFile& File, const char* MeshName, const char** Color
{
char Line[1024];
sprintf(Line, "#declare lc_%s = union {\n", MeshName);
int NumSections = 0;
for (int SectionIdx = 0; SectionIdx < mLods[LC_MESH_LOD_HIGH].NumSections; SectionIdx++)
{
lcMeshSection* Section = &mLods[LC_MESH_LOD_HIGH].Sections[SectionIdx];
if (Section->PrimitiveType == LC_MESH_TRIANGLES || Section->PrimitiveType == LC_MESH_TEXTURED_TRIANGLES)
NumSections++;
}
if (NumSections > 1)
sprintf(Line, "#declare lc_%s = union {\n", MeshName);
else
sprintf(Line, "#declare lc_%s = mesh {\n", MeshName);
File.WriteLine(Line);
lcVertex* Verts = (lcVertex*)mVertexData;
@ -266,7 +279,8 @@ void lcMesh::ExportPOVRay(lcFile& File, const char* MeshName, const char** Color
IndexType* Indices = (IndexType*)mIndexData + Section->IndexOffset / sizeof(IndexType);
File.WriteLine(" mesh {\n");
if (NumSections > 1)
File.WriteLine(" mesh {\n");
for (int Idx = 0; Idx < Section->NumIndices; Idx += 3)
{
@ -288,8 +302,11 @@ void lcMesh::ExportPOVRay(lcFile& File, const char* MeshName, const char** Color
File.WriteLine(Line);
}
File.WriteLine(" }\n");
if (NumSections > 1)
File.WriteLine(" }\n");
}
File.WriteLine("}\n\n");
}
void lcMesh::ExportPOVRay(lcFile& File, const char* MeshName, const char** ColorTable)

View file

@ -1948,6 +1948,8 @@ bool Project::ExportPOVRay(const QString& FileName)
return false;
}
POVFile.WriteLine("#version 3.7;\n\nglobal_settings {\n assumed_gamma 1.0\n}\n\n");
char Line[1024];
lcPiecesLibrary* Library = lcGetPiecesLibrary();
@ -2135,8 +2137,6 @@ bool Project::ExportPOVRay(const QString& FileName)
Mesh->ExportPOVRay(POVFile, Name, &ColorTablePointer[0]);
POVFile.WriteLine("}\n\n");
sprintf(Line, "#declare lc_%s_clear = lc_%s\n\n", Name, Name);
POVFile.WriteLine(Line);
}
@ -2150,7 +2150,7 @@ bool Project::ExportPOVRay(const QString& FileName)
sprintf(Line, "camera {\n perspective\n right x * image_width / image_height\n sky<%1g,%1g,%1g>\n location <%1g, %1g, %1g>\n look_at <%1g, %1g, %1g>\n angle %.0f * image_width / image_height\n}\n\n",
Up[1], Up[0], Up[2], Position[1] / 25.0f, Position[0] / 25.0f, Position[2] / 25.0f, Target[1] / 25.0f, Target[0] / 25.0f, Target[2] / 25.0f, Camera->m_fovy);
POVFile.WriteLine(Line);
sprintf(Line, "background { color rgb <%1g, %1g, %1g> }\n\nlight_source { <0, 0, 20> rgb<1, 1, 1, 1> }\n\n",
sprintf(Line, "background { color rgb <%1g, %1g, %1g> }\n\nlight_source { <0, 0, 20> rgb<1, 1, 1> }\n\n",
Properties.mBackgroundSolidColor[0], Properties.mBackgroundSolidColor[1], Properties.mBackgroundSolidColor[2]);
POVFile.WriteLine(Line);
@ -2182,26 +2182,7 @@ bool Project::ExportPOVRay(const QString& FileName)
}
POVFile.Close();
/*
if (Dialog.mRender)
{
QStringList Arguments;
Arguments.append(QString::fromLatin1("+I%1").arg(Dialog.mFileName));
if (!Dialog.mLGEOPath.isEmpty())
{
Arguments.append(QString::fromLatin1("+L%1lg/").arg(Dialog.mLGEOPath));
Arguments.append(QString::fromLatin1("+L%1ar/").arg(Dialog.mLGEOPath));
}
Arguments.append(QString::fromLatin1("/EXIT"));
#ifndef QT_NO_PROCESS
QProcess::execute(Dialog.mPOVRayPath, Arguments);
#endif
}
*/
return true;
}