Skip to content

Commit

Permalink
Stopped using const reference in constructors which copy (compiler ca…
Browse files Browse the repository at this point in the history
…n optimise if its passed by value). Also changed icon of topaz_test
  • Loading branch information
harrand committed Apr 16, 2017
1 parent fcf3773 commit c4094e3
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 19 deletions.
2 changes: 1 addition & 1 deletion qcpl_dll.bat
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ cd "%scriptdir%\res\dep"
xcopy /s "%cd%" %lnkdir%
echo Dependencies copied...
cd %lnkdir%
g++ -o topaz_test_dependent.exe test.o "%scriptdir%\res\exe\topaz_test.res" -L. -L%libdir% -ltopaz -lmdl
g++ -O3 -o topaz_test_dependent.exe test.o "%scriptdir%\res\exe\topaz_test.res" -L. -L%libdir% -ltopaz -lmdl
move test.o "%cpldir%"
move libtopazdll.a "%cpldir%"

Expand Down
4 changes: 2 additions & 2 deletions res/exe/topaz_test.rc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ BEGIN
BLOCK "080904E4"
BEGIN
VALUE "CompanyName", "Harrand"
VALUE "FileDescription", "Topaz Game Engine Test Build"
VALUE "FileDescription", "Topaz Test Executable"
VALUE "FileVersion", "1.0"
VALUE "InternalName", "topaz_test"
VALUE "LegalCopyright", "Harrand"
VALUE "OriginalFilename", "topaz-test.exe"
VALUE "OriginalFilename", "topaz-test_dependent.exe"
VALUE "ProductName", "TOPAZ ENGINE (TEST)"
VALUE "ProductVersion", "1.0"
END
Expand Down
Binary file modified res/exe/topaz_test.res
Binary file not shown.
Binary file modified res/icon/topaz_test.ico
Binary file not shown.
Binary file added res/icon/topaz_test_old.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions res/runtime/resources.data
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@ skybox.path: ../../../res/runtime/models/skybox.obj
skybox.name: Cube no UVs or normals
house.path: ../../../res/runtime/models/house.obj
house.name: House Model with uniform UVs
speed: 350
played: 238818
speed: 200
played: 244455
26 changes: 25 additions & 1 deletion res/runtime/worlds/random.world
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,36 @@ object6.parallaxmap: birch_parallaxmap
object6.pos: [-50,35,0]
object6.rot: [0,0,0]
object6.scale: [9,9,9]
object7.mesh: cube
object7.texture: bricks
object7.normalmap: bricks_normalmap
object7.parallaxmap: bricks_parallaxmap
object7.pos: [-30,0,-20]
object7.rot: [0,0,0]
object7.scale: [2,2,2]
object8.mesh: cube
object8.texture: birch
object8.normalmap: birch_normalmap
object8.parallaxmap: birch_parallaxmap
object8.pos: [-30,0,-10]
object8.rot: [0,0,0]
object8.scale: [2,2,2]
object9.mesh: cube
object9.texture: undefined
object9.normalmap: default_normalmap
object9.parallaxmap: default_parallaxmap
object9.pos: [-20,0,-30]
object9.rot: [0,0,0]
object9.scale: [2,2,2]
objects: %[
- object0
- object1
- object2
- object3
- object4
- object5
- object6]%
- object6
- object7
- object8
- object9]%
entityobjects: %[
1 change: 0 additions & 1 deletion src/datatranslation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class DataTranslation
DataTranslation(std::string datafilename);
DataTranslation(const DataTranslation& copy) = default;
DataTranslation(DataTranslation&& move) = default;

DataTranslation& operator=(const DataTranslation& rhs) = default;

std::string getResourceLink(const std::string& resourceName) const;
Expand Down
5 changes: 2 additions & 3 deletions src/mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ class Vertex
class Mesh
{
public:
Mesh(std::string filename = "./res/models/undefined.obj");
Mesh(Vertex* vertices, unsigned int numVertices, unsigned int* indices, unsigned int numIndices);
Mesh(const Mesh& copy) = delete;
Mesh(Mesh&& move) = delete;
~Mesh();
Mesh& operator=(const Mesh& rhs) = delete;
// Don't want any of these because I only ever want one instance of mesh per model. Allowing us to copy and move instances around will be inefficient and pointless.

Mesh(std::string filename = "./res/models/undefined.obj");
~Mesh();
IndexedModel getIndexedModel() const;
std::string getFileName() const;
void render() const;
Expand Down
30 changes: 25 additions & 5 deletions src/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ void FrameBuffer::setRenderTarget() const

void FrameBuffer::bind(unsigned int id) const
{
assert(id >= 0 && id <= 31);
if(id > 31 || id < 0)
{
LogUtility::error("FrameBuffer bind ID " + CastUtility::toString<unsigned int>(id) + " is invalid. Must be between 1-31");
return;
}
// this sets which texture we want to bind (id can be from 0 to 31)
// GLTEXTURE0 is actually a number, so we can add the id instead of a massive switch statement
glActiveTexture(GL_TEXTURE0 + id);
Expand Down Expand Up @@ -110,7 +114,11 @@ Texture::~Texture()

void Texture::bind(GLuint shaderProgram, unsigned int id)
{
assert(id >= 0 && id <= 31);
if(id > 31 || id < 0)
{
LogUtility::error("FrameBuffer bind ID " + CastUtility::toString<unsigned int>(id) + " is invalid. Must be between 1-31");
return;
}
// this sets which texture we want to bind (id can be from 0 to 31)
// GLTEXTURE0 is actually a number, so we can add the id instead of a massive switch statement
this->textureID = glGetUniformLocation(shaderProgram, "textureSampler");
Expand Down Expand Up @@ -139,7 +147,11 @@ NormalMap::NormalMap(std::string filename): Texture(filename){}

void NormalMap::bind(GLuint shaderProgram, unsigned int id)
{
assert(id >= 0 && id <= 31);
if(id > 31 || id < 0)
{
LogUtility::error("FrameBuffer bind ID " + CastUtility::toString<unsigned int>(id) + " is invalid. Must be between 1-31");
return;
}
// this sets which texture we want to bind (id can be from 0 to 31)
// GLTEXTURE0 is actually a number, so we can add the id instead of a massive switch statement
this->textureID = glGetUniformLocation(shaderProgram, "normalMapSampler");
Expand All @@ -163,7 +175,11 @@ ParallaxMap::ParallaxMap(std::string filename): Texture(filename){}

void ParallaxMap::bind(GLuint shaderProgram, unsigned int id)
{
assert(id >= 0 && id <= 31);
if(id > 31 || id < 0)
{
LogUtility::error("FrameBuffer bind ID " + CastUtility::toString<unsigned int>(id) + " is invalid. Must be between 1-31");
return;
}
// this sets which texture we want to bind (id can be from 0 to 31)
// GLTEXTURE0 is actually a number, so we can add the id instead of a massive switch statement
this->textureID = glGetUniformLocation(shaderProgram, "parallaxMapSampler");
Expand Down Expand Up @@ -222,7 +238,11 @@ CubeMap::~CubeMap()

void CubeMap::bind(GLuint shaderProgram, unsigned int id)
{
assert(id >= 0 && id <= 31);
if(id > 31 || id < 0)
{
LogUtility::error("FrameBuffer bind ID " + CastUtility::toString<unsigned int>(id) + " is invalid. Must be between 1-31");
return;
}
// this sets which texture we want to bind (id can be from 0 to 31)
// GLTEXTURE0 is actually a number, so we can add the id instead of a massive switch statement
this->textureID = glGetUniformLocation(shaderProgram, "cubeMapSampler");
Expand Down
1 change: 0 additions & 1 deletion src/texture.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#ifndef TEXTURE_HPP
#define TEXTURE_HPP
#include <cassert>
#include <memory>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
Expand Down
2 changes: 0 additions & 2 deletions src/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include "vector.hpp"
Expand Down
1 change: 0 additions & 1 deletion src/window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#endif
#include <string>
#include <unordered_map>
#include <functional>
#include "SDL_mixer.h"
#include "SDL.h"
#include "glew.h"
Expand Down

0 comments on commit c4094e3

Please sign in to comment.