88 lines
1.8 KiB
C++
88 lines
1.8 KiB
C++
#ifndef IMesh_h__
|
|
#define IMesh_h__
|
|
|
|
#include "IGraphicsNode.h"
|
|
#include "render/IVertexBuffer.h"
|
|
#include "render/IIndexBuffer.h"
|
|
//#include "render/IMaterial.h"
|
|
#include "render/IInputLayout.h"
|
|
#include "SkinInfo.h"
|
|
|
|
#ifndef SAFE_DELETE
|
|
#define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } }
|
|
#endif
|
|
#ifndef SAFE_DELETE_ARRAY
|
|
#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } }
|
|
#endif
|
|
#ifndef SAFE_RELEASE
|
|
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } }
|
|
#endif
|
|
|
|
namespace LifeGraphics
|
|
{
|
|
class GeometrySubset
|
|
{
|
|
public:
|
|
GeometrySubset()
|
|
{
|
|
MatrixList = (int*)0;
|
|
}
|
|
~GeometrySubset()
|
|
{
|
|
//SAFE_DELETE_ARRAY(MatrixList);
|
|
}
|
|
int HasBones;
|
|
int Length;
|
|
int Offset, FaceCount, BonesCount;
|
|
int* MatrixList;
|
|
int matrixCount;
|
|
//IMaterial material;
|
|
//public LifeMaterial Material;
|
|
};
|
|
|
|
class IMesh
|
|
{
|
|
public:
|
|
int Id;
|
|
LifeCore::BoundingBox3D bBox;
|
|
LifeMath::float3 transformedBox[8];
|
|
String Name;
|
|
IMesh(IVertexBuffer* _vertexData, IIndexBuffer* _indexData, GeometrySubset* _subsets, IInputLayout* _layout, int isSkinned, const LifeCore::BoundingBox3D& box, const String& name)
|
|
{
|
|
Name = name;
|
|
IsSkinned = isSkinned;
|
|
Id = 0;
|
|
vertexData = _vertexData;
|
|
indexData = _indexData;
|
|
subsets = _subsets;
|
|
inputLayout = _layout;
|
|
bBox = box;
|
|
|
|
bBox.GetCorners(transformedBox);
|
|
|
|
/*
|
|
if(subsetCount == 2)
|
|
subsetCount = 1;*/
|
|
}
|
|
virtual ~IMesh()
|
|
{
|
|
SAFE_DELETE(vertexData);
|
|
SAFE_DELETE(indexData);
|
|
SAFE_DELETE_ARRAY(subsets);
|
|
SAFE_DELETE(inputLayout);
|
|
}
|
|
NodeType getType()
|
|
{
|
|
return NT_MESH;
|
|
}
|
|
int subsetCount;
|
|
public:
|
|
IVertexBuffer* vertexData;
|
|
IIndexBuffer* indexData;
|
|
GeometrySubset* subsets;
|
|
IInputLayout* inputLayout;
|
|
SkinInfo skin;
|
|
int IsSkinned;
|
|
};
|
|
}
|
|
#endif // IMesh_h__
|