Added: #1440 Serialization types for different geometry buffers

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent a8a6be68d5
commit 89df4ad8f7

@ -73,19 +73,37 @@ namespace STORAGE {
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
void CGeomTriIndex::serial(NLMISC::IStream &stream)
{
stream.serial(a);
stream.serial(b);
stream.serial(c);
}
std::string CGeomTriIndex::toString() const
{
std::stringstream ss;
ss << a << " " << b << " " << c;
return ss.str();
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
void CGeomTriIndexInfo::serial(NLMISC::IStream &stream) void CGeomTriIndexInfo::serial(NLMISC::IStream &stream)
{ {
stream.serial(a); stream.serial(a);
stream.serial(b); stream.serial(b);
stream.serial(c); stream.serial(c);
stream.serial(i1); stream.serial(alwaysOne);
stream.serial(i2); stream.serial(smoothingGroups);
} }
std::string CGeomTriIndexInfo::toString() const std::string CGeomTriIndexInfo::toString() const
{ {
std::stringstream ss; std::stringstream ss;
ss << a << ", " << b << ", " << c << ", " << i1 << ", " << i2; ss << a << " " << b << " " << c << ", " << alwaysOne << " " << smoothingGroups;
return ss.str(); return ss.str();
} }
@ -137,21 +155,23 @@ IStorageObject *CGeomBuffers::createChunkById(uint16 id, bool container)
{ {
switch (id) switch (id)
{ {
case PMBS_GEOM_BUFFERS_TRI_B_VERTEX_CHUNK_ID: //case PBMS_GEOM_BUFFERS_POLY_A_VERTEX_CHUNK_ID:
case PMBS_GEOM_BUFFERS_TRI_C_VERTEX_CHUNK_ID: // nlassert(!container);
case PBMS_GEOM_BUFFERS_POLY_A_VERTEX_CHUNK_ID: // return new CStorageArray<float>();
nlassert(!container); //case PBMS_GEOM_BUFFERS_POLY_A_INDEX_A_CHUNK_ID:
return new CStorageArray<float>(); //case PBMS_GEOM_BUFFERS_POLY_A_INDEX_B_CHUNK_ID:
// nlassert(!container);
// return new CStorageArray<uint32>();
case PMBS_GEOM_BUFFERS_TRI_B_INDEX_CHUNK_ID: case PMBS_GEOM_BUFFERS_TRI_B_INDEX_CHUNK_ID:
case PMBS_GEOM_BUFFERS_TRI_C_INDEX_CHUNK_ID: case PMBS_GEOM_BUFFERS_TRI_C_INDEX_CHUNK_ID:
case PBMS_GEOM_BUFFERS_POLY_A_INDEX_A_CHUNK_ID:
case PBMS_GEOM_BUFFERS_POLY_A_INDEX_B_CHUNK_ID:
nlassert(!container); nlassert(!container);
return new CStorageArray<uint32>(); return new CStorageArray<CGeomTriIndex>(); // nb: parse should check if the sizes match with tri_a size (which is the master index buffer)
case PMBS_GEOM_BUFFERS_TRI_A_INDEX_CHUNK_ID: case PMBS_GEOM_BUFFERS_TRI_A_INDEX_CHUNK_ID:
nlassert(!container); nlassert(!container);
return new CStorageArraySizePre<CGeomTriIndexInfo>(); return new CStorageArraySizePre<CGeomTriIndexInfo>();
case PMBS_GEOM_BUFFERS_TRI_A_VERTEX_CHUNK_ID: case PMBS_GEOM_BUFFERS_TRI_A_VERTEX_CHUNK_ID:
case PMBS_GEOM_BUFFERS_TRI_B_VERTEX_CHUNK_ID:
case PMBS_GEOM_BUFFERS_TRI_C_VERTEX_CHUNK_ID:
nlassert(!container); nlassert(!container);
return new CStorageArraySizePre<NLMISC::CVector>(); return new CStorageArraySizePre<NLMISC::CVector>();
} }

@ -41,13 +41,22 @@ namespace MAX {
namespace BUILTIN { namespace BUILTIN {
namespace STORAGE { namespace STORAGE {
struct CGeomTriIndex
{
uint32 a;
uint32 b;
uint32 c;
void serial(NLMISC::IStream &stream);
std::string toString() const;
};
struct CGeomTriIndexInfo struct CGeomTriIndexInfo
{ {
uint32 a; uint32 a;
uint32 b; uint32 b;
uint32 c; uint32 c;
uint32 i1; uint32 alwaysOne;
uint32 i2; uint32 smoothingGroups;
void serial(NLMISC::IStream &stream); void serial(NLMISC::IStream &stream);
std::string toString() const; std::string toString() const;
}; };

Loading…
Cancel
Save