{
MESH_LOCK();
- if(__pVertices)
- return E_ALREADY_SET;
+ SysTryReturnResult(NID_UI_ANIM, __pVertices == null, E_ALREADY_SET, " Vertices have already been allocated");
+ SysTryReturnResult(NID_UI_ANIM, count > 0, E_INVALID_ARG, " Invalid argument in order to set countOfAllocatedVertex");
- if(count <= 0)
- return E_INVALID_ARG;
-
-
- __countOfAllocatedVertex = count;
__pVertices = new (std::nothrow) float[count * APPROPRIATE_COUNT_VERTICES];
+ SysTryReturnResult(NID_UI_ANIM, __pVertices != null, E_OUT_OF_MEMORY, "%s Memory allocation failed while allocating Vertices.");
+ __countOfAllocatedVertex = count;
- if(!__pVertices)
- return E_OUT_OF_MEMORY;
-
- for(int i = 0 ; i < __countOfAllocatedVertex * APPROPRIATE_COUNT_VERTICES; i++)
+ for (int i = 0; i < __countOfAllocatedVertex * APPROPRIATE_COUNT_VERTICES; i++)
{
__pVertices[i] = 0.0f;
}
+
return E_SUCCESS;
}
{
MESH_LOCK();
- if(__pTexCoordinates)
- return E_ALREADY_SET;
+ SysTryReturnResult(NID_UI_ANIM, __pTexCoordinates == null, E_ALREADY_SET, " TextureCoordinates have already been allocated");
+ SysTryReturnResult(NID_UI_ANIM, __countOfAllocatedVertex > 0, E_INVALID_STATE, " Invalid argument in order to set size of TextCoordinates");
- if(__countOfAllocatedVertex <= 0)
- return E_INVALID_STATE;
+ int count = __countOfAllocatedVertex * APPROPRIATE_COUNT_TEXTCOORDINATES;
+ __pTexCoordinates = new (std::nothrow) float[count];
+ SysTryCatch(NID_UI_ANIM, __pTexCoordinates != null, , E_OUT_OF_MEMORY, "%s Memory allocation failed while allocating TextCoordinates.", GetErrorMessage(E_OUT_OF_MEMORY));
- int count = __countOfAllocatedVertex * APPROPRIATE_COUNT_TEXTCOORDINATES;
- __pTexCoordinates = new (std::nothrow) float[count];
- if(!__pTexCoordinates)
- return E_OUT_OF_MEMORY;
+ for (int i = 0; i < count; i++)
+ {
+ __pTexCoordinates[i] = 0.0f;
+ }
+ return E_SUCCESS;
- for(int i = 0 ; i < count ; i++)
- {
- __pTexCoordinates[i] = 0;
- }
- return E_SUCCESS;
+ CATCH:
+ __pTexCoordinates = null;
+ return E_OUT_OF_MEMORY;
}
result
_MeshImpl::AllocNormals()
{
MESH_LOCK();
- if(__pNormals)
- return E_ALREADY_SET;
- if(__countOfAllocatedVertex <= 0)
- return E_INVALID_STATE;
+ SysTryReturnResult(NID_UI_ANIM, __pNormals == null, E_ALREADY_SET, " Normals have already been allocated");
+ SysTryReturnResult(NID_UI_ANIM, __countOfAllocatedVertex > 0, E_INVALID_STATE, " Invalid argument in order to set size of Normals");
- int count = __countOfAllocatedVertex * APPROPRIATE_COUNT_NORMALS;
- __pNormals = new (std::nothrow) float[count];
- if(!__pNormals)
- return E_OUT_OF_MEMORY;
+ int count = __countOfAllocatedVertex * APPROPRIATE_COUNT_NORMALS;
+ __pNormals = new (std::nothrow) float[count];
+ SysTryCatch(NID_UI_ANIM, __pNormals != null, , E_OUT_OF_MEMORY, "%s Memory allocation failed while allocating Normals.", GetErrorMessage(E_OUT_OF_MEMORY));
- for(int i = 0 ; i < count ; i++)
- {
- __pNormals[i] = 0;
- }
- return E_SUCCESS;
+ for (int i = 0; i < count; i++)
+ {
+ __pNormals[i] = 0.0f;
+ }
+ return E_SUCCESS;
+
+ CATCH:
+ __pNormals = null;
+ return E_OUT_OF_MEMORY;
}
result
_MeshImpl::AllocColors()
{
MESH_LOCK();
- if(__pColors)
- return E_ALREADY_SET;
- if(__countOfAllocatedVertex <= 0)
- return E_INVALID_STATE;
+ SysTryReturnResult(NID_UI_ANIM, __pColors == null, E_ALREADY_SET, " Colors have already been allocated");
+ SysTryReturnResult(NID_UI_ANIM, __countOfAllocatedVertex > 0, E_INVALID_STATE, " Invalid argument in order to set size of Colors");
- int count = __countOfAllocatedVertex * APPROPRIATE_COUNT_COLORS;
- __pColors = new (std::nothrow) float[count];
- if(!__pColors)
- return E_OUT_OF_MEMORY;
+ int count = __countOfAllocatedVertex * APPROPRIATE_COUNT_COLORS;
+ __pColors = new (std::nothrow) float[count];
- for(int i = 0 ; i < count ; i++)
- {
- __pColors[i] = 0;
- }
- return E_SUCCESS;
+ SysTryCatch(NID_UI_ANIM, __pColors != null, , E_OUT_OF_MEMORY, "%s Memory allocation failed while allocating Colors.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ for(int i = 0; i < count; i++)
+ {
+ __pColors[i] = 0.0f;
+ }
+ return E_SUCCESS;
+
+ CATCH:
+ __pColors = null;
+ return E_OUT_OF_MEMORY;
}
result
_MeshImpl::AllocIndices(int count)
{
MESH_LOCK();
- if(__pIndices)
- return E_ALREADY_SET;
- if(count <= 0)
- return E_INVALID_ARG;
+ SysTryReturnResult(NID_UI_ANIM, __pIndices == null, E_ALREADY_SET, " Indices have already been allocated");
+ SysTryReturnResult(NID_UI_ANIM, count > 0, E_INVALID_ARG, " Invalid argument in order to set countOfAllocatedIndex");
+ __countOfAllocatedIndex = count;
- __countOfAllocatedIndex = count;
+ __pIndices = new (std::nothrow) IndexType[count];
- __pIndices = new (std::nothrow) unsigned short int[count];
- if(!__pIndices)
- return E_OUT_OF_MEMORY;
+ SysTryCatch(NID_UI_ANIM, __pIndices != null, , E_OUT_OF_MEMORY, "%s Memory allocation failed while allocating Indices.", GetErrorMessage(E_OUT_OF_MEMORY));
- for(int i = 0 ; i < __countOfAllocatedVertex ; i++)
- {
- __pIndices[i] = 0;
- }
+ for(int i = 0; i < __countOfAllocatedIndex; i++)
+ {
+ __pIndices[i] = 0;
+ }
- return E_SUCCESS;
+ return E_SUCCESS;
+
+ CATCH:
+ __pIndices = null;
+ return E_OUT_OF_MEMORY;
}
{
MESH_LOCK();
- if(__pVertices)
- {
- if ( arrayIndex > __countOfAllocatedVertex )
- {
- return E_OUT_OF_RANGE;
- }
-
- int i = arrayIndex * 3;
-
- if ( __hasBoundingVolume && (__pMeshController == null) )
- {
- __pVertices[i] = vertex.x - __boundingVolume.GetCenter().x; //x
- __pVertices[i+1] = vertex.y - __boundingVolume.GetCenter().y; //y
- __pVertices[i+2] = vertex.z - __boundingVolume.GetCenter().z; //z
- }
- else
- {
- __pVertices[i] = vertex.x; //x
- __pVertices[i+1] = vertex.y; //y
- __pVertices[i+2] = vertex.z; //z
- }
-
- __boundingVolume.Merge(vertex);
-
-
- if(__countOfVertex <= arrayIndex )
- {
- __countOfVertex = arrayIndex + 1;
- }
- return E_SUCCESS;
- }
+ SysTryReturnResult(NID_UI_ANIM, __pVertices != null, E_INVALID_STATE, " Vertices haven't been allocated yet");
+ bool arrayIndexState = ((arrayIndex < __countOfAllocatedVertex) && (arrayIndex >= 0));
+ SysTryReturnResult(NID_UI_ANIM, arrayIndexState, E_OUT_OF_RANGE, " arrayIndex is big in order to SetVertex (%d, %d)", arrayIndex, __countOfAllocatedVertex);
- return E_INVALID_STATE;
+ int i = arrayIndex * APPROPRIATE_COUNT_VERTICES;
+
+ __pVertices[i] = vertex.x;// - __boundingVolume.GetCenter().x; //x
+ __pVertices[i + 1] = vertex.y;// - __boundingVolume.GetCenter().y; //y
+ __pVertices[i + 2] = vertex.z;// - __boundingVolume.GetCenter().z; //z
+
+ if (__hasBoundingVolume)
+ {
+ __boundingVolume.Merge(vertex);
+ }
+
+ if (__countOfVertex <= arrayIndex)
+ {
+ __countOfVertex = arrayIndex + 1;
+ }
+ return E_SUCCESS;
}
result
_MeshImpl::SetTextureCoord(int arrayIndex, const FloatPoint& textureCoord)
{
+ result r;
MESH_LOCK();
- if(!__pTexCoordinates)
+ if(__pTexCoordinates == null)
{
- AllocTextureCoordinates();
+ r = AllocTextureCoordinates();
+ SysTryReturnResult(NID_UI_ANIM, r != E_OUT_OF_MEMORY, r, " Memory allocation failed due to out of memory");
}
- if(__pTexCoordinates)
- {
- if ( arrayIndex > __countOfAllocatedVertex )
- {
- return E_OUT_OF_RANGE;
- }
- int i = arrayIndex * 2;
+ SysTryReturnResult(NID_UI_ANIM, __pTexCoordinates, E_INVALID_STATE, " TexCoordinates haven't been allocated");
- __pTexCoordinates[i] = textureCoord.x; //x
- __pTexCoordinates[i+1] = textureCoord.y; //y
+ bool arrayIndexState = ((arrayIndex < __countOfAllocatedVertex) && (arrayIndex >= 0));
+ SysTryReturnResult(NID_UI_ANIM, arrayIndexState, E_OUT_OF_RANGE, " arrayIndex is big in order to set TextureCoord(%d, %d)", arrayIndex, __countOfAllocatedVertex);
- return E_SUCCESS;
- }
+ int i = arrayIndex * APPROPRIATE_COUNT_TEXTCOORDINATES;
+
+ __pTexCoordinates[i] = textureCoord.x; //x
+ __pTexCoordinates[i + 1] = textureCoord.y; //y
- return E_INVALID_STATE;
+ return E_SUCCESS;
}
result
_MeshImpl::SetNormal(int arrayIndex, const FloatPoint3& normal)
{
+ result r;
MESH_LOCK();
- if(!__pNormals)
+ if(__pNormals == null)
{
- AllocNormals();
+ r = AllocNormals();
+ SysTryReturnResult(NID_UI_ANIM, r != E_OUT_OF_MEMORY, r, " Memory allocation failed due to out of memory");
}
- if(__pNormals)
- {
- if ( arrayIndex > __countOfAllocatedVertex )
- {
- return E_OUT_OF_RANGE;
- }
-
- int i = arrayIndex * 3;
+ bool arrayIndexState = ((arrayIndex < __countOfAllocatedVertex) && (arrayIndex >= 0));
+ SysTryReturnResult(NID_UI_ANIM, arrayIndexState, E_OUT_OF_RANGE, " arrayIndex is big in order to set Normal(%d, %d)", arrayIndex, __countOfAllocatedVertex);
- __pNormals[i] = normal.x; //x
- __pNormals[i+1] = normal.y; //y
- __pNormals[i+2] = normal.z; //z
+ int i = arrayIndex * APPROPRIATE_COUNT_NORMALS;
- return E_SUCCESS;
- }
+ __pNormals[i] = normal.x; //x
+ __pNormals[i + 1] = normal.y; //y
+ __pNormals[i + 2] = normal.z; //z
- return E_INVALID_STATE;
+ return E_SUCCESS;
}
result
_MeshImpl::SetColor(int arrayIndex, const Color& color)
{
+ result r;
MESH_LOCK();
- if(!__pColors)
+ if(__pColors == null)
{
- AllocColors();
- }
- if(__pColors)
- {
- if ( arrayIndex > __countOfAllocatedVertex )
- {
- return E_OUT_OF_RANGE;
- }
-
- int i = arrayIndex*4;
- __pColors[i] = (float)color.GetRed()/255.0f;
- __pColors[i+1] = (float)color.GetGreen()/255.0f;
- __pColors[i+2] = (float)color.GetBlue()/255.0f;
- __pColors[i+3] = (float)color.GetAlpha()/255.0f;
- return E_SUCCESS;
+ r = AllocColors();
+ SysTryReturnResult(NID_UI_ANIM, r != E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, " Memory allocation failed due to out of memory");
}
- return E_INVALID_STATE;
+ bool arrayIndexState = ((arrayIndex < __countOfAllocatedVertex) && (arrayIndex >= 0));
+ SysTryReturnResult(NID_UI_ANIM, arrayIndexState, E_OUT_OF_RANGE, " arrayIndex is big in order to set Color(%d, %d)", arrayIndex, __countOfAllocatedVertex);
+
+ int i = arrayIndex * APPROPRIATE_COUNT_COLORS;
+ __pColors[i] = (float)color.GetRed() / 255.0f;
+ __pColors[i + 1] = (float)color.GetGreen() / 255.0f;
+ __pColors[i + 2] = (float)color.GetBlue() / 255.0f;
+ __pColors[i + 3] = (float)color.GetAlpha() / 255.0f;
+ return E_SUCCESS;
}
result
{
MESH_LOCK();
- if(__pIndices)
- {
- if ( arrayIndex > __countOfAllocatedIndex )
- {
- return E_OUT_OF_RANGE;
- }
-
- __pIndices[arrayIndex] = vertexIndex;
-
- if(__countOfIndex <= arrayIndex )
- {
- __countOfIndex = arrayIndex + 1;
- }
- return E_SUCCESS;
- }
- return E_INVALID_STATE;
+ SysTryReturnResult(NID_UI_ANIM, __pIndices != null, E_INVALID_STATE, " Indices haven't been allocated yet");
+
+ bool arrayIndexState = ((arrayIndex < __countOfAllocatedIndex) && (arrayIndex >= 0));
+ SysTryReturnResult(NID_UI_ANIM, arrayIndexState, E_OUT_OF_RANGE, " arrayIndex is big in order to set Indices(%d, %d)", arrayIndex, __countOfAllocatedIndex);
+
+ __pIndices[arrayIndex] = vertexIndex;
+
+ if(__countOfIndex <= arrayIndex)
+ {
+ __countOfIndex = arrayIndex + 1;
+ }
+
+ return E_SUCCESS;
}
FloatPoint3
_MeshImpl::GetVertex(int arrayIndex) const
{
- FloatPoint3 point(0,0,0);
+ FloatPoint3 point(0.0f, 0.0f, 0.0f);
+
+ bool arrayIndexState = ((arrayIndex < __countOfAllocatedVertex) && (arrayIndex >= 0));
+
+ SysTryReturn(NID_UI_ANIM, arrayIndexState, point, E_INVALID_ARG, "%s Index is out of range(%d, %d)", GetErrorMessage(E_INVALID_ARG), arrayIndex, __countOfAllocatedVertex);
+ SysTryReturn(NID_UI_ANIM, __pVertices != null, point, E_INVALID_STATE, "%s Vertices haven't been allocated(%i, %i)",GetErrorMessage(E_INVALID_STATE), arrayIndex, __countOfAllocatedVertex );
+
+ point.x = __pVertices[arrayIndex * APPROPRIATE_COUNT_VERTICES];
+ point.y = __pVertices[arrayIndex * APPROPRIATE_COUNT_VERTICES + 1];
+ point.z = __pVertices[arrayIndex * APPROPRIATE_COUNT_VERTICES + 2];
- if(__pVertices)
- {
- point.x = __pVertices[arrayIndex*3];
- point.y = __pVertices[arrayIndex*3+1];
- point.z = __pVertices[arrayIndex*3+2];
- }
return point;
}
FloatPoint
_MeshImpl::GetTextureCoord(int arrayIndex) const
{
- FloatPoint point(0,0);
- if(__pTexCoordinates)
- {
- point.x = __pTexCoordinates[arrayIndex*3];
- point.y = __pTexCoordinates[arrayIndex*3+1];
- }
+ FloatPoint point(0.0f, 0.0f);
+
+ bool arrayIndexState = ((arrayIndex < __countOfAllocatedVertex) && (arrayIndex >= 0));
+
+ SysTryReturn(NID_UI_ANIM, arrayIndexState, point, E_INVALID_ARG, "%s Index is out of range(%d, %d)", GetErrorMessage(E_INVALID_ARG), arrayIndex, __countOfAllocatedVertex);
+ SysTryReturn(NID_UI_ANIM, __pTexCoordinates != null, point, E_INVALID_STATE, "%s TexCoordinates haven't been allocated", GetErrorMessage(E_INVALID_STATE));
+
+ point.x = __pTexCoordinates[arrayIndex * APPROPRIATE_COUNT_TEXTCOORDINATES];
+ point.y = __pTexCoordinates[arrayIndex * APPROPRIATE_COUNT_TEXTCOORDINATES+1];
+
return point;
}
FloatPoint3
_MeshImpl::GetNormal(int arrayIndex) const
{
- FloatPoint3 point(0,0,0);
+ FloatPoint3 point(0.0f, 0.0f, 0.0f);
+
+ bool arrayIndexState = ((arrayIndex < __countOfAllocatedVertex) && (arrayIndex >= 0));
+
+ SysTryReturn(NID_UI_ANIM, arrayIndexState, point, E_INVALID_ARG, "%s Index is out of range(%d, %d)", GetErrorMessage(E_INVALID_ARG), arrayIndex, __countOfAllocatedVertex);
+ SysTryReturn(NID_UI_ANIM, __pNormals != null, point, E_INVALID_STATE, "%s Normals haven't been allocated", GetErrorMessage(E_INVALID_STATE));
+
+ point.x = __pNormals[arrayIndex * APPROPRIATE_COUNT_NORMALS];
+ point.y = __pNormals[arrayIndex * APPROPRIATE_COUNT_NORMALS + 1];
+ point.z = __pNormals[arrayIndex * APPROPRIATE_COUNT_NORMALS + 2];
- if(__pNormals)
- {
- point.x = __pNormals[arrayIndex*3];
- point.y = __pNormals[arrayIndex*3+1];
- point.z = __pNormals[arrayIndex*3+2];
- }
return point;
}
{
Color color;
- if(__pColors)
- {
- color.SetRed (__pColors[arrayIndex*4] *255.0f);
- color.SetGreen (__pColors[arrayIndex*4 + 1]*255.0f);
- color.SetBlue (__pColors[arrayIndex*4 + 2]*255.0f);
- color.SetAlpha (__pColors[arrayIndex*4 + 3]*255.0f);
- }
+ bool arrayIndexState = ((arrayIndex < __countOfAllocatedVertex) && (arrayIndex >= 0));
+
+ SysTryReturn(NID_UI_ANIM, arrayIndexState, color, E_INVALID_ARG, "%s Index out of range(%d, %d)", GetErrorMessage(E_INVALID_ARG), arrayIndex, __countOfAllocatedVertex);
+ SysTryReturn(NID_UI_ANIM, __pColors != null, color, E_INVALID_STATE, "%s Colors haven't been allocated", GetErrorMessage(E_INVALID_STATE));
+
+ color.SetRed (__pColors[arrayIndex * APPROPRIATE_COUNT_COLORS] * 255.0f);
+ color.SetGreen (__pColors[arrayIndex * APPROPRIATE_COUNT_COLORS + 1] * 255.0f);
+ color.SetBlue (__pColors[arrayIndex * APPROPRIATE_COUNT_COLORS + 2] * 255.0f);
+ color.SetAlpha (__pColors[arrayIndex * APPROPRIATE_COUNT_COLORS + 3] * 255.0f);
return color;
}
int
_MeshImpl::GetIndex(int arrayIndex) const
{
- if(__pIndices)
- {
- return __pIndices[arrayIndex];
- }
- return 0;
+ bool arrayIndexState = ((arrayIndex < __countOfAllocatedIndex) && (arrayIndex >= 0));
+
+ SysTryReturn(NID_UI_ANIM, arrayIndexState, 0, E_INVALID_ARG, "%s Index out of range(%d, %d)", GetErrorMessage(E_INVALID_ARG), arrayIndex, __countOfAllocatedIndex);
+ SysTryReturn(NID_UI_ANIM, __pIndices != null, 0, E_INVALID_STATE, "%s Indices haven't been allocated", GetErrorMessage(E_INVALID_STATE));
+
+ return __pIndices[arrayIndex];
}
result
_MeshImpl::SetGeometryType(Mesh::GeometryType type)
{
-
__geoType = type;
+
return E_SUCCESS;
}
_MeshImpl::AdjustBoundingVolume(bool rebuild)
{
MESH_LOCK();
+ result r;
- if(__pVertices)
+ SysTryReturnResult(NID_UI_ANIM, __pVertices != null, E_INVALID_STATE, " Vertices haven't been allocated");
+
+ __boundingVolume.Reset();
+
+ FloatPoint3 v;
+ for (int i = 0; i < __countOfVertex; i++)
{
- __boundingVolume.Reset();
-
- FloatPoint3 v;
- for(int i = 0; i < __countOfVertex; i++)
- {
- v.x = __pVertices[i * 3];
- v.y = __pVertices[i * 3 + 1];
- v.z = __pVertices[i * 3 + 2];
- __boundingVolume.Merge(v);
- }
-
- __hasBoundingVolume = true;
+ v.x = __pVertices[i * APPROPRIATE_COUNT_VERTICES];
+ v.y = __pVertices[i * APPROPRIATE_COUNT_VERTICES + 1];
+ v.z = __pVertices[i * APPROPRIATE_COUNT_VERTICES + 2];
+ r = __boundingVolume.Merge(v);
+ SysTryCatch(NID_UI_ANIM, r == E_SUCCESS, , r, "%s Adds volume of specified BoundingVolume to this BoundingVolume is failed.", GetErrorMessage(r));
}
+ __hasBoundingVolume = true;
+
return E_SUCCESS;
+
+ CATCH:
+ __boundingVolume.Reset();
+ __hasBoundingVolume = false;
+ return r;
}
BoundingVolume&
//}
Mesh*
-_MeshImpl::LoadFromBinaryN(const std::string& fileName, const std::string& modelName)
+_MeshImpl::LoadMeshFromBinaryN(const std::string& fileName, const std::string& modelName)
{
result r;
int quantityReadFromFile;
SysTryCatch(NID_UI_ANIM, pMesh != null, , E_OUT_OF_MEMORY, "%s Memory allocation failed while creating Mesh.", GetErrorMessage(E_OUT_OF_MEMORY));
pMeshImpl = pMesh->__pMeshImpl;
- AppLog("Loading Mesh");
Header localCapacity;
{
r = pMeshImpl->AllocIndices(pMeshImpl->__countOfAllocatedIndex);
SysTryCatch(NID_UI_ANIM, r == E_SUCCESS, , r, "%s. Propagating", GetErrorMessage(r));
- intsData = pMeshImpl->__countOfAllocatedVertex;
+ intsData = pMeshImpl->__countOfAllocatedIndex;
quantityReadFromFile += fread(&pMeshImpl->__pIndices[0], sizeof(uint16_t), intsData, pFile);
}
}
result
-_MeshImpl::SaveMesh(const Tizen::Base::String& fileName)
+_MeshImpl::SaveMeshToBin(const Tizen::Base::String& fileName)
{
- AppLog("SaveMesh debug");
int quantityWriteToFile;
result r;
int32_t intsData;
FILE* pFile;
SetLastResult(E_SUCCESS);
- //SysAssert(__pMeshImpl != null);
std::wstring wStr(fileName.GetPointer());
std::string str(wStr.begin(), wStr.end());
pFile = fopen(str.c_str(), "w");
r = E_OPERATION_FAILED;
SysTryReturn(NID_UI_ANIM, pFile != null, r, r, "%s Error occurred while saving Mesh to file: %s", GetErrorMessage(r), str.c_str());
- AppLog("SaveMesh debug");
Header capacity;
capacity.SetMeshArrays(*this);
intsData = static_cast<int>(__hasBoundingVolume);
quantityWriteToFile += fwrite(&intsData, sizeof(int32_t), 1, pFile);
- AppLog("SaveMesh debug");
-
intsData = static_cast<int>(__geoType);
quantityWriteToFile += fwrite(&intsData, sizeof(int32_t), 1, pFile);
- AppLog("SaveMesh debug");
r = E_INVALID_DATA;
SysTryCatch(NID_UI_ANIM, capacity.isVerticesEnabled, , r, "%s. Propagating", GetErrorMessage(r));
intsData = (__countOfAllocatedVertex * APPROPRIATE_COUNT_VERTICES);
quantityWriteToFile += fwrite(&__pVertices[0], sizeof(float), intsData, pFile);
- AppLog("SaveMesh debug");
if (capacity.isColorEnabled)
{
intsData = (__countOfAllocatedVertex * APPROPRIATE_COUNT_COLORS);
quantityWriteToFile += fwrite(&__pNormals[0], sizeof(float), intsData, pFile);
}
- AppLog("SaveMesh debug");
if (capacity.isTextureCoordinateEnabled)
{
intsData = (__countOfAllocatedVertex * APPROPRIATE_COUNT_TEXTCOORDINATES);
quantityWriteToFile += fwrite(&__pTexCoordinates[0], sizeof(float), intsData, pFile);
}
- AppLog("SaveMesh debug");
intsData = __countOfIndex;
quantityWriteToFile += fwrite(&intsData, sizeof(int32_t), 1, pFile);
if (capacity.isIndexEnabled)
{
- intsData = (__countOfAllocatedVertex);
+ intsData = (__countOfAllocatedIndex);
quantityWriteToFile += fwrite(&__pIndices[0], sizeof(uint16_t), intsData, pFile);
}
intsData = __name.size();
quantityWriteToFile += fwrite(&intsData, sizeof(int32_t), 1, pFile);
- quantityWriteToFile += fwrite(__name.c_str(), sizeof(int32_t), 1, pFile);
+ quantityWriteToFile += fwrite(__name.c_str(), 1, intsData, pFile);
fclose(pFile);
- AppLog("SaveMesh debug");
return E_SUCCESS;
CATCH:
fclose(pFile);
- AppLog("SaveMesh debug");
return r;
}