Skip to content

Commit

Permalink
Fixed misc Windows warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Bhavye Mathur <[email protected]>
  • Loading branch information
BhavyeMathur committed Jan 3, 2024
1 parent 9316e1c commit 0d74df2
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 63 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ set(CMAKE_CXX_STANDARD 17)

find_package(OpenGL REQUIRED)

# needed to silence errors in IDE
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
if(POLICY CMP0148)
cmake_policy(SET CMP0148 OLD)
endif()
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)

include_directories(${PYTHON_INCLUDE_DIRS})

Expand All @@ -43,7 +42,7 @@ if (WIN32)
set(WINDOWS_SOURCES vendor/glad/glad.c)

if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "-wd4068")
set(CMAKE_CXX_FLAGS "-wd4068 /EHsc")

if (MSVC_TOOLSET_VERSION EQUAL 110)
set(GOOPYLIB_PLATFORM_NAME vc2012)
Expand Down
1 change: 1 addition & 0 deletions src/goopylib/core/BufferLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ namespace gp {
case ShaderDataType::Bool:
return 1;
case ShaderDataType::None:
default:
GP_CORE_ERROR("Unrecognised Shader Type");
return 0;
}
Expand Down
74 changes: 37 additions & 37 deletions src/goopylib/shader/Shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,95 +14,95 @@ namespace gp {
friend class Renderer;

public:
Shader(const char *vertexShaderSource, const char *fragmentShaderSource);
GPAPI Shader(const char *vertexShaderSource, const char *fragmentShaderSource);

GPAPI Shader (const Shader&) = delete;

~Shader();

void setUniformBlock(const Ref<UniformBuffer> &uniform, const char *name, uint32_t binding) const;
GPAPI void setUniformBlock(const Ref<UniformBuffer> &uniform, const char *name, uint32_t binding) const;

template<typename... T>
void set(const char *name, T &&... args) {
GPAPI void set(const char *name, T &&... args) {
bind();
_setUniform(_getLocation(name), std::forward < T > (args)...);
}

static Ref<Shader> load(const char *vertexShaderPath, const char *fragmentShaderPath) {
GPAPI static Ref<Shader> load(const char *vertexShaderPath, const char *fragmentShaderPath) {
return Ref<Shader>(new Shader(readFile(vertexShaderPath).c_str(),
readFile(fragmentShaderPath).c_str()));
}

private:
void bind() const;
GPAPI void bind() const;

static void unbind();
GPAPI static void unbind();

private:
uint32_t m_RendererID = 0;

std::unordered_map<std::string, int32_t> m_Uniforms;

int32_t _getLocation(const char *name);
[[nodiscard]] GPAPI int32_t _getLocation(const char *name);

void _setUniform(int32_t location, float value) const;
GPAPI void _setUniform(int32_t location, float value) const;

void _setUniform(int32_t location, float v1, float v2) const;
GPAPI void _setUniform(int32_t location, float v1, float v2) const;

void _setUniform(int32_t location, float v1, float v2, float v3) const;
GPAPI void _setUniform(int32_t location, float v1, float v2, float v3) const;

void _setUniform(int32_t location, float v1, float v2, float v3, float v4) const;
GPAPI void _setUniform(int32_t location, float v1, float v2, float v3, float v4) const;

void _setUniform(int32_t location, double value) const;
GPAPI void _setUniform(int32_t location, double value) const;

void _setUniform(int32_t location, double v1, double v2) const;
GPAPI void _setUniform(int32_t location, double v1, double v2) const;

void _setUniform(int32_t location, double v1, double v2, double v3) const;
GPAPI void _setUniform(int32_t location, double v1, double v2, double v3) const;

void _setUniform(int32_t location, double v1, double v2, double v3, double v4) const;
GPAPI void _setUniform(int32_t location, double v1, double v2, double v3, double v4) const;

void _setUniform(int32_t location, int32_t value) const;
GPAPI void _setUniform(int32_t location, int32_t value) const;

void _setUniform(int32_t location, int32_t v1, int32_t v2) const;
GPAPI void _setUniform(int32_t location, int32_t v1, int32_t v2) const;

void _setUniform(int32_t location, int32_t v1, int32_t v2, int32_t v3) const;
GPAPI void _setUniform(int32_t location, int32_t v1, int32_t v2, int32_t v3) const;

void _setUniform(int32_t location, int32_t v1, int32_t v2, int32_t v3, int32_t v4) const;
GPAPI void _setUniform(int32_t location, int32_t v1, int32_t v2, int32_t v3, int32_t v4) const;

void _setUniform(int32_t location, uint32_t value) const;
GPAPI void _setUniform(int32_t location, uint32_t value) const;

void _setUniform(int32_t location, uint32_t v1, uint32_t v2) const;
GPAPI void _setUniform(int32_t location, uint32_t v1, uint32_t v2) const;

void _setUniform(int32_t location, uint32_t v1, uint32_t v2, uint32_t v3) const;
GPAPI void _setUniform(int32_t location, uint32_t v1, uint32_t v2, uint32_t v3) const;

void _setUniform(int32_t location, uint32_t v1, uint32_t v2, uint32_t v3, uint32_t v4) const;
GPAPI void _setUniform(int32_t location, uint32_t v1, uint32_t v2, uint32_t v3, uint32_t v4) const;

void _setUniform(int32_t location, const glm::mat2 &value, bool transpose = false) const;
GPAPI void _setUniform(int32_t location, const glm::mat2 &value, bool transpose = false) const;

void _setUniform(int32_t location, const glm::mat3 &value, bool transpose = false) const;
GPAPI void _setUniform(int32_t location, const glm::mat3 &value, bool transpose = false) const;

void _setUniform(int32_t location, const glm::mat4 &value, bool transpose = false) const;
GPAPI void _setUniform(int32_t location, const glm::mat4 &value, bool transpose = false) const;

void _setUniform(int32_t location, const glm::mat2x3 &value, bool transpose = false) const;
GPAPI void _setUniform(int32_t location, const glm::mat2x3 &value, bool transpose = false) const;

void _setUniform(int32_t location, const glm::mat3x2 &value, bool transpose = false) const;
GPAPI void _setUniform(int32_t location, const glm::mat3x2 &value, bool transpose = false) const;

void _setUniform(int32_t location, const glm::mat2x4 &value, bool transpose = false) const;
GPAPI void _setUniform(int32_t location, const glm::mat2x4 &value, bool transpose = false) const;

void _setUniform(int32_t location, const glm::mat4x2 &value, bool transpose = false) const;
GPAPI void _setUniform(int32_t location, const glm::mat4x2 &value, bool transpose = false) const;

void _setUniform(int32_t location, const glm::mat3x4 &value, bool transpose = false) const;
GPAPI void _setUniform(int32_t location, const glm::mat3x4 &value, bool transpose = false) const;

void _setUniform(int32_t location, const glm::mat4x3 &value, bool transpose = false) const;
GPAPI void _setUniform(int32_t location, const glm::mat4x3 &value, bool transpose = false) const;

void _setUniform(int32_t location, int32_t count, float *value) const;
GPAPI void _setUniform(int32_t location, int32_t count, float *value) const;

void _setUniform(int32_t location, int32_t count, double *value) const;
GPAPI void _setUniform(int32_t location, int32_t count, double *value) const;

void _setUniform(int32_t location, int32_t count, uint32_t *value) const;
GPAPI void _setUniform(int32_t location, int32_t count, uint32_t *value) const;

void _setUniform(int32_t location, int32_t count, int32_t *value) const;
GPAPI void _setUniform(int32_t location, int32_t count, int32_t *value) const;

int32_t _getUniform(const char *name) const;
[[nodiscard]] GPAPI int32_t _getUniform(const char *name) const;
};
}
14 changes: 7 additions & 7 deletions src/goopylib/texture/Bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ namespace gp {

GPAPI ~Bitmap();

GPAPI uint32_t getWidth() const;
[[nodiscard]] GPAPI uint32_t getWidth() const;

GPAPI uint32_t getHeight() const;
[[nodiscard]] GPAPI uint32_t getHeight() const;

GPAPI uint32_t getChannels() const;
[[nodiscard]] GPAPI uint32_t getChannels() const;

GPAPI uint8_t* getData() const;
[[nodiscard]] GPAPI uint8_t* getData() const;

GPAPI void saveBitmap(const std::string& filepath) const;

Expand All @@ -31,10 +31,10 @@ namespace gp {
bool m_IsImage = false;
uint8_t *m_Data = nullptr;

Bitmap() = default;
GPAPI Bitmap() = default;

Bitmap(uint32_t width, uint32_t height, uint32_t channels, uint8_t *data);
GPAPI Bitmap(uint32_t width, uint32_t height, uint32_t channels, uint8_t *data);

Bitmap(const char* filepath);
GPAPI Bitmap(const char* filepath);
};
}
16 changes: 8 additions & 8 deletions src/goopylib/texture/Texture2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ namespace gp {
friend class TextureAtlas;

public:
~Texture2D();
GPAPI Texture2D (const Texture2D&) = delete;

GPAPI ~Texture2D();

GPAPI void bind(uint32_t slot) const;

Expand All @@ -28,7 +30,7 @@ namespace gp {

GPAPI static void init();

GPAPI static int32_t getTextureSlots();
[[nodiscard]] GPAPI static int32_t getTextureSlots();

private:
uint32_t m_Width = 0;
Expand All @@ -39,14 +41,12 @@ namespace gp {

static int32_t s_TextureSlots;

Texture2D(uint32_t width, uint32_t height, uint32_t channels, uint8_t *data = nullptr);
GPAPI Texture2D(uint32_t width, uint32_t height, uint32_t channels, uint8_t *data = nullptr);

Texture2D(const Bitmap& bitmap);

GPAPI Texture2D (const Texture2D&) = delete;
GPAPI Texture2D(const Bitmap& bitmap);

uint32_t _getDataFormat() const;
[[nodiscard]] GPAPI uint32_t _getDataFormat() const;

int32_t _getInternalFormat() const;
[[nodiscard]] GPAPI int32_t _getInternalFormat() const;
};
}
8 changes: 4 additions & 4 deletions src/goopylib/texture/TextureAtlas.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ namespace gp {
bool allowRotation = true,
const packing::SortingFunction &sorting = packing::sortByShortSide(true));

GPAPI std::vector<Ref<Texture2D>> createTextureAtlas() const;
[[nodiscard]] GPAPI std::vector<Ref<Texture2D>> createTextureAtlas() const;

GPAPI static void init();

GPAPI static int32_t getWidth();
[[nodiscard]] GPAPI static int32_t getWidth();

GPAPI static int32_t getHeight();
[[nodiscard]] GPAPI static int32_t getHeight();

private:
packing::shelf::ShelfPackingAlgorithm *m_PackingAlgorithm;
Expand All @@ -50,6 +50,6 @@ namespace gp {
static int32_t s_Width;
static int32_t s_Height;

TextureAtlas(packing::shelf::ShelfPackingAlgorithm *packingAlgorithm = nullptr);
GPAPI TextureAtlas(packing::shelf::ShelfPackingAlgorithm *packingAlgorithm = nullptr);
};
}
6 changes: 3 additions & 3 deletions vendor/glad/glad.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#define APIENTRY __stdcall
#endif

#ifndef APIENTRY
#define APIENTRY
#endif
//#ifndef APIENTRY
//#define APIENTRY
//#endif
#ifndef APIENTRYP
#define APIENTRYP APIENTRY *
#endif
Expand Down

0 comments on commit 0d74df2

Please sign in to comment.