Replace SOIL ;)
This commit is contained in:
@@ -50,8 +50,8 @@ CPMAddPackage(
|
||||
)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME SOIL
|
||||
URL https://git.redacted.cc/Redacted/SOIL/archive/v1.0.zip
|
||||
NAME ReTexture
|
||||
URL https://git.redacted.cc/Redacted/ReTexture/archive/vA0.1.zip
|
||||
)
|
||||
|
||||
CPMAddPackage(
|
||||
@@ -79,7 +79,7 @@ include_directories(
|
||||
${ReWindow_SOURCE_DIR}/include
|
||||
${ReHardwareID_SOURCE_DIR}/include
|
||||
${J3ML_SOURCE_DIR}/include
|
||||
${SOIL_SOURCE_DIR}/include
|
||||
${ReTexture_SOURCE_DIR}/include
|
||||
${glad_SOURCE_DIR}/include
|
||||
${UUID_SOURCE_DIR}/include
|
||||
${archive_SOURCE_DIR}/include
|
||||
@@ -95,7 +95,7 @@ set_target_properties(Re3D PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
target_link_libraries(Re3D PUBLIC Event ReWindowLibrary ReHardwareID J3ML soil GL glad Collage JGL archive)
|
||||
target_link_libraries(Re3D PUBLIC Event ReWindowLibrary ReHardwareID ReTexture J3ML GL glad Collage JGL archive)
|
||||
|
||||
include(src/demo/RuntimeTest/CMakeLists.txt)
|
||||
|
||||
|
@@ -10,8 +10,8 @@
|
||||
using J3ML::LinearAlgebra::Matrix4x4;
|
||||
using J3ML::LinearAlgebra::Vector3;
|
||||
|
||||
|
||||
class Entity { ///Base entity type.
|
||||
///Base entity type.
|
||||
class Entity {
|
||||
private:
|
||||
///Loads the texture for the entity.
|
||||
virtual void loadTexture();
|
||||
|
@@ -78,7 +78,7 @@ OBB Collision::genMinimallyEnclosingOBB(const VertexArray* vA, const Vector3& ro
|
||||
return {centroid, radii, axis0, axis1, axis2};
|
||||
}
|
||||
|
||||
//TODO
|
||||
//TODO the OBB is fucked in some way.
|
||||
VertexArray Collision::getDrawable(const Shape& collider) {
|
||||
|
||||
if (const auto* s = dynamic_cast<const AABB*>(&collider)) {
|
||||
|
@@ -55,6 +55,7 @@ void outputErrorCode() {
|
||||
break;
|
||||
case ENGINE_ERROR_CODE::TEXTURE_ERASED_WHILE_IN_USE:
|
||||
std::cerr << "TEXTURE ERASED WHILE IN USE" << std::endl;
|
||||
break;
|
||||
case ENGINE_ERROR_CODE::VERTEX_ARRAY_ERASED_WHILE_IN_USE:
|
||||
std::cerr << "VERTEX ARRAY ERASED WHILE IN USE" << std::endl;
|
||||
break;
|
||||
@@ -123,9 +124,11 @@ void Engine::initGL() const {
|
||||
exit(0);
|
||||
|
||||
//TODO JGL rendering pass.
|
||||
/*
|
||||
glDisable(GL_LIGHTING);
|
||||
JGL::J3D::DrawString3D(JGL::Colors::White, std::to_string((int) framerate()), {0.5f, 0, 0.5f}, 0.0125f);
|
||||
JGL::J3D::DrawString3D(JGL::Colors::White, std::to_string((int) framerate()), {0.5f, 0, 0.5f}, 0.0125f);
|
||||
glEnable(GL_LIGHTING);
|
||||
*/
|
||||
}
|
||||
|
||||
void Engine::postRender()
|
||||
@@ -272,6 +275,5 @@ void Engine::takeScreenshot() {
|
||||
file.write((char*)"\0", 1);
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
}
|
@@ -1,9 +1,21 @@
|
||||
#include <types/texture.h>
|
||||
#include <SOIL/SOIL.h>
|
||||
#include <ReTexture/rTexture.h>
|
||||
#include <engine/engine.h>
|
||||
|
||||
void Texture::load(Entity* entity, const std::string& file, bool storeOnTextureList) {
|
||||
id = SOIL_load_OGL_texture(file.c_str(), SOIL_LOAD_RGBA, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);
|
||||
auto* texture = new RTexture(file, {RTextureFlag::INVERT_Y});
|
||||
glGenTextures(1, &id);
|
||||
glBindTexture(GL_TEXTURE_2D, id);
|
||||
if (texture->format == RTextureFormat::RGBA)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->width, texture->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture->pixelData.data());
|
||||
if (texture->format == RTextureFormat::RGB)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texture->width, texture->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture->pixelData.data());
|
||||
delete texture;
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
//If we can't load the missing texture
|
||||
if (file == "assets/textures/missing.png" && id == 0)
|
||||
|
Reference in New Issue
Block a user