forked from 0ad/0ad
prefect
6fc1f45fa6
Added float-to-byte color conversion, including an SSE assembler version. Model renderer: Push UV coordinates into a shared vertex array and use bytes instead of floats for the color array, thereby, significantly reducing the total size of vertex arrays. This was SVN commit r2827.
47 lines
987 B
C++
47 lines
987 B
C++
#ifndef __MODELDEFRDATA_H__
|
|
#define __MODELDEFRDATA_H__
|
|
|
|
#include "graphics/ModelDef.h"
|
|
#include "renderer/ModelRData.h"
|
|
#include "renderer/VertexArray.h"
|
|
|
|
|
|
class CModelRData;
|
|
|
|
// Maintain rendering data that can be shared across models
|
|
// that are based on the same model definition.
|
|
class CModelDefRData : public CSharedRenderData
|
|
{
|
|
friend class CModelRData;
|
|
|
|
public:
|
|
CModelDefRData(CModelDef* mdef);
|
|
virtual ~CModelDefRData();
|
|
|
|
// Setup shared vertex arrays required by streamflags
|
|
void PrepareStream(uint streamflags);
|
|
|
|
// Submit one model
|
|
void Submit(CModelRData* data);
|
|
// Clear all submissions for this CModelDef
|
|
void ClearSubmissions();
|
|
|
|
private:
|
|
// Build and upload vertex arrays
|
|
void Build();
|
|
|
|
private:
|
|
CModelDef* m_ModelDef;
|
|
|
|
VertexArray m_Array;
|
|
VertexArray::Attribute m_UV;
|
|
|
|
CModelDefRData* m_SubmissionNext;
|
|
uint m_SubmissionSlots;
|
|
std::vector<CModelRData*> m_SubmissionModels;
|
|
static CModelDefRData* m_Submissions;
|
|
};
|
|
|
|
|
|
#endif // __MODELDEFRDATA_H__
|