Solar System - demo scence
engine.cpp File Reference
#include <GL/glut.h>
#include <tinyxml2.h>
#include <stdio.h>
#include <vector>
#include "parsing.h"

Go to the source code of this file.

Classes

struct  model
 

Macros

#define DEFAULT_GLOBAL_EYE_STEP   1.0f
 
#define DEFAULT_GLOBAL_EYE_X   1.0f
 
#define DEFAULT_GLOBAL_EYE_Y   (-5.0f)
 
#define DEFAULT_GLOBAL_EYE_Z   (-30.0f)
 
#define DEFAULT_GLOBAL_CENTER_STEP   1.0f
 
#define DEFAULT_GLOBAL_CENTER_X   0.0f
 
#define DEFAULT_GLOBAL_CENTER_Y   0.0f
 
#define DEFAULT_GLOBAL_CENTER_Z   0.0f
 
#define DEFAULT_GLOBAL_UP_STEP   1.0f
 
#define DEFAULT_GLOBAL_UP_X   0.0f
 
#define DEFAULT_GLOBAL_UP_Y   1.0f
 
#define DEFAULT_GLOBAL_UP_Z   0.0f
 

Typedefs

typedef struct model * Model
 

Functions

Model allocModel (const char *path)
 
void renderModel (Model model)
 
void renderAllModels ()
 
size_t readModelToBuffer (const char *path, float *p, unsigned int n)
 
void renderTriangleVertexSeq (float *p, unsigned int nVertices)
 
void changeSize (int w, int h)
 
void operations_render (std::vector< float > *operations)
 
void renderScene ()
 
void xml_load_and_set_env (const char *filename)
 
void engine_run (int argc, char **argv)
 
int main (int argc, char **argv)
 
int load_xml1 (FILE *xmlFILE)
 

Variables

static float globalAngle = 0
 
static float globalRotateX = 0
 
static float globalRotateY = 0
 
static float globalRotateZ = 0
 
static float globalTranslateX = 0
 
static float globalTranslateY = 0
 
static float globalTranslateZ = 0
 
static float globalScaleX = 1
 
static float globalScaleY = 1
 
static float globalScaleZ = 1
 
static float globalEyeX = DEFAULT_GLOBAL_EYE_X
 
static float globalEyeY = DEFAULT_GLOBAL_EYE_Y
 
static float globalEyeZ = DEFAULT_GLOBAL_EYE_Z
 
static float globalCenterX = DEFAULT_GLOBAL_CENTER_X
 
static float globalCenterY = DEFAULT_GLOBAL_CENTER_Y
 
static float globalCenterZ = DEFAULT_GLOBAL_CENTER_Z
 
static float globalUpX = DEFAULT_GLOBAL_UP_X
 
static float globalUpY = DEFAULT_GLOBAL_UP_Y
 
static float globalUpZ = DEFAULT_GLOBAL_UP_Z
 
static float globalFOV = 45.0f
 
static float globalNear = 1.0f
 
static float globalFar = 1000.0f
 
static std::vector< Model > globalModels
 
static std::vector< float > globalOperations
 

Function Documentation

◆ load_xml1()

int load_xml1 ( FILE *  xmlFILE)
284 {
285 tinyxml2::XMLDocument doc;
286 doc.LoadFile(xmlFILE);
287
288 globalEyeX = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
289 "position")->FloatAttribute("x");
290 globalEyeY = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
291 "position")->FloatAttribute("y");
292 globalEyeZ = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
293 "position")->FloatAttribute("z");
294
295 globalCenterX = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
296 "lookAt")->FloatAttribute("x");
297 globalCenterY = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
298 "lookAt")->FloatAttribute("y");
299 globalCenterZ = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
300 "lookAt")->FloatAttribute("z");
301
302 globalUpX = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
303 "up")->FloatAttribute("x");
304 globalUpY = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
305 "up")->FloatAttribute("y");
306 globalUpZ = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
307 "up")->FloatAttribute("z");
308 globalFOV = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
309 "projection")->FloatAttribute("fov");
310 globalNear = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
311 "projection")->FloatAttribute("near");
312 globalFar = doc.FirstChildElement("world")->FirstChildElement("camera")->FirstChildElement(
313 "projection")->FloatAttribute("far");
314
315 globalModels.push_back(allocModel(
316 doc.FirstChildElement("world")->FirstChildElement("group")->FirstChildElement(
317 "models")->FirstChildElement("model")->Attribute("file")));
318
319 tinyxml2::XMLElement *model2 = doc.FirstChildElement("world")->FirstChildElement("group")->FirstChildElement(
320 "models")->FirstChildElement("model")->NextSiblingElement("model");
321
322 if (model2) globalModels.push_back(allocModel(model2->Attribute("file")));
323
324 return 1;
325}
static float globalFar
Definition: engine.cpp:64
static float globalCenterX
Definition: engine.cpp:54
static float globalEyeY
Definition: engine.cpp:51
static float globalNear
Definition: engine.cpp:63
Model allocModel(const char *path)
Definition: engine.cpp:74
static float globalFOV
Definition: engine.cpp:62
static float globalUpX
Definition: engine.cpp:58
static std::vector< Model > globalModels
Definition: engine.cpp:71
static float globalEyeZ
Definition: engine.cpp:52
static float globalUpZ
Definition: engine.cpp:60
static float globalUpY
Definition: engine.cpp:59
static float globalCenterZ
Definition: engine.cpp:56
static float globalEyeX
Definition: engine.cpp:50
static float globalCenterY
Definition: engine.cpp:55

References allocModel(), globalCenterX, globalCenterY, globalCenterZ, globalEyeX, globalEyeY, globalEyeZ, globalFar, globalFOV, globalModels, globalNear, globalUpX, globalUpY, and globalUpZ.