
This commit completes the support for modifiers in the BGE. - The physic shape is generated according to the derived mesh. This is true for all types of shapes and all types of objects except soft body. - Optimization for static derived mesh (mesh with modifiers but no armature and no shape keys). Replicas will share the derived mesh and the display list: less memory and faster rendering. With this optimization, the static derived mesh will render as fast as if the modifiers were applied. Known Limits: - Sharing of mesh and display list is only possible between in-game replicas or dupligroup. If you want to instantiate multiple objects with modifiers, use dupligroup to ensure best memory and GPU utilization. - rayCast() will interact with the derived mesh as follow: Hit position and hit normal are the real values according to the derived mesh but the KX_PolyProxy object refers to the original mesh. You should use it only to retrieve the material. - Dynamic derived mesh have very poor performance: They use direct openGL calls for rendering (no support for display list and vertex array) and they dont't share the derived mesh memory. Always apply modifiers on dynamic mesh for best performance. - Time dependent modifiers are not supported. - Modifiers are not supported for Bullet soft body.
72 lines
1.5 KiB
C++
72 lines
1.5 KiB
C++
#ifndef __RAS_LISTRASTERIZER_H__
|
|
#define __RAS_LISTRASTERIZER_H__
|
|
|
|
#include "RAS_MaterialBucket.h"
|
|
#include "RAS_VAOpenGLRasterizer.h"
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
class RAS_ListRasterizer;
|
|
class RAS_ListSlot : public KX_ListSlot
|
|
{
|
|
friend class RAS_ListRasterizer;
|
|
unsigned int m_list;
|
|
unsigned int m_flag;
|
|
RAS_ListRasterizer* m_rasty;
|
|
public:
|
|
RAS_ListSlot(RAS_ListRasterizer* rasty);
|
|
virtual ~RAS_ListSlot();
|
|
virtual void SetModified(bool mod);
|
|
virtual int Release();
|
|
|
|
void RemoveList();
|
|
void DrawList();
|
|
void EndList();
|
|
bool End();
|
|
|
|
};
|
|
|
|
enum RAS_ListSlotFlags {
|
|
LIST_CREATE =1,
|
|
LIST_MODIFY =2,
|
|
LIST_STREAM =4,
|
|
LIST_NOCREATE =8,
|
|
LIST_BEGIN =16,
|
|
LIST_END =32,
|
|
LIST_REGEN =64,
|
|
LIST_DERIVEDMESH=128,
|
|
};
|
|
|
|
struct DerivedMesh;
|
|
|
|
typedef std::map<RAS_DisplayArrayList, RAS_ListSlot*> RAS_ArrayLists;
|
|
typedef std::map<DerivedMesh*, RAS_ListSlot*> RAS_DerivedMeshLists;
|
|
|
|
class RAS_ListRasterizer : public RAS_VAOpenGLRasterizer
|
|
{
|
|
bool mUseVertexArrays;
|
|
bool mATI;
|
|
RAS_ArrayLists mArrayLists;
|
|
RAS_DerivedMeshLists mDerivedMeshLists;
|
|
|
|
RAS_ListSlot* FindOrAdd(class RAS_MeshSlot& ms);
|
|
void ReleaseAlloc();
|
|
|
|
public:
|
|
void RemoveListSlot(RAS_ListSlot* list);
|
|
RAS_ListRasterizer(RAS_ICanvas* canvas, bool useVertexArrays=false, bool lock=false);
|
|
virtual ~RAS_ListRasterizer();
|
|
|
|
virtual void IndexPrimitives(class RAS_MeshSlot& ms);
|
|
virtual void IndexPrimitivesMulti(class RAS_MeshSlot& ms);
|
|
|
|
virtual bool Init();
|
|
virtual void Exit();
|
|
|
|
virtual void SetDrawingMode(int drawingmode);
|
|
|
|
virtual bool QueryLists(){return true;}
|
|
};
|
|
|
|
#endif
|