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
+9 -7
View File
@@ -6,6 +6,8 @@
#include "animationController.h"
#include "animationChannel.h"
#include "box.h"
#include <ft2build.h>
#include FT_FREETYPE_H
using namespace std;
using namespace vb01;
@@ -38,12 +40,12 @@ int main(){
cam->lookAt(Vector3(1, 0, 0).norm(), Vector3(0, 1, 0).norm());
Model *model = new Model(MODEL_PATH + "kek.vb");
Material *mat = new Material();
mat->setLightingEnabled(false);
mat->setTexturingEnabled(true);
Material *mat = new Material(PATH + "texture");
mat->addVariable("lightingEnabled", false);
mat->addVariable("texturingEnabled", true);
string images[] = {TEX_PATH + "defaultTexture.jpg"};
Texture *texture = new Texture(images, 1);
mat->addDiffuseMap(texture);
mat->addVariable("textures[0]", texture);
model->setMaterial(mat);
rootNode->attachChild(model);
@@ -67,9 +69,9 @@ int main(){
* Creates a box attached to the bone controlling the shape keys.
*/
Box *box = new Box(Vector3(1, 1, 1) * .25);
Material *boxMat = new Material();
boxMat->setTexturingEnabled(false);
boxMat->setDiffuseColor(Vector4(1, 0, 0, 1));
Material *boxMat = new Material(PATH + "texture");
boxMat->addVariable("texturingEnabled", false);
boxMat->addVariable("diffuseColor", Vector4(1, 0, 0, 1));
box->setMaterial(boxMat);
skeleton->getBone("bone")->attachMesh(box);