mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-26 19:43:30 +00:00
code restructuring
This commit is contained in:
+22
-5
@@ -31,18 +31,34 @@ int main(){
|
||||
cam->setPosition(Vector3(0, 1, 1) * 20);
|
||||
cam->lookAt(Vector3(0, -1, -1).norm(), Vector3(0, 1, -1).norm());
|
||||
|
||||
Model *box = new Model(MODEL_PATH + "platform.vb");
|
||||
Box *box = new Box(Vector3(40, .2, 40));
|
||||
Node *boxNode = new Node();
|
||||
Material *mat = new Material();
|
||||
mat->setTexturingEnabled(true);
|
||||
mat->setLightingEnabled(true);
|
||||
mat->setNormalMapEnabled(false);
|
||||
mat->setSpecularMapEnabled(false);
|
||||
string im0[] = {TEX_PATH + "bricks.jpg"};
|
||||
Texture *diffuseTex = new Texture(im0, 1);
|
||||
mat->addDiffuseMap(diffuseTex);
|
||||
box->setMaterial(mat);
|
||||
rootNode->attachChild(box);
|
||||
boxNode->attachMesh(box);
|
||||
rootNode->attachChild(boxNode);
|
||||
|
||||
{
|
||||
Box *box = new Box(Vector3(4, .2, 4));
|
||||
Node *boxNode = new Node();
|
||||
Material *mat = new Material();
|
||||
mat->setTexturingEnabled(true);
|
||||
mat->setLightingEnabled(true);
|
||||
string im0[] = {TEX_PATH + "defaultTexture.jpg"};
|
||||
Texture *diffuseTex = new Texture(im0, 1);
|
||||
mat->addDiffuseMap(diffuseTex);
|
||||
box->setMaterial(mat);
|
||||
boxNode->attachMesh(box);
|
||||
rootNode->attachChild(boxNode);
|
||||
box->setCastShadow(true);
|
||||
boxNode->setPosition(Vector3(0, 2, 0));
|
||||
}
|
||||
/*
|
||||
{
|
||||
Model *box = new Model(MODEL_PATH + "jet00.obj");
|
||||
Material *mat = new Material();
|
||||
@@ -58,6 +74,7 @@ int main(){
|
||||
box->setCastShadow(true);
|
||||
box->setPosition(Vector3(0, 3, 0));
|
||||
}
|
||||
*/
|
||||
|
||||
Light *light = new Light(Light::DIRECTIONAL);
|
||||
light->setColor(Vector3(1, 1, 1));
|
||||
@@ -65,7 +82,7 @@ int main(){
|
||||
lightNode->addLight(light);
|
||||
rootNode->attachChild(lightNode);
|
||||
lightNode->setOrientation(Quaternion(1.57, Vector3(1, 0, 0)));
|
||||
lightNode->setPosition(Vector3(0, 5, -5));
|
||||
lightNode->setPosition(Vector3(0, 5, 0));
|
||||
|
||||
while(true)
|
||||
root->update();
|
||||
|
||||
Reference in New Issue
Block a user