mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-26 19:43:30 +00:00
3 types of lights
supported number of n lights
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user