134 lines
2.9 KiB
C++
134 lines
2.9 KiB
C++
/*
|
|
ZStaticMesh.h
|
|
Author: Chris Ertel <crertel@762studios.com>
|
|
|
|
Purpose: Classes for holding static mesh data.
|
|
|
|
Changelog
|
|
2011/09/18 - creation (crertel)
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifndef _ZSTATICMESH_H
|
|
#define _ZSTATICMESH_H
|
|
|
|
#include <ZUtil/ZSmartPointer.hpp>
|
|
#include <ZSTL/ZArray.hpp>
|
|
#include <ZSTL/ZString.hpp>
|
|
|
|
typedef uint32_t ZSMFaceIndex;
|
|
|
|
typedef enum ZSMChannelType
|
|
{
|
|
ZSMCT_UNKNOWN = 0,
|
|
|
|
ZSMCT_BOOL = 0x11,
|
|
ZSMCT_BOOL_VEC2 = 0x12,
|
|
ZSMCT_BOOL_VEC3 = 0x13,
|
|
ZSMCT_BOOL_VEC4 = 0x14,
|
|
|
|
ZSMCT_INT = 0x21,
|
|
ZSMCT_INT_VEC2 = 0x22,
|
|
ZSMCT_INT_VEC3 = 0x23,
|
|
ZSMCT_INT_VEC4 = 0x24,
|
|
|
|
ZSMCT_UINT = 0x31,
|
|
ZSMCT_UINT_VEC2 = 0x32,
|
|
ZSMCT_UINT_VEC3 = 0x33,
|
|
ZSMCT_UINT_VEC4 = 0x34,
|
|
|
|
ZSMCT_FLOAT = 0x41,
|
|
ZSMCT_FLOAT_VEC2 = 0x42,
|
|
ZSMCT_FLOAT_VEC3 = 0x43,
|
|
ZSMCT_FLOAT_VEC4 = 0x44
|
|
};
|
|
|
|
class ZSMChannelDefinition
|
|
{
|
|
protected:
|
|
ZString Name;
|
|
ZSMChannelType Datatype;
|
|
uint32_t StartOffset;
|
|
uint32_t Stride;
|
|
|
|
public:
|
|
ZSMChannelDefinition( ZString _name, ZSMChannelType _datatype, uint32_t _offset, uint32_t _stride)
|
|
: Name(_name), Datatype(_datatype), StartOffset(_offset), Stride(_stride)
|
|
{
|
|
}
|
|
};
|
|
|
|
class ZStaticMeshMaterial
|
|
{
|
|
protected:
|
|
ZString Name;
|
|
ZArray< ZSMFaceIndex > FaceIndices;
|
|
ZArray< ZPtr<ZSMChannelDefinition> > ChannelDefinitions;
|
|
|
|
public:
|
|
ZStaticMeshMaterial(ZString _name, ZArray< ZSMFaceIndex> _faceIndices, ZArray< ZPtr<ZSMChannelDefinition> > _channelDefinitions)
|
|
: Name(_name), FaceIndices(_faceIndices), ChannelDefinitions(_channelDefinitions)
|
|
{
|
|
}
|
|
|
|
/*
|
|
public ZStaticMeshMaterial::GetName
|
|
|
|
Function to get the name of the material.
|
|
|
|
@return (ZString) - Name of the material.
|
|
*/
|
|
inline ZString GetName() { return this->Name; }
|
|
|
|
/*
|
|
public ZStaticMeshMaterial::GetFaceIndices
|
|
|
|
Function to get the face indices for a material.
|
|
|
|
@return (ZArray<ZSMFaceIndex>) - Array of the face indices.
|
|
*/
|
|
inline ZArray<ZSMFaceIndex> GetFaceIndices() { return this->FaceIndices; }
|
|
|
|
/*
|
|
public ZStaticMeshMaterial::GetChannelDefinitions
|
|
|
|
Function to get the vertex channel definiitions for this material.
|
|
|
|
@return (ZArray<ZSMChannelDefinition>) - Array of vertex channel definitions.
|
|
*/
|
|
inline ZArray< ZPtr<ZSMChannelDefinition> > GetChannelDefinitions() { return this->ChannelDefinitions; }
|
|
};
|
|
|
|
class ZStaticMesh
|
|
{
|
|
protected:
|
|
ZArray< ZPtr<ZStaticMeshMaterial> > MaterialGroups;
|
|
ZPtr< ZArray< char > > VertexData;
|
|
|
|
public:
|
|
ZStaticMesh(ZArray< ZPtr<ZStaticMeshMaterial> > _groups, ZPtr< ZArray< char > > _vertexData)
|
|
: MaterialGroups(_groups), VertexData(_vertexData)
|
|
{
|
|
}
|
|
|
|
/*
|
|
public ZStaticMesh::GetMaterialGroups
|
|
|
|
Function to get the material groups.
|
|
|
|
@return (ZArray<ZStaticMeshMaterialGroup>) - Material groups that make up the mesh.
|
|
*/
|
|
inline ZArray< ZPtr<ZStaticMeshMaterial> > GetMaterialGroups() { return this->MaterialGroups; }
|
|
|
|
/*
|
|
public ZStaticMesh::GetVertexData
|
|
|
|
Function to get the vertex data.
|
|
|
|
@return (ZPtr< ZArray< char > >) - Vertex data for the mesh.
|
|
*/
|
|
inline ZPtr< ZArray< char > > GetVertexData() { return this->VertexData; }
|
|
};
|
|
|
|
#endif |