materials are now created by specifying shaders

shader uniforms are added to materials
This commit is contained in:
devZoGok
2021-11-10 20:23:15 +02:00
parent 34e7a74bba
commit ec8dd7ac1e
17 changed files with 321 additions and 213 deletions
+10 -8
View File
@@ -7,6 +7,8 @@
#include "animation.h"
#include "animationController.h"
#include "animationChannel.h"
#include <ft2build.h>
#include FT_FREETYPE_H
using namespace std;
using namespace vb01;
@@ -40,23 +42,23 @@ int main(){
Box *box = new Box(Vector3(40, .2, 40));
Node *boxNode = new Node();
Material *boxMat = new Material();
boxMat->setTexturingEnabled(true);
boxMat->setLightingEnabled(true);
Material *boxMat = new Material(PATH + "texture");
boxMat->addVariable("texturingEnabled", true);
boxMat->addVariable("lightingEnabled", true);
string im0[] = {TEX_PATH + "bricks.jpg"};
Texture *boxTex = new Texture(im0, 1);
boxMat->addDiffuseMap(boxTex);
boxMat->addVariable("textures[0]", boxTex);
box->setMaterial(boxMat);
boxNode->attachMesh(box);
rootNode->attachChild(boxNode);
Model *jet = new Model(MODEL_PATH + "jet00.obj");
Material *jetMat = new Material();
jetMat->setTexturingEnabled(true);
jetMat->setLightingEnabled(true);
Material *jetMat = new Material(PATH + "texture");
jetMat->addVariable("texturingEnabled", true);
jetMat->addVariable("lightingEnabled", true);
string im1[] = {TEX_PATH + "defaultTexture.jpg"};
Texture *jetTex = new Texture(im1, 1);
jetMat->addDiffuseMap(jetTex);
jetMat->addVariable("textures[0]", jetTex);
jet->setMaterial(jetMat);
rootNode->attachChild(jet);
jet->setCastShadow(true);