mirror of
https://github.com/ApfelTeeSaft/vb01.git
synced 2026-08-26 19:33:45 +00:00
shader path is determined by client
This commit is contained in:
+2
-2
@@ -23,7 +23,7 @@ include_directories(${STB_HEADERS})
|
||||
include_directories(external/glm)
|
||||
include_directories(external/glm/glm)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC ${LIB_SRC})
|
||||
add_library(${PROJECT_NAME} SHARED ${LIB_SRC})
|
||||
|
||||
set(GLFW_DIR external/glfw)
|
||||
set(FREETYPE_DIR external/freetype)
|
||||
@@ -59,7 +59,7 @@ add_subdirectory(${FREETYPE_DIR})
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${FREETYPE_DIR}/include)
|
||||
target_link_directories(${PROJECT_NAME} PUBLIC ${FREETYPE_LIB_DIR})
|
||||
|
||||
set(DEPS glfw assimp freetype ${CMAKE_DL_LIBS})
|
||||
set(DEPS glfw3 assimp freetype ${CMAKE_DL_LIBS})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} ${DEPS})
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ namespace vb01{
|
||||
}
|
||||
|
||||
void Material::initShader(){
|
||||
string basePath = "../../vb01/", shaderName;
|
||||
string basePath = Root::getSingleton()->getLibPath(), shaderName;
|
||||
switch(type){
|
||||
case MATERIAL_2D:
|
||||
shaderName = "texture.";
|
||||
|
||||
@@ -38,9 +38,10 @@ namespace vb01{
|
||||
camera = new Camera();
|
||||
}
|
||||
|
||||
void Root::start(int width, int height, string name){
|
||||
void Root::start(int width, int height, string libPath, string name){
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
this->libPath = libPath;
|
||||
|
||||
initWindow(name);
|
||||
|
||||
@@ -93,7 +94,7 @@ namespace vb01{
|
||||
cout << "Not complete\n";
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
string basePath = "../../vb01/blur.";
|
||||
string basePath = libPath + "blur.";
|
||||
blurShader = new Shader(basePath + "vert", basePath + "frag");
|
||||
glGenFramebuffers(2, pingpongBuffers);
|
||||
for(int i = 0; i < 2; i++){
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace vb01{
|
||||
class Root{
|
||||
public:
|
||||
void update();
|
||||
void start(int, int, std::string);
|
||||
void start(int, int, std::string, std::string);
|
||||
inline Camera* getCamera(){return camera;}
|
||||
inline Node* getRootNode(){return rootNode;}
|
||||
inline Node* getGuiNode(){return guiNode;}
|
||||
@@ -41,6 +41,7 @@ namespace vb01{
|
||||
static Root* getSingleton();
|
||||
inline void shiftNumLights(bool increase){numLights += (increase ? 1 : -1);}
|
||||
inline int getNumLights(){return numLights;}
|
||||
inline std::string getLibPath(){return libPath;}
|
||||
private:
|
||||
int numLights = 0;
|
||||
bool bloom = false, hdr = false;
|
||||
@@ -55,6 +56,7 @@ namespace vb01{
|
||||
Shader *blurShader;
|
||||
Texture *pingPongTextures[2];
|
||||
std::vector<Mesh*> meshes;
|
||||
std::string libPath;
|
||||
|
||||
void framebuffer_size_callback(GLFWwindow*, int, int);
|
||||
Root();
|
||||
|
||||
Reference in New Issue
Block a user