Hi,
It still doesn't work, I have uploaded a video demonstration to youtube here because I explain very badly XD
http://youtube.com/watch?v=B9KfU__tAoM
Cube is still always behind the plane T_T
Zbuffer is enabled and writable. I post the code here, even with hillplanemesh, it doesn't work at all and I need to finish this ASAP T_T
Thank you for the interest
Code:
Code: Select all
int main(void){
device = createDevice(video::EDT_DIRECT3D9,dimension2d<s32>(800,600),16,false,false,false,0);
device->setWindowCaption(L"Escena 3D");
driver = device->getVideoDriver();
smgr = device->getSceneManager();
guienv = device->getGUIEnvironment();
guienv->addStaticText(L"Bienvenido a UjiToys Basket!!", rect<int>(10,10,200,22), false);
ICameraSceneNode *irrcamera = smgr->addCameraSceneNodeMaya();
irrcamera->setPosition(vector3df(160,172,323));
irrcamera->setTarget(vector3df(160,0,50));
irrcamera->setAutomaticCulling(scene::E_CULLING_TYPE::EAC_OFF);
irrcamera->setFarValue(1000.0);
irrcamera->setNearValue(0.0);
IAnimatedMeshSceneNode *cancha = smgr->addAnimatedMeshSceneNode(smgr->addHillPlaneMesh("cancha",dimension2d<f32>(240,320),dimension2d<s32>(1,1)),0,-1,vector3df(160,-1,120),vector3df(0,-90,0));
cancha->setAutomaticCulling(scene::E_CULLING_TYPE::EAC_OFF);
cancha->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_LIGHTING,false);
cancha->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_BACK_FACE_CULLING,false);
cancha->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_ZBUFFER,true);
cancha->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_ANISOTROPIC_FILTER,true);
cancha->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_TRILINEAR_FILTER,true);
ITexture *tex = driver->getTexture("court.png");
cancha->setMaterialTexture(0,tex);
ISceneNode *spheres[4];
spheres[0]=smgr->addSphereSceneNode();
spheres[1]=smgr->addSphereSceneNode(5,16,0,-1,vector3df(320,0,0));
spheres[2]=smgr->addSphereSceneNode(5,16,0,-1,vector3df(320,0,240));
spheres[3]=smgr->addSphereSceneNode(5,16,0,-1,vector3df(0,0,240));
for(int i=0;i<4;i++)
spheres[i]->setAutomaticCulling(EAC_OFF);
ISceneNode * cubo = smgr->addCubeSceneNode(10,0,-1,vector3df(160,10,50));
cubo->setAutomaticCulling(EAC_OFF);
while(1){
if(device->run()){
driver->beginScene(true,true,SColor(255,255,100,101));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
}
device->drop();
}