23 #include <glm/gtc/matrix_transform.hpp>
33 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
36 glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f);
43 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
45 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
60 glm::mat4 VP = projection * view;
62 for (
int r =
roomList.size() - 1; r >= 0; r--) {
67 if (
roomList.at(r)->getIndex() == e.getRoom()) {
77 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
91 }
else if (room == -1) {
105 for (
int n = 0; n <
roomList.size(); n++) {
122 assert(filenameBase !=
nullptr);
127 unsigned char* image =
new unsigned char[sz * 3];
128 glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, image);
130 unsigned char* buffer =
new unsigned char[sz * 3];
131 for (
int x = 0; x < w; x++) {
132 for (
int y = 0; y < h; y++) {
133 buffer[3 * (x + (y * w))] = image[3 * (x + ((h - y - 1) * w))];
134 buffer[(3 * (x + (y * w))) + 1] = image[(3 * (x + ((h - y - 1) * w))) + 1];
135 buffer[(3 * (x + (y * w))) + 2] = image[(3 * (x + ((h - y - 1) * w))) + 2];
140 static int count = 0;
144 std::ostringstream filename;
145 filename << filenameBase <<
"-" << count++ <<
".png";
162 std::vector<glm::vec2> vertices;
163 std::vector<glm::vec2> uvs;
165 vertices.push_back(glm::vec2(x, y + h));
166 vertices.push_back(glm::vec2(x + w, y + h));
167 vertices.push_back(glm::vec2(x, y));
169 vertices.push_back(glm::vec2(x + w, y));
170 vertices.push_back(glm::vec2(x, y));
171 vertices.push_back(glm::vec2(x + w, y + h));
173 uvs.push_back(glm::vec2(0.0f, 1.0f));
174 uvs.push_back(glm::vec2(1.0f, 1.0f));
175 uvs.push_back(glm::vec2(0.0f, 0.0f));
177 uvs.push_back(glm::vec2(1.0f, 0.0f));
178 uvs.push_back(glm::vec2(0.0f, 0.0f));
179 uvs.push_back(glm::vec2(1.0f, 1.0f));
190 "Splash",
"Texture",
"Wireframe",
"Solid"
static bool boxInFrustum(BoundingBox b)
void bufferData(int elem, int size, void *data)
static glm::mat4 getViewMatrix()
IMGUI_API bool Checkbox(const char *label, bool *v)
static int initializeSplash()
static bool getShowEntitySprites()
IMGUI_API bool CollapsingHeader(const char *label, const char *str_id=NULL, bool display_frame=true, bool default_open=false)
static bool getShowRoomSprites()
static bool getUpdateViewFrustum()
static bool getShowOverlay()
Room & getRoom(unsigned long index)
static void displayFrustum(glm::mat4 MVP)
OpenGL Shader Implementation.
static void drawTexture(float x, float y, float w, float h, glm::vec4 color, unsigned int texture, TextureStorage s)
static glm::vec3 getPosition()
static bool getShowFontBox()
static void buildRoomList(int room=-2, int budget=10)
static void setRoom(int r)
unsigned long sizeEntity()
static void setShowFontBox(bool s)
static LogLevel & get(int level)
Portal & getPortal(unsigned long index)
static void setShowRoomModels(bool s)
static bool getShowRoomModels()
static void setShowBoundingBox(bool s)
int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes)
static void setShowEntityMeshes(bool s)
Entity & getEntity(unsigned long index)
unsigned long sizePortals()
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0), bool repeat_when_held=false)
static void drawGL(ShaderBuffer &vertices, ShaderBuffer &uvs, glm::vec4 color, unsigned int texture, TextureStorage store=TextureStorage::SYSTEM, unsigned int mode=GL_TRIANGLES, ShaderTexture *target=nullptr, Shader &shader=textShader)
static void setShowOverlay(bool s)
static void setUpdateViewFrustum(bool u)
void display(glm::mat4 VP)
IMGUI_API void SameLine(int column_x=0, int spacing_w=-1)
static const int modeStringCount
static bool getShowBoundingBox()
static void screenShot(const char *filenameBase)
static glm::mat4 getProjectionMatrix()
BoundingBox & getBoundingBox()
static std::vector< Room * > roomList
static bool getShowRoomGeometry()
IMGUI_API bool Combo(const char *label, int *current_item, const char **items, int items_count, int height_in_items=-1)
IMGUI_API void Text(const char *fmt,...)
IMGUI_API void Separator()
static void clearRoomList()
static void setShowRoomSprites(bool s)
static void setShowEntityModels(bool s)
static bool displayViewFrustum
static bool getShowEntityModels()
static void setShowRoomGeometry(bool s)
static void setShowEntitySprites(bool s)
static glm::i32vec2 getSize()
static const char * modeStrings[modeStringCount]
static bool getShowBoundingBox()
static void setShowBoundingBox(bool s)
static bool getShowEntityMeshes()