3 types of lights

supported number of n lights
This commit is contained in:
devZoGok
2021-10-18 19:03:19 +03:00
parent 0083f9e5b8
commit aebc069053
16 changed files with 350 additions and 23 deletions
+13 -1
View File
@@ -4,12 +4,23 @@
#include<glfw3.h>
#include<glm.hpp>
#include<ext.hpp>
#include<Importer.hpp>
#include<postprocess.h>
#include<iostream>
#include<cstdlib>
using namespace std;
using namespace glm;
using namespace Assimp;
namespace vb01{
Mesh::Mesh(string path){
Importer importer;
const aiScene *scene=importer.ReadFile(path,aiProcess_Triangulate | aiProcess_FlipUVs | aiProcess_GenNormals);
if(!scene||scene->mFlags&AI_SCENE_FLAGS_INCOMPLETE||!scene->mRootNode){
cout<<"Failed to load model\n";
exit(-1);
}
construct();
}
@@ -48,12 +59,13 @@ namespace vb01{
Vector3 dir=cam->getDirection(),up=cam->getUp(),camPos=cam->getPosition();
mat4 model=translate(mat4(1.),vec3(pos.x,pos.y,pos.z));
model=rotate(model,45.f,vec3(1,0,0));
model=rotate(model,38.f,vec3(1,0,0));
mat4 view=lookAt(vec3(camPos.x,camPos.y,camPos.z),vec3(camPos.x+dir.x,camPos.y+dir.y,camPos.z+dir.z),vec3(up.x,up.y,up.z));
mat4 proj=perspective(radians(fov),width/height,nearPlane,farPlane);
//proj=ortho(0.f,800.f,0.f,-600.f,nearPlane,farPlane);
material->update();
material->getShader()->setVec3(vec3(camPos.x,camPos.y,camPos.z),"camPos");
material->getShader()->setMat4(model,"model");
material->getShader()->setMat4(view,"view");
material->getShader()->setMat4(proj,"proj");