mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-26 19:43:30 +00:00
materials are now created by specifying shaders
shader uniforms are added to materials
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user