2007-12-24 14:11:18 -08:00
|
|
|
/*
|
2007-10-24 06:12:10 -07:00
|
|
|
* PieToaster is an OpenGL application to edit 3D models in
|
|
|
|
* Warzone 2100's (an RTS game) PIE 3D model format, which is heavily
|
|
|
|
* inspired by PieSlicer created by stratadrake.
|
|
|
|
* Copyright (C) 2007 Carl Hee
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2007-10-24 05:29:36 -07:00
|
|
|
#ifndef _resmaster_h
|
|
|
|
#define _resmaster_h
|
|
|
|
|
2007-12-25 10:26:15 -08:00
|
|
|
#include <SDL_opengl.h>
|
2007-10-24 05:29:36 -07:00
|
|
|
|
2007-12-24 14:11:18 -08:00
|
|
|
#include "wzglobal.h"
|
2007-10-24 05:29:36 -07:00
|
|
|
#include "pie_types.h"
|
|
|
|
|
|
|
|
#include "imdloader.h"
|
|
|
|
#include "texture.h"
|
|
|
|
|
|
|
|
#include "pie_internal.h"
|
|
|
|
|
|
|
|
#include "texture_mapper.h"
|
|
|
|
|
2007-12-24 14:11:18 -08:00
|
|
|
#include "AntTweakBar.h"
|
2007-10-24 05:29:36 -07:00
|
|
|
|
2007-12-24 14:50:45 -08:00
|
|
|
extern Uint16 shiftChar(Uint16 key);
|
2007-12-24 14:11:18 -08:00
|
|
|
|
|
|
|
typedef struct _ogl_extension_string {
|
|
|
|
char string[255];
|
|
|
|
} OGL_EXTENSION_STRING;
|
2007-10-24 05:29:36 -07:00
|
|
|
|
|
|
|
class CResMaster {
|
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
FILL = 0,
|
|
|
|
LINE = 1,
|
|
|
|
POINT = 2,
|
|
|
|
SMOOTH = 0,
|
|
|
|
FLAT = 1
|
|
|
|
};
|
|
|
|
|
2007-12-24 14:50:45 -08:00
|
|
|
static const Uint32 MAX_GL_EXTENSIONS = 500;
|
2007-12-24 14:11:18 -08:00
|
|
|
|
|
|
|
OGL_EXTENSION_STRING m_oglExtensions[MAX_GL_EXTENSIONS];
|
2007-12-24 14:50:45 -08:00
|
|
|
Uint32 m_numExtensions;
|
2007-12-24 14:11:18 -08:00
|
|
|
|
2007-12-24 14:50:45 -08:00
|
|
|
Uint32 m_textureToProcess;
|
|
|
|
Uint32 m_pieCount;
|
|
|
|
Uint32 m_numNewPies;
|
2007-10-24 05:29:36 -07:00
|
|
|
|
|
|
|
float m_rotateX; ///<rotation of models X
|
|
|
|
float m_rotateY; ///<rotation of models X
|
|
|
|
float m_scale; ///<scale of models
|
2007-12-24 14:50:45 -08:00
|
|
|
Uint32 m_polygonMode; ///<polygon mode to render polygons
|
2007-10-24 05:29:36 -07:00
|
|
|
bool m_highLightVertices; ///<highlight vertice or not
|
|
|
|
bool m_highLightConnectors; ///<highlight connector or not
|
|
|
|
bool m_highLightSelected;
|
|
|
|
bool m_drawAxis; ///<whether to draw X,Y,Z axis or not
|
2007-12-24 14:11:18 -08:00
|
|
|
bool m_drawGrids;
|
2007-10-24 05:29:36 -07:00
|
|
|
bool m_drawTexture; ///<whether to draw textures or not
|
|
|
|
bool m_drawNewVertice; ///<whether to draw new vertice position or not
|
2007-12-24 14:11:18 -08:00
|
|
|
bool m_drawTexts; ///<whether to draw selected vertice/poly/connector id text or not
|
2007-12-24 14:50:45 -08:00
|
|
|
Uint32 m_shadeMode; ///<shade mode of polygons
|
2007-10-24 05:29:36 -07:00
|
|
|
float m_gamma; ///<gamma correction of renderer
|
2007-12-24 14:50:45 -08:00
|
|
|
Sint32 m_newPieTextureId; ///<new pie textureId
|
2007-12-24 14:11:18 -08:00
|
|
|
bool m_oldFormat; ///old integer format
|
2007-10-24 05:29:36 -07:00
|
|
|
|
2007-12-24 14:11:18 -08:00
|
|
|
CResMaster();
|
2007-10-24 05:29:36 -07:00
|
|
|
|
|
|
|
~CResMaster();
|
|
|
|
bool isLinkerUp(void) {return m_PolyLinker.m_Up;};
|
|
|
|
void activeLinker(void);
|
|
|
|
void deactiveLinker(void);
|
|
|
|
bool readTextureList(const char *filename);
|
|
|
|
bool loadTexPages(void);
|
|
|
|
bool freeTexPages(void);
|
|
|
|
|
|
|
|
void enableTexture(bool value);
|
|
|
|
|
|
|
|
bool addPie(iIMDShape *imd, const char *name);
|
2007-12-24 14:50:45 -08:00
|
|
|
bool removePieAt(Uint16 i);
|
|
|
|
CPieInternal *getPieAt(Uint16 i);
|
2007-10-24 05:29:36 -07:00
|
|
|
|
|
|
|
bool addGUI(void);
|
|
|
|
|
2007-12-24 14:11:18 -08:00
|
|
|
void logic(void);
|
|
|
|
|
2007-10-24 05:29:36 -07:00
|
|
|
void draw(void);
|
|
|
|
|
|
|
|
void drawAxis(void);
|
2007-12-24 14:11:18 -08:00
|
|
|
void drawGrids(void);
|
|
|
|
void drawTexts(void);
|
|
|
|
|
|
|
|
#ifdef SDL_TTF_TEST
|
|
|
|
TTF_Font *m_Font;
|
|
|
|
|
|
|
|
bool initFont(void);
|
2007-12-24 14:50:45 -08:00
|
|
|
bool loadFont(const char *name, Uint8 size);
|
2007-12-24 14:11:18 -08:00
|
|
|
#endif
|
2007-12-24 14:50:45 -08:00
|
|
|
void drawText(const char *text, float objX, float objY, float ObjZ, SDL_Color color, Uint8 style);
|
2007-10-24 05:29:36 -07:00
|
|
|
|
|
|
|
void unprojectMouseXY(double *newX1, double *newY1, double *newZ1,
|
|
|
|
double *newX2, double *newY2, double *newZ2);
|
|
|
|
|
|
|
|
void updateInput(void);
|
|
|
|
|
|
|
|
bool isTextureMapperUp(void) {return m_TextureMapper.m_Up;};
|
|
|
|
void startMapTexture(void);
|
|
|
|
void stopMapTexture(void);
|
2007-12-24 14:11:18 -08:00
|
|
|
|
|
|
|
void cacheGridsVertices(void);
|
|
|
|
|
|
|
|
void mergePies(void);
|
|
|
|
|
|
|
|
void getOGLExtensionString(void);
|
|
|
|
bool isOGLExtensionAvailable(const char *extension);
|
2007-10-24 05:29:36 -07:00
|
|
|
private:
|
|
|
|
CPieInternal *m_Pies[MAX_PIES];
|
2007-12-24 14:11:18 -08:00
|
|
|
CPieInternal *m_MergedPie;
|
2007-10-24 05:29:36 -07:00
|
|
|
CPolygonLinker m_PolyLinker;
|
|
|
|
CTextureMapper m_TextureMapper;
|
|
|
|
char m_TexPageNames[MAX_TEX_PAGES][MAX_FILE_NAME_LENGTH];
|
2007-12-24 14:11:18 -08:00
|
|
|
SDL_Surface *m_TexSurfaces[MAX_TEX_PAGES];
|
|
|
|
|
|
|
|
Vector3f m_GridCacheVertices[65536];
|
2007-12-24 14:50:45 -08:00
|
|
|
Uint32 m_GridCacheCount;
|
2007-12-24 14:11:18 -08:00
|
|
|
GLuint m_GridVBOId;
|
2007-10-24 05:29:36 -07:00
|
|
|
|
|
|
|
TwBar *m_utilBar;
|
|
|
|
TwBar *m_textureBar;
|
|
|
|
};
|
|
|
|
|
2007-12-24 14:11:18 -08:00
|
|
|
extern CResMaster ResMaster;
|
2007-10-24 05:29:36 -07:00
|
|
|
|
|
|
|
#endif
|