123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
-
-
- #ifndef _RENDER_H_
- #define _RENDER_H_
-
- #include <vector>
-
- #include "Config.h"
- #include "math/Matrix.h"
- #include "ViewVolume.h"
- #include "World.h"
- #include "SkeletalModel.h"
- #include "Mesh.h"
- #include "Texture.h"
- #include "Camera.h"
-
- #ifdef USING_EMITTER
- #include "Emitter.h"
- #endif
-
-
- class Light {
- public:
-
-
- typedef enum {
- typePoint = 1,
- typeSpot = 2,
- typeDirectional = 3
- } LightType;
-
- vec4_t mPos;
- vec3_t mDir;
- float mAtt;
- vec4_t mColor;
- vec_t mCutoff;
- LightType mType;
- };
-
-
- class RenderRoom {
- public:
-
-
-
- RenderRoom() {
- room = 0x0;
- dist = 0.0f;
- }
-
-
-
- ~RenderRoom() {
-
- for (std::vector<Light *>::size_type i = 0; i != lights.size(); i++) {
- if (lights[i])
- delete lights[i];
- }
- lights.clear();
- }
-
- vec_t dist;
- std::vector<Light *> lights;
- Mesh mesh;
-
-
- room_mesh_t *room;
- };
-
-
- class Render {
- public:
-
- typedef enum {
- modeDisabled,
- modeLoadScreen,
- modeVertexLight,
- modeSolid,
- modeWireframe,
- modeTexture
- } RenderMode;
-
- typedef enum {
- fParticles = (1 << 0),
- fPortals = (1 << 1),
- fRoomAlpha = (1 << 2),
- fViewModel = (1 << 3),
- fSprites = (1 << 4),
- fRoomModels = (1 << 5),
- fEntityModels = (1 << 6),
- fFog = (1 << 7),
- fUsePortals = (1 << 8),
- fGL_Lights = (1 << 9),
- fOneRoom = (1 << 10),
- fRenderPonytail = (1 << 11),
- fMultiTexture = (1 << 12),
- fUpdateRoomListPerFrame = (1 << 13),
- fAnimateAllModels = (1 << 14),
- fAllRooms = (1 << 15)
- } RenderFlags;
-
- typedef enum {
- roomMesh,
- skeletalMesh
- } RenderMeshType;
-
-
-
- Render();
-
-
-
- ~Render();
-
-
-
- void screenShot(char *filenameBase);
-
-
-
- int getMode();
-
- void addRoom(RenderRoom *rRoom);
-
-
-
- void loadTexture(unsigned char *image,
- unsigned int width, unsigned int height,
- unsigned int id);
-
-
-
- void initTextures(char *textureDir, unsigned int *numLoaded,
- unsigned int *nextId);
-
-
-
- void initEmitter(const char *name, unsigned int size,
- unsigned int snowTex1, unsigned int snowTex2);
-
-
-
- void ClearWorld();
-
-
-
- void clearFlags(unsigned int flags);
-
-
-
- void setFlags(unsigned int flags);
-
- void setMode(int n);
-
-
-
- void Display();
-
- void setSkyMesh(int index, bool rot);
-
- void ViewModel(entity_t *ent, int index);
-
- void addSkeletalModel(SkeletalModel *mdl);
-
- unsigned int getFlags();
-
-
-
- ViewVolume mViewVolume;
- std::vector<SkeletalModel *> mModels;
-
- private:
-
- void drawLoadScreen();
-
-
-
- bool isVisible(float bboxMin[3], float bboxMax[3]);
-
-
-
- bool isVisible(float x, float y, float z);
-
-
-
- bool isVisible(float x, float y, float z, float radius);
-
-
-
- void newRoomRenderList(int index);
-
-
-
- void buildRoomRenderList(RenderRoom *room);
-
-
-
- void drawObjects();
-
-
-
- void drawSkyMesh(float scale);
-
-
-
- void drawModel(SkeletalModel *model);
-
-
-
- void drawRoom(RenderRoom *rRoom, bool draw_alpha);
-
-
-
- void drawRoomModel(static_model_t *mesh);
-
-
-
- void drawModelMesh(model_mesh_t *r_mesh, RenderMeshType type);
-
-
-
- void drawSprite(sprite_t *sprite);
-
-
-
- void updateViewVolume();
-
-
- void tmpRenderModelMesh(model_mesh_t *r_mesh, texture_tri_t *ttri);
-
- Texture mTexture;
-
- std::vector<RenderRoom *> mRoomRenderList;
- std::vector<RenderRoom *> mRooms;
-
- unsigned int mFlags;
- unsigned int mMode;
- unsigned int *mNumTexturesLoaded;
- unsigned int *mNextTextureId;
- int mLock;
- int mSkyMesh;
- bool mSkyMeshRotation;
-
- #ifdef USING_EMITTER
- Emitter *mEmitter;
- #endif
- };
-
- #endif
|