Browse Source

unbreaking assimp

master
cinnaboot 8 years ago
parent
commit
12677b455a
  1. 54
      src/hexgame.cpp
  2. 7
      src/hexgame.h
  3. 125
      src/mesh.cpp
  4. 28
      src/mesh.h
  5. 36
      src/render_group.cpp
  6. 1
      src/render_group.h
  7. 27
      src/renderer.cpp
  8. 2
      src/renderer.h
  9. 266
      tags

54
src/hexgame.cpp

@ -433,7 +433,7 @@ cleanUp(SDL_Handles &handles)
freeBuffers(); // renderer.h
for (SDL_Surface *surface : handles.texSurfaces)
SDL_FreeSurface(surface);
shutdownAssimp(); // mesh.h
meShutdownAssimp(); // mesh.h
IMG_Quit(); // SDL_image
SDL_GL_DeleteContext(handles.glContext);
SDL_DestroyWindow(handles.window);
@ -449,12 +449,8 @@ cleanUp(SDL_Handles &handles)
// TODO: C-style memory management for entities
render_state* r = g_render_state;
if (r) {
// delete entities
for (uint i = 0; i < r->entity_count; i++) {
std::free(r->entities[i].vertices);
r->entities[i].vertices = nullptr;
std::free(r->entities[i].indices);
r->entities[i].indices = nullptr;
meFreeMesh(r->entities[i].mesh);
}
std::free(r->entities);
@ -496,14 +492,12 @@ int main(int argc, char* argv[])
createHexes(g_game_state->hex_array, g_game_state->hex_layout, g_render_state->fill_color);
SDL_Handles handles;
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
LOG(ERROR) << "Error, SDL_Init: " << SDL_GetError() << "\n";
return 1;
}
if (!initRenderer(handles, g_render_state->viewport_dims))
{
if (!initRenderer(handles, g_render_state->viewport_dims)) {
LOG(ERROR) << "Unable to initialize graphics, exiting\n";
return 1;
}
@ -528,39 +522,37 @@ int main(int argc, char* argv[])
}
}
if (!initAssimp())
{
if (meInitAssimp()) {
// TODO: better entity memory management
// TODO: hard coded limit of 1000 entities here
Entity* e = (Entity*) std::calloc(1000, sizeof(Entity));
render_state* r = g_render_state;
r->entities = e;
const char* test_file = "../data/animated.block.dae";
meMeshInfo* mesh = meLoadFromFile(test_file);
if (mesh != nullptr) {
r->entities[r->entity_count].mesh = mesh;
r->entity_count++;
}
} else {
LOG(ERROR) << "Error initializing assimp\n";
return 1;
}
{
// TODO: keep better track of entity memory
Entity* e = (Entity*) std::calloc(1, sizeof(Entity));
e->num_vertices = getVertexCount();
e->num_indices = getIndexCount();
e->vertices = (glm::vec3 *) std::calloc(e->num_vertices, sizeof(glm::vec3));
e->indices = (uint *) std::calloc(e->num_indices, sizeof(uint));
convertMesh(e);
g_render_state->entities = e;
g_render_state->entity_count++;
}
if (!createScene(g_game_state->hex_array, g_render_state->entities, g_render_state->entity_count))
{
if (!createScene(g_game_state->hex_array, g_render_state->entities, g_render_state->entity_count)) {
LOG(ERROR) << "Error in vertex data, exiting\n";
return 1;
}
if (!initGooey(handles, g_render_state->viewport_dims))
{
if (!initGooey(handles, g_render_state->viewport_dims)) {
LOG(ERROR) << "Fooey, No Gooey!\n";
return 1;
}
// main loop
while (processSDLEvents())
{
while (processSDLEvents()) {
// TODO: remove hack to not peg CPU. replace with an actual frame timer
SDL_Delay(16); // ~60hz
game_state* g = g_game_state;
@ -568,7 +560,7 @@ int main(int argc, char* argv[])
moveCamera(g->is_moveup, g->is_moveleft, g->is_movedown, g->is_moveright,
g->is_moveforward, g->is_movebackward);
rollCamera(g->is_rotateCW, g->is_rotateCCW);
renderFrame(g->hex_array);
renderFrame(g->hex_array, g_render_state->entities, g_render_state->entity_count);
if (r->is_debug_draw && g->draw_mode == CONE_FILL)
renderDebug(g_polygon_select_vertices);
renderGooey(handles, g->draw_mode, r->is_debug_draw, g->start_hex,

7
src/hexgame.h

@ -13,6 +13,7 @@
#include <glm/glm.hpp> // vec3
#include "hexlib.h"
#include "mesh.h"
typedef float real32;
typedef double real64;
@ -77,11 +78,7 @@ enum HexDrawMode
struct Entity
{
glm::mat4 model_transform;
uint num_vertices = 0;
glm::vec3* vertices = nullptr;
uint num_indices = 0;
uint* indices = nullptr;
meMeshInfo* mesh;
};
struct render_state

125
src/mesh.cpp

@ -1,122 +1,97 @@
#include <cassert>
#include <cstdlib> // calloc
#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <glm/glm.hpp> // vec3
#include <glm/glm.hpp>
#include <glm/geometric.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "aixlog.hpp"
#include "mesh.h"
//typedef struct meMatInfo meMatInfo;
struct meMatInfo
{
aiString name;
aiColor3D diffuse_color;
};
struct meMeshInfo
{
aiString name;
meMatInfo* mat;
};
/* the global Assimp scene object */
const aiScene* g_scene = NULL;
bool
meInitAssimp()
{
LOG(INFO) << "Initializing Assimp\n";
/* get a handle to the predefined STDOUT log stream and attach
* it to the logging system. It remains active for all further
* calls to aiImportFile(Ex) and aiApplyPostProcessing. */
aiLogStream stream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL);
aiAttachLogStream(&stream);
g_scene = aiImportFile("../data/animated.block.dae", aiProcessPreset_TargetRealtime_MaxQuality);
// testing
aiMaterial* mat = g_scene->mMaterials[0];
aiColor3D color(0.f, 0.f, 0.f);
if (AI_SUCCESS != mat->Get(AI_MATKEY_COLOR_DIFFUSE, color)) {
LOG(ERROR) << "Some Assimp-type-error\n";
}
//////////
if (g_scene->mNumMeshes != 1) {
LOG(ERROR) << "We Can only handle 1 mesh per entity atm\n";
return false;
}
return true;
}
bool
meLoadFromFile(const char* filename, meMeshInfo* mesh)
{
return true;
}
uint
meGetVertexCount(meMeshInfo* mesh)
meMeshInfo*
meLoadFromFile(const char* filename)
{
assert(g_scene);
return g_scene->mMeshes[0]->mNumVertices;
}
const aiScene* scene = aiImportFile(filename, aiProcessPreset_TargetRealtime_MaxQuality);
uint
meGetIndexCount(meMeshInfo* mesh)
{
assert(g_scene);
return g_scene->mMeshes[0]->mNumFaces * 3; // NOTE: assume 3 vertices per face
}
if (scene->mNumMeshes != 1) {
LOG(ERROR) << "We Can only handle 1 mesh per entity atm\n";
return nullptr;
}
// TODO: probably don't really need to copy this here
// let assimp manage the storage, and just reference indexes after passing
// to opengl
meMeshInfo* mesh = (meMeshInfo*) std::calloc(1, sizeof(meMeshInfo));
// TODO: using hard model transform for now
mesh->model_transform = glm::scale(glm::mat4(1), glm::vec3(100, 100, 100));
// copy data from assimp for use in our renderer
Entity*
meConvertMesh(Entity* e, meMeshInfo* mesh)
{
assert(g_scene);
uint numVertices = meGetVertexCount(mesh);
assert(e && e->num_vertices == numVertices);
//aiMesh* mesh = g_scene->mMeshes[0];
// allocate buffers for vertex and index data from mesh
mesh->num_vertices = scene->mMeshes[0]->mNumVertices;
mesh->vertices = (glm::vec3 *) std::calloc(mesh->num_vertices, sizeof(glm::vec3));
mesh->num_indices = scene->mMeshes[0]->mNumFaces * 3; // NOTE: assume 3 vertices per face
mesh->indices = (uint *) std::calloc(mesh->num_indices, sizeof(uint));
// copy vertices
for (uint i = 0; i < numVertices; i++) {
aiVector3D v_in = mesh->mVertices[i];
glm::vec3 &v_out = e->vertices[i];
for (uint i = 0; i < mesh->num_vertices; i++) {
aiVector3D v_in = scene->mMeshes[0]->mVertices[i];
glm::vec3& v_out = mesh->vertices[i];
v_out.x = v_in.x;
v_out.y = v_in.y;
v_out.z = v_in.z;
}
// copy indices
uint numFaces = g_scene->mMeshes[0]->mNumFaces;
e->num_indices = numFaces * 3; //NOTE: assume 3 vertices per face
for (uint i = 0; i < numFaces; i++) {
for (uint i = 0; i < scene->mMeshes[0]->mNumFaces; i++)
for (uint j = 0; j < 3; j++)
e->indices[i * 3 + j] = mesh->mFaces[i].mIndices[j];
mesh->indices[i * 3 + j] = scene->mMeshes[0]->mFaces[i].mIndices[j];
#if 0
// testing
aiMaterial* mat = g_scene->mMaterials[0];
aiColor3D color(0.f, 0.f, 0.f);
if (AI_SUCCESS != mat->Get(AI_MATKEY_COLOR_DIFFUSE, color)) {
LOG(ERROR) << "Some Assimp-type-error\n";
}
return e;
//////////
#endif
// free memeory from assimp
aiReleaseImport(scene);
return mesh;
}
void
meShutdownAssimp()
meFreeMesh(meMeshInfo* mesh)
{
std::free(mesh->vertices);
mesh->vertices = nullptr;
std::free(mesh->indices);
mesh->indices = nullptr;
std::free(mesh);
mesh = nullptr;
}
/* cleanup - calling 'aiReleaseImport' is important, as the library
keeps internal resources until the scene is freed again. Not
doing so can cause severe resource leaking. */
aiReleaseImport(g_scene);
void
meShutdownAssimp()
{
aiDetachAllLogStreams();
}

28
src/mesh.h

@ -5,21 +5,33 @@
#pragma once
#include "hexgame.h"
struct meMatInfo
{
const char* name = "";
//aiColor3D diffuse_color;
};
typedef struct meMeshInfo meMeshInfo;
struct meMeshInfo
{
const char* name = "";
meMatInfo* mat;
bool meInitAssimp();
// TODO: thinking of what properties to store
// only handle 1 mesh, 1 material, 1 texture for nw
uint num_vertices = 0;
glm::vec3* vertices = nullptr;
uint num_indices = 0;
uint* indices = nullptr;
glm::mat4 model_transform;
};
bool meLoadFromFile(const char* filename, meMeshInfo* mesh);
uint meGetVertexCount(meMeshInfo* mesh);
bool meInitAssimp();
uint meGetIndexCount(meMeshInfo* mesh);
meMeshInfo* meLoadFromFile(const char* filename);
// copy data from assimp for use in our renderer
Entity* meConvertMesh(Entity* e);
void meFreeMesh(meMeshInfo* mesh);
void meShutdownAssimp();

36
src/render_group.cpp

@ -12,7 +12,7 @@
#include "aixlog.hpp"
#include "render_group.h"
#include "mesh.h"
gl_render_group*
rgCreateGroup()
@ -123,10 +123,7 @@ rgInitEntity(gl_render_group* rg, Entity* e)
{
bool retVal = true;
// TODO: entity scaling
e->model_transform = glm::scale(glm::mat4(1), glm::vec3(100, 100, 100));
uint entity_buf_len = e->num_vertices * 3;
uint entity_buf_len = e->mesh->num_vertices * 3;
GLfloat* entity_buf = (GLfloat*) std::calloc(entity_buf_len, sizeof(GLfloat));
GLfloat* entity_color_buf = (GLfloat*) std::calloc(entity_buf_len, sizeof(GLfloat));
@ -137,7 +134,7 @@ rgInitEntity(gl_render_group* rg, Entity* e)
convertColor(entity_test_color, 0xCCCCCCFF /*0xF46000FF*/);
for (uint j = 0; j < entity_buf_len; j++) {
const glm::vec3& vertex = e->vertices[vertex_index];
const glm::vec3& vertex = e->mesh->vertices[vertex_index];
switch (vertex_prop_index) {
case 0: entity_buf[j] = vertex.x; break;
@ -154,33 +151,26 @@ rgInitEntity(gl_render_group* rg, Entity* e)
}
}
#if 1
rgInitGLBufferObject(&rg->vertex_buffer, entity_buf_len,
GL_DYNAMIC_DRAW, GL_ARRAY_BUFFER, entity_buf);
rgInitGLBufferObject(&rg->color_buffer, entity_buf_len,
GL_STATIC_DRAW, GL_ARRAY_BUFFER, entity_color_buf);
#endif
// TODO: testing indexed draw
// dump indices into temp buffer
gl_index_buffer index_buffer;
index_buffer.buffer_len = e->num_indices;
index_buffer.indices = (uint *) std::calloc(e->num_indices, sizeof(uint));
index_buffer.buffer_len = e->mesh->num_indices;
index_buffer.indices = (uint *) std::calloc(e->mesh->num_indices, sizeof(uint));
for (uint i = 0; i < e->num_indices; i++)
index_buffer.indices[i] = e->indices[i];
for (uint i = 0; i < e->mesh->num_indices; i++)
index_buffer.indices[i] = e->mesh->indices[i];
rg->index_buffer = index_buffer;
glGenBuffers(1, &rg->index_buffer.buffer_id);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, rg->index_buffer.buffer_id);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, e->num_indices * sizeof(uint),
glBufferData(GL_ELEMENT_ARRAY_BUFFER, e->mesh->num_indices * sizeof(uint),
rg->index_buffer.indices, GL_STATIC_DRAW);
//rgInitGLBufferObject(&rg->index_buffer, rg->index_buffer.num_indices,
// GL_STATIC_DRAW, GL_ELEMENT_ARRAY_BUFFER, rg->index_buffer.indices);
//////////
std::free(entity_buf);
std::free(entity_color_buf);
@ -267,7 +257,9 @@ rgDrawIndexed(gl_render_group* rg, GLenum draw_mode, glm::mat4 model_matrix,
void
rgFree(gl_render_group* rg)
{
assert(rg != nullptr);
if (rg == nullptr)
return;
gl_buffer bufs[] = {rg->vertex_buffer, rg->color_buffer};
for (uint i = 0; i < 2; i++) {
gl_buffer& buf = bufs[i];
@ -282,10 +274,6 @@ rgFree(gl_render_group* rg)
rg->index_buffer.indices = nullptr;
}
if (rg->entities != nullptr) {
// TODO: handle entity memory
}
std::free(rg);
rg = nullptr;
}

1
src/render_group.h

@ -30,7 +30,6 @@ struct gl_render_group
GLuint view_matrix_id = 0;
GLuint projection_matrix_id = 0;
GLuint vertex_array_id = 0;
Entity* entities = nullptr;
};
typedef struct gl_buffer gl_buffer;

27
src/renderer.cpp

@ -105,6 +105,7 @@ struct camera
gl_matrix_info g_scene_matrices;
// TODO: maybe don't allocate memory here, at least before initRenderer()
gl_render_group* g_filled_hex_render_group = rgCreateGroup();
gl_render_group* g_hex_line_render_group = rgCreateGroup();
gl_render_group* g_debug_render_group = rgCreateGroup();
@ -381,7 +382,6 @@ createScene(std::vector<hex_info>* hexes, Entity* entities, uint32 entity_count)
initMatrices(PROJ_TYPE);
// Vertex Data
// TODO: index duplicate vertices
// http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-9-vbo-indexing/
int hex_count = (int) hexes->size();
@ -426,20 +426,12 @@ createScene(std::vector<hex_info>* hexes, Entity* entities, uint32 entity_count)
vbuf = cbuf = line_buf = nullptr;
// debug draw vertexes
// 4 vertices, 3 floats per vertex
int len = 4 * 3;
int len = 4 * 3; // 4 vertices, 3 floats per vertex
rgInitGLBufferObject(&g_debug_render_group->vertex_buffer, len,
GL_DYNAMIC_DRAW, GL_ARRAY_BUFFER, 0);
///////////////
// TODO: Testing Entities/assimp model loading
g_entity_render_group->entities = &entities[0];
if (!rgInitEntity(g_entity_render_group, &entities[0]))
return false;
/////////
for (uint i = 0; i < entity_count; i++)
rgInitEntity(g_entity_render_group, &entities[i]);
return true;
}
@ -529,7 +521,7 @@ rollCamera(bool CW, bool CCW)
}
void
renderFrame(std::vector<hex_info> *hexes)
renderFrame(std::vector<hex_info> *hexes, Entity* entities, uint32 entity_count)
{
glClearColor(g_clear_col.R, g_clear_col.G, g_clear_col.B, g_clear_col.A);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
@ -549,9 +541,12 @@ renderFrame(std::vector<hex_info> *hexes)
rgDraw(g_hex_line_render_group, GL_LINES, m_model, m_view, m_projection);
// TODO: testing entity rendering
rg = g_entity_render_group;
rgDrawIndexed(rg, GL_TRIANGLES, rg->entities[0].model_transform, m_view, m_projection);
// entities
for (uint i = 0; i < entity_count; i++) {
rgDrawIndexed(
g_entity_render_group, GL_TRIANGLES,
entities[i].mesh->model_transform, m_view, m_projection);
}
}
void

2
src/renderer.h

@ -12,7 +12,7 @@ bool createScene(std::vector<hex_info>* hexes, Entity* entities, uint32 entity_c
void moveCamera(bool up, bool left, bool down, bool right, bool forward, bool backward);
void rollCamera(bool CW, bool CCW);
void rotateCamera(int32 xrel, int32 yrel);
void renderFrame(std::vector<hex_info> *hexes);
void renderFrame(std::vector<hex_info> *hexes, Entity* entities, uint32 entity_count);
void renderDebug(std::vector<Point> &vertices);
void freeBuffers();

266
tags

@ -0,0 +1,266 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.8 //
A src/renderer.cpp /^ real32 A;$/;" m struct:clear_col file:
B src/renderer.cpp /^ real32 B;$/;" m struct:clear_col file:
CAMERA_Z_CLAMP_ANGLE src/renderer.cpp 29;" d file:
CONE_ANGLE src/hexgame.cpp 19;" d file:
CONE_FILL src/hexgame.h /^ CONE_FILL,$/;" e enum:HexDrawMode
DEBUG_DRAW src/hexgame.cpp 16;" d file:
DEBUG_FRAGMENT_SHADER_CODE src/renderer.cpp /^const char * DEBUG_FRAGMENT_SHADER_CODE =$/;" v
EVEN src/hexlib.cpp /^const int EVEN = 1;$/;" v
Entity src/hexgame.h /^struct Entity$/;" s
FILL src/hexgame.h /^ FILL,$/;" e enum:HexDrawMode
FILL_COLOR src/hexgame.cpp 14;" d file:
FRAGMENT_SHADER_CODE src/renderer.cpp /^const char * FRAGMENT_SHADER_CODE =$/;" v
FractionalHex src/hexlib.h /^ FractionalHex(double q_, double r_, double s_): q(q_), r(r_), s(s_) {}$/;" f struct:FractionalHex
FractionalHex src/hexlib.h /^struct FractionalHex$/;" s
G src/renderer.cpp /^ real32 G;$/;" m struct:clear_col file:
HEX_ORIENTATION src/hexgame.cpp 13;" d file:
HEX_RADIUS src/hexgame.cpp 12;" d file:
HEX_SIZE src/hexgame.cpp 11;" d file:
Hex src/hexlib.h /^ Hex(): q(0), r(0), s(0) {}$/;" f struct:Hex
Hex src/hexlib.h /^ Hex(int q_, int r_, int s_): q(q_), r(r_), s(s_) {}$/;" f struct:Hex
Hex src/hexlib.h /^struct Hex$/;" s
HexDrawMode src/hexgame.h /^enum HexDrawMode$/;" g
LINE src/hexgame.h /^ LINE,$/;" e enum:HexDrawMode
LINE_FRAGMENT_SHADER_CODE src/renderer.cpp /^const char * LINE_FRAGMENT_SHADER_CODE =$/;" v
Layout src/hexlib.h /^ Layout(Orientation orientation_, Point size_, Point origin_):$/;" f struct:Layout
Layout src/hexlib.h /^struct Layout$/;" s
MOVE_SPEED src/renderer.cpp 27;" d file:
MVP src/renderer.cpp /^ glm::mat4 MVP;$/;" m struct:gl_matrix_info file:
NONE src/hexgame.h /^ NONE,$/;" e enum:HexDrawMode
ODD src/hexlib.cpp /^const int ODD = -1;$/;" v
ORTHOGRAPHIC src/renderer.cpp /^ ORTHOGRAPHIC,$/;" e enum:projection_type file:
OffsetCoord src/hexlib.cpp /^ OffsetCoord(int col_, int row_): col(col_), row(row_) {}$/;" f struct:OffsetCoord
OffsetCoord src/hexlib.cpp /^struct OffsetCoord$/;" s file:
Orientation src/hexlib.h /^ Orientation(double f0_, double f1_, double f2_, double f3_, double b0_,$/;" f struct:Orientation
Orientation src/hexlib.h /^struct Orientation$/;" s
PATHFINDING src/hexgame.h /^ PATHFINDING$/;" e enum:HexDrawMode
PERSPECTIVE src/renderer.cpp /^ PERSPECTIVE,$/;" e enum:projection_type file:
PROJ_TYPE src/renderer.cpp 31;" d file:
Point src/hexlib.h /^ Point(): x(0), y(0) {}$/;" f struct:Point
Point src/hexlib.h /^ Point(double x_, double y_): x(x_), y(y_) {}$/;" f struct:Point
Point src/hexlib.h /^struct Point$/;" s
R src/renderer.cpp /^ real32 R;$/;" m struct:clear_col file:
ROTATE_SPEED src/renderer.cpp 28;" d file:
SDL_Handles src/hexgame.h /^struct SDL_Handles$/;" s
SELECTED_FILL_COLOR src/hexgame.cpp 15;" d file:
SafeRatio src/hexgame.h /^SafeRatio(real32 dividend, real32 divisor)$/;" f
SafeTruncateToInt32 src/hexgame.h /^SafeTruncateToInt32(int64 val)$/;" f
VERTEX_SHADER_CODE src/renderer.cpp /^const char * VERTEX_SHADER_CODE =$/;" v
VIEWPORT_HEIGHT src/hexgame.cpp 18;" d file:
VIEWPORT_WIDTH src/hexgame.cpp 17;" d file:
WinMain src/hexgame.cpp /^int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,$/;" f
XPos src/hexgame.h /^ real64 XPos = 0;$/;" m struct:hex_info
YPos src/hexgame.h /^ real64 YPos = 0;$/;" m struct:hex_info
addTexture src/renderer.cpp /^addTexture(SDL_Handles &handles, const char * path)$/;" f
b0 src/hexlib.h /^ double b0;$/;" m struct:Orientation
b1 src/hexlib.h /^ double b1;$/;" m struct:Orientation
b2 src/hexlib.h /^ double b2;$/;" m struct:Orientation
b3 src/hexlib.h /^ double b3;$/;" m struct:Orientation
bool32 src/hexgame.h /^typedef int32_t bool32;$/;" t
buffer src/render_group.h /^ GLfloat* buffer = nullptr;$/;" m struct:gl_buffer
buffer_id src/render_group.h /^ GLuint buffer_id = 0;$/;" m struct:gl_buffer
buffer_id src/render_group.h /^ GLuint buffer_id = 0;$/;" m struct:gl_index_buffer
buffer_len src/render_group.h /^ size_t buffer_len = 0; \/\/ NOTE: number of elements in buffer$/;" m struct:gl_buffer
buffer_len src/render_group.h /^ size_t buffer_len = 0;$/;" m struct:gl_index_buffer
camera src/renderer.cpp /^struct camera$/;" s file:
cleanUp src/hexgame.cpp /^cleanUp(SDL_Handles &handles)$/;" f
clear_col src/renderer.cpp /^typedef struct clear_col$/;" s file:
clear_col src/renderer.cpp /^} clear_col;$/;" t typeref:struct:clear_col file:
col src/hexlib.cpp /^ const int col;$/;" m struct:OffsetCoord file:
color_buffer src/render_group.h /^ gl_buffer color_buffer;$/;" m struct:gl_render_group
convertColor src/render_group.cpp /^convertColor(GLfloat buf[3], uint32 color)$/;" f
createHexes src/hexgame.cpp /^createHexes(vector<hex_info> *hxi_array, const Layout &layout, uint32 color)$/;" f
createScene src/renderer.cpp /^createScene(std::vector<hex_info>* hexes, Entity* entities, uint32 entity_count)$/;" f
crossingTest src/hexlib.cpp /^crossingTest(vector<Point> vertices, Point p)$/;" f
currentDisplayMode src/hexgame.h /^ SDL_DisplayMode currentDisplayMode;$/;" m struct:SDL_Handles
current_color src/hexgame.h /^ uint32 current_color = 0; \/\/ RGBA$/;" m struct:hex_info
current_hex src/hexgame.h /^ hex_info *current_hex;$/;" m struct:game_state
draw_mode src/hexgame.h /^ HexDrawMode draw_mode;$/;" m struct:game_state
entities src/hexgame.h /^ Entity* entities = nullptr;$/;" m struct:render_state
entities src/render_group.h /^ Entity* entities = nullptr;$/;" m struct:gl_render_group
entity_count src/hexgame.h /^ uint32 entity_count = 0;$/;" m struct:render_state
f0 src/hexlib.h /^ double f0;$/;" m struct:Orientation
f1 src/hexlib.h /^ double f1;$/;" m struct:Orientation
f2 src/hexlib.h /^ double f2;$/;" m struct:Orientation
f3 src/hexlib.h /^ double f3;$/;" m struct:Orientation
fillHexLineBuffer src/renderer.cpp /^fillHexLineBuffer(GLfloat buf[], int len, std::vector<hex_info>* hexes)$/;" f
fillTriangleBufferFromHex src/renderer.cpp /^fillTriangleBufferFromHex(GLfloat buf[], int idx, const hex_info &hex)$/;" f
fill_color src/hexgame.h /^ uint32 fill_color;$/;" m struct:render_state
forward src/renderer.cpp /^ glm::vec3 forward;$/;" m struct:camera file:
freeBuffers src/renderer.cpp /^freeBuffers()$/;" f
g_camera src/renderer.cpp /^camera g_camera;$/;" v
g_debug_render_group src/renderer.cpp /^gl_render_group* g_debug_render_group = rgCreateGroup();$/;" v
g_entity_render_group src/renderer.cpp /^gl_render_group* g_entity_render_group = rgCreateGroup();$/;" v
g_filled_hex_render_group src/renderer.cpp /^gl_render_group* g_filled_hex_render_group = rgCreateGroup();$/;" v
g_hex_line_render_group src/renderer.cpp /^gl_render_group* g_hex_line_render_group = rgCreateGroup();$/;" v
g_polygon_select_vertices src/hexgame.cpp /^vector<Point> g_polygon_select_vertices = {Point(), Point(), Point(), Point()};$/;" v
g_render_state src/hexgame.cpp /^render_state* g_render_state;$/;" v
g_scene_matrices src/renderer.cpp /^gl_matrix_info g_scene_matrices;$/;" v
game_state src/hexgame.h /^ game_state(Layout &l) : hex_layout(l) {}$/;" f struct:game_state
game_state src/hexgame.h /^struct game_state$/;" s
getSingleHex src/hexgame.cpp /^getSingleHex(int32 x, int32 y)$/;" f
getUnprojectedCoords src/renderer.cpp /^getUnprojectedCoords(int32 x, int32 y, int32 vp_width, int32 vp_height)$/;" f
glContext src/hexgame.h /^ SDL_GLContext glContext;$/;" m struct:SDL_Handles
gl_buffer src/render_group.h /^struct gl_buffer$/;" s
gl_buffer src/render_group.h /^typedef struct gl_buffer gl_buffer;$/;" t typeref:struct:gl_buffer
gl_index_buffer src/render_group.h /^struct gl_index_buffer$/;" s
gl_index_buffer src/render_group.h /^typedef struct gl_index_buffer gl_index_buffer;$/;" t typeref:struct:gl_index_buffer
gl_matrix_info src/renderer.cpp /^typedef struct gl_matrix_info$/;" s file:
gl_matrix_info src/renderer.cpp /^} gl_matrix_info;$/;" t typeref:struct:gl_matrix_info file:
gl_render_group src/render_group.h /^struct gl_render_group$/;" s
gl_render_group src/render_group.h /^typedef struct gl_render_group gl_render_group;$/;" t typeref:struct:gl_render_group
gooeyProcessEvent src/gooey.cpp /^gooeyProcessEvent(SDL_Event &event)$/;" f
hAngle src/renderer.cpp /^ float hAngle;$/;" m struct:camera file:
handleMouseDown src/hexgame.cpp /^handleMouseDown(SDL_MouseButtonEvent &e)$/;" f
handleMouseMove src/hexgame.cpp /^handleMouseMove(SDL_MouseMotionEvent &e)$/;" f
handleMouseUp src/hexgame.cpp /^handleMouseUp(SDL_MouseButtonEvent &e)$/;" f
hex src/hexgame.h /^ Hex hex = {};$/;" m struct:hex_info
hexID src/hexgame.h /^ int32 hexID = 0;$/;" m struct:hex_info
hex_add src/hexlib.cpp /^Hex hex_add(Hex a, Hex b)$/;" f
hex_array src/hexgame.h /^ std::vector<hex_info> *hex_array;$/;" m struct:game_state
hex_conefill src/hexlib.cpp /^hex_conefill(Hex a, Hex b)$/;" f
hex_corner_offset src/hexlib.cpp /^Point hex_corner_offset(Layout layout, int corner)$/;" f
hex_diagonal_neighbor src/hexlib.cpp /^Hex hex_diagonal_neighbor(Hex hex, int direction)$/;" f
hex_diagonals src/hexlib.cpp /^const vector<Hex> hex_diagonals = {Hex(2, -1, -1), Hex(1, -2, 1), Hex(-1, -1, 2), Hex(-2, 1, 1), Hex(-1, 2, -1), Hex(1, 1, -2)};$/;" v
hex_direction src/hexlib.cpp /^Hex hex_direction(int direction)$/;" f
hex_directions src/hexlib.cpp /^const vector<Hex> hex_directions = {Hex(1, 0, -1), Hex(1, -1, 0), Hex(0, -1, 1), Hex(-1, 0, 1), Hex(-1, 1, 0), Hex(0, 1, -1)};$/;" v
hex_distance src/hexlib.cpp /^int hex_distance(Hex a, Hex b)$/;" f
hex_equal src/hexlib.cpp /^hex_equal(Hex a, Hex b)$/;" f
hex_info src/hexgame.h /^struct hex_info$/;" s
hex_layout src/hexgame.h /^ const Layout hex_layout;$/;" m struct:game_state
hex_length src/hexlib.cpp /^int hex_length(Hex hex)$/;" f
hex_lerp src/hexlib.cpp /^FractionalHex hex_lerp(FractionalHex a, FractionalHex b, double t)$/;" f
hex_linedraw src/hexlib.cpp /^vector<Hex> hex_linedraw(Hex a, Hex b)$/;" f
hex_neighbor src/hexlib.cpp /^Hex hex_neighbor(Hex hex, int direction)$/;" f
hex_round src/hexlib.cpp /^Hex hex_round(FractionalHex h)$/;" f
hex_scale src/hexlib.cpp /^Hex hex_scale(Hex a, int k)$/;" f
hex_subtract src/hexlib.cpp /^Hex hex_subtract(Hex a, Hex b)$/;" f
hex_to_pixel src/hexlib.cpp /^Point hex_to_pixel(Layout layout, Hex h)$/;" f
index_buffer src/render_group.h /^ gl_index_buffer index_buffer;$/;" m struct:gl_render_group
indices src/mesh.h /^ uint* indices = nullptr;$/;" m struct:meMeshInfo
indices src/render_group.h /^ uint* indices = nullptr;$/;" m struct:gl_index_buffer
initGooey src/gooey.cpp /^initGooey(SDL_Handles &handles, v2i vp_dims \/*TODO: pass in game state*\/)$/;" f
initMatrices src/renderer.cpp /^initMatrices(projection_type p)$/;" f
initRenderer src/renderer.cpp /^initRenderer(SDL_Handles &handles, v2i vpDims)$/;" f
int32 src/hexgame.h /^typedef int32_t int32;$/;" t
int64 src/hexgame.h /^typedef int64_t int64;$/;" t
is_camera_rotate src/hexgame.h /^ bool is_camera_rotate = false;$/;" m struct:game_state
is_debug_draw src/hexgame.h /^ bool is_debug_draw;$/;" m struct:render_state
is_movebackward src/hexgame.h /^ bool is_movebackward = false;$/;" m struct:game_state
is_movedown src/hexgame.h /^ bool is_movedown = false;$/;" m struct:game_state
is_moveforward src/hexgame.h /^ bool is_moveforward = false;$/;" m struct:game_state
is_moveleft src/hexgame.h /^ bool is_moveleft = false;$/;" m struct:game_state
is_moveright src/hexgame.h /^ bool is_moveright = false;$/;" m struct:game_state
is_moveup src/hexgame.h /^ bool is_moveup = false;$/;" m struct:game_state
is_rotateCCW src/hexgame.h /^ bool is_rotateCCW = false;$/;" m struct:game_state
is_rotateCW src/hexgame.h /^ bool is_rotateCW = false;$/;" m struct:game_state
is_selecting src/hexgame.h /^ bool is_selecting = false;$/;" m struct:game_state
layout_flat src/hexlib.h /^const Orientation layout_flat = Orientation(3.0 \/ 2.0, 0.0, sqrt(3.0) \/ 2.0, sqrt(3.0), 2.0 \/ 3.0, 0.0, -1.0 \/ 3.0, sqrt(3.0) \/ 3.0, 0.0);$/;" v
layout_pointy src/hexlib.h /^const Orientation layout_pointy = Orientation(sqrt(3.0), sqrt(3.0) \/ 2.0, 0.0, 3.0 \/ 2.0, sqrt(3.0) \/ 3.0, -1.0 \/ 3.0, 0.0, 2.0 \/ 3.0, 0.5);$/;" v
left src/renderer.cpp /^ glm::vec3 left;$/;" m struct:camera file:
mapMouseToViewport src/hexgame.cpp /^mapMouseToViewport(int32 x, int32 y)$/;" f
mat src/mesh.h /^ meMatInfo* mat;$/;" m struct:meMeshInfo
meFreeMesh src/mesh.cpp /^meFreeMesh(meMeshInfo* mesh)$/;" f
meInitAssimp src/mesh.cpp /^meInitAssimp()$/;" f
meLoadFromFile src/mesh.cpp /^meLoadFromFile(const char* filename)$/;" f
meMatInfo src/mesh.h /^struct meMatInfo$/;" s
meMeshInfo src/mesh.h /^struct meMeshInfo$/;" s
meShutdownAssimp src/mesh.cpp /^meShutdownAssimp()$/;" f
mesh src/hexgame.h /^ meMeshInfo* mesh;$/;" m struct:Entity
model src/renderer.cpp /^ glm::mat4 model;$/;" m struct:gl_matrix_info file:
model_matrix_id src/render_group.h /^ GLuint model_matrix_id = 0;$/;" m struct:gl_render_group
model_transform src/mesh.h /^ glm::mat4 model_transform;$/;" m struct:meMeshInfo
moveCamera src/renderer.cpp /^moveCamera(bool up, bool left, bool down, bool right, bool forward, bool backward)$/;" f
name src/mesh.h /^ const char* name = "";$/;" m struct:meMatInfo
name src/mesh.h /^ const char* name = "";$/;" m struct:meMeshInfo
num_indices src/mesh.h /^ uint num_indices = 0;$/;" m struct:meMeshInfo
num_vertices src/mesh.h /^ uint num_vertices = 0;$/;" m struct:meMeshInfo
openglDebugCallback src/renderer.cpp /^openglDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity,$/;" f
orientation src/hexlib.h /^ const Orientation orientation;$/;" m struct:Layout
origin src/hexlib.h /^ const Point origin;$/;" m struct:Layout
pixel_to_hex src/hexlib.cpp /^FractionalHex pixel_to_hex(Layout layout, Point p)$/;" f
polygon_corners src/hexlib.cpp /^vector<Point> polygon_corners(Layout layout, Hex h)$/;" f
position src/renderer.cpp /^ glm::vec3 position;$/;" m struct:camera file:
processSDLEvents src/hexgame.cpp /^processSDLEvents()$/;" f
program_id src/render_group.h /^ GLuint program_id = 0;$/;" m struct:gl_render_group
projection src/renderer.cpp /^ glm::mat4 projection;$/;" m struct:gl_matrix_info file:
projection_matrix_id src/render_group.h /^ GLuint projection_matrix_id = 0;$/;" m struct:gl_render_group
projection_type src/renderer.cpp /^enum projection_type$/;" g file:
q src/hexlib.h /^ const double q;$/;" m struct:FractionalHex
q src/hexlib.h /^ int q;$/;" m struct:Hex
qoffset_from_cube src/hexlib.cpp /^OffsetCoord qoffset_from_cube(int offset, Hex h)$/;" f
qoffset_to_cube src/hexlib.cpp /^Hex qoffset_to_cube(int offset, OffsetCoord h)$/;" f
r src/hexlib.h /^ const double r;$/;" m struct:FractionalHex
r src/hexlib.h /^ int r;$/;" m struct:Hex
real32 src/hexgame.h /^typedef float real32;$/;" t
real64 src/hexgame.h /^typedef double real64;$/;" t
renderDebug src/renderer.cpp /^renderDebug(std::vector<Point> &vertices)$/;" f
renderFrame src/renderer.cpp /^renderFrame(std::vector<hex_info> *hexes)$/;" f
renderGooey src/gooey.cpp /^renderGooey(SDL_Handles &handles, HexDrawMode &mode, bool &is_debug,$/;" f
render_state src/hexgame.h /^struct render_state$/;" s
resetHexes src/hexgame.cpp /^resetHexes()$/;" f
rgCreateGroup src/render_group.cpp /^rgCreateGroup()$/;" f
rgDraw src/render_group.cpp /^rgDraw(gl_render_group* rg, GLenum draw_mode, glm::mat4 model_matrix,$/;" f
rgDrawIndexed src/render_group.cpp /^rgDrawIndexed(gl_render_group* rg, GLenum draw_mode, glm::mat4 model_matrix,$/;" f
rgFillColorBuffer src/render_group.cpp /^rgFillColorBuffer(GLfloat buf[], int len, std::vector<hex_info>* hexes)$/;" f
rgFree src/render_group.cpp /^rgFree(gl_render_group* rg)$/;" f
rgInitEntity src/render_group.cpp /^rgInitEntity(gl_render_group* rg, Entity* e)$/;" f
rgInitGLBufferObject src/render_group.cpp /^rgInitGLBufferObject(gl_buffer* buf_obj, int len, GLenum usage, GLenum target, GLfloat data[])$/;" f
rgInitShaderProgram src/render_group.cpp /^rgInitShaderProgram(gl_render_group* rg, const char * vertex_code, const char * frag_code,$/;" f
roffset_from_cube src/hexlib.cpp /^OffsetCoord roffset_from_cube(int offset, Hex h)$/;" f
roffset_to_cube src/hexlib.cpp /^Hex roffset_to_cube(int offset, OffsetCoord h)$/;" f
rollCamera src/renderer.cpp /^rollCamera(bool CW, bool CCW)$/;" f
rotateCamera src/renderer.cpp /^rotateCamera(int32 xrel, int32 yrel)$/;" f
row src/hexlib.cpp /^ const int row;$/;" m struct:OffsetCoord file:
s src/hexlib.h /^ const double s;$/;" m struct:FractionalHex
s src/hexlib.h /^ int s;$/;" m struct:Hex
selected src/hexgame.h /^ bool selected = false;$/;" m struct:hex_info
selected_fill_color src/hexgame.h /^ uint32 selected_fill_color;$/;" m struct:render_state
selected_hexes src/hexgame.h /^ vector<hex_info> selected_hexes;$/;" m struct:game_state
setStartHex src/hexgame.cpp /^setStartHex(hex_info *hex)$/;" f
shutdownGooey src/gooey.cpp /^shutdownGooey()$/;" f
size src/hexlib.h /^ const Point size;$/;" m struct:Layout
startDrawHelper src/hexgame.cpp /^startDrawHelper(int32 x, int32 y)$/;" f
start_angle src/hexlib.h /^ double start_angle;$/;" m struct:Orientation
start_hex src/hexgame.h /^ hex_info *start_hex;$/;" m struct:game_state
stored_color src/hexgame.h /^ uint32 stored_color = 0; \/\/ RGBA$/;" m struct:hex_info
target src/renderer.cpp /^ glm::vec3 target;$/;" m struct:camera file:
texSurfaces src/hexgame.h /^ std::vector<SDL_Surface*> texSurfaces;$/;" m struct:SDL_Handles
uint32 src/hexgame.h /^typedef uint32_t uint32;$/;" t
uint8 src/hexgame.h /^typedef uint8_t uint8;$/;" t
up src/renderer.cpp /^ glm::vec3 up;$/;" m struct:camera file:
updateHexConeFill src/hexgame.cpp /^updateHexConeFill(int32 x, int32 y)$/;" f
updateHexFill src/hexgame.cpp /^updateHexFill(int32 x, int32 y)$/;" f
updateHexLineDraw src/hexgame.cpp /^updateHexLineDraw(int32 x, int32 y)$/;" f
v2f src/hexgame.h /^ v2f(): x(0), y(0) {}$/;" f struct:v2f
v2f src/hexgame.h /^ v2f(real64 a, real64 b): x(a), y(b) {}$/;" f struct:v2f
v2f src/hexgame.h /^struct v2f$/;" s
v2i src/hexgame.h /^ v2i() : x(0), y(0) {}$/;" f struct:v2i
v2i src/hexgame.h /^ v2i(int a, int b): x(a), y(b) {}$/;" f struct:v2i
v2i src/hexgame.h /^struct v2i$/;" s
v4i src/hexgame.h /^struct v4i$/;" s
vAngle src/renderer.cpp /^ float vAngle;$/;" m struct:camera file:
vertex_array_id src/render_group.h /^ GLuint vertex_array_id = 0;$/;" m struct:gl_render_group
vertex_buffer src/render_group.h /^ gl_buffer vertex_buffer;$/;" m struct:gl_render_group
vertices src/hexgame.h /^ std::vector<Point> vertices;$/;" m struct:hex_info
vertices src/mesh.h /^ glm::vec3* vertices = nullptr;$/;" m struct:meMeshInfo
view src/renderer.cpp /^ glm::mat4 view;$/;" m struct:gl_matrix_info file:
view_matrix_id src/render_group.h /^ GLuint view_matrix_id = 0;$/;" m struct:gl_render_group
viewport_dims src/hexgame.h /^ v2i viewport_dims;$/;" m struct:render_state
window src/hexgame.h /^ SDL_Window *window;$/;" m struct:SDL_Handles
x src/hexgame.h /^ int32 x;$/;" m struct:v2i
x src/hexgame.h /^ real64 x;$/;" m struct:v2f
x src/hexlib.h /^ double x;$/;" m struct:Point
x0 src/hexgame.h /^ int32 x0;$/;" m struct:v4i
x1 src/hexgame.h /^ int32 x1;$/;" m struct:v4i
y src/hexgame.h /^ int32 y;$/;" m struct:v2i
y src/hexgame.h /^ real64 y;$/;" m struct:v2f
y src/hexlib.h /^ double y;$/;" m struct:Point
y0 src/hexgame.h /^ int32 y0;$/;" m struct:v4i
y1 src/hexgame.h /^ int32 y1;$/;" m struct:v4i
Loading…
Cancel
Save