Hi, once more.
I am adding new pieces of the program, and compiling.
The code worked well, until I added the piece marked with //+++++++++++++++++++++++++++++++++++++++++++
After compiling, I could not see the mesh. (before that, yes).
I reinstalled esenthel, add LightDir, change the file,...
Had created a small terrain (mesh), and wanted to apply a mirror effect to join the two meshes, and create a continuous repetition.
I changed the mesh file, by other mesh included in the data folder of esenthel.
Code:
/******************************************************************************/
#include "stdafx.h" // include precompiled header
#include "resource.h" // include resources (icon)
/******************************************************************************/
Flt incrementoX(0), incrementoZ(0), inc(0.2);
Mesh meshMalla1, meshMalla2;
Matrix matrixMalla1, matrixMalla2;
void InitPre() // init before engine inits
{
// here you will have to setup initial engine settings
// like application name, its options, screen resolution...
App.name("Demo"); // application name
App.icon=(Char*)IDI_ICON1; // setup icon
IOPath("../data/");
PakAdd("../data/engine.pak"); // load engine data
D.full(true).ambPower(1).hpRt(true).hwDepthBuffer(true);
}
/******************************************************************************/
Bool Init() // init after engine inits
{
// here when engine will be ready you can load your game data
// return false when error occured
meshMalla1.load("obj/item/misc/barrel/0.mesh");
matrixMalla1.pos.set(0,0,0);
matrixMalla1.rotateX(1.5f);
matrixMalla1.scale(Vec(3.5,2,3.2));
// +++++++++++++++++++++++++++++++++++++
meshMalla2.load("obj/item/misc/barrel/0.mesh");
meshMalla2.mirrorY();
matrixMalla2.pos.set(0,0,2);
matrixMalla2.rotateX(1.5f);
matrixMalla2.scale(Vec(3.5,2,3.2));
// +++++++++++++++++++++++++++++++++++++
//Water.set(*Gfxs("gfx/water/0.gfx"),*Gfxs("gfx/water/0.n.gfx"),Gfxs("gfx/fx/reflection.gfx"));
//Water.plane(Water.plane()+ Vec(0,-5,0));
//Water.wave_scale=0.05f;
Sun &sun=Suns.New();
sun.set(*Gfxs("gfx/sky/sun.gfx")); // set image
sun.pos=!Vec(1,1,1); // set custom position
Sky.set();
Cam.pitch=-1.57f; Cam.matrix.setPos(Vec(0,3,0));
Cam.setAngle(Cam.matrix.pos,Cam.yaw,Cam.pitch,Cam.roll).updateVelocities().set();
return true;
}
/******************************************************************************/
void Shut() // shut at exit
{
// this is called when the engine is about to exit
}
/******************************************************************************/
Bool Main() // main updating
{
// here you have to process each frame update
if(Kb.bp(KB_ESC))return false; // exit if escape on the keyboard pressed
if ((Kb.br(KB_UP))) {incrementoZ+=inc;}
if ((Kb.br(KB_DOWN))) {incrementoZ-=inc;}
if (Kb.br(KB_LEFT)) {incrementoX-=inc;}
if (Kb.br(KB_RIGHT)) {incrementoX+=inc;}
if (Kb.br(KB_NPSUB)) {inc-=0.01f;}
if (Kb.br(KB_NPADD)) {inc+=0.01f;}
//matrixMalla2.pos.set(matrixMalla2.pos.x+incrementoX,matrixMalla2.pos.y,matrixMalla2.pos.z+incrementoZ);
//incrementoX=incrementoZ=0;
//Water.update(Vec2(0.2,0.2));
return true; // continue
}
/******************************************************************************/
void Render()
{
switch(Renderer())
{
case RM_SOLID : case RM_SOLID_M : {
meshMalla1.draw(matrixMalla1);
meshMalla2.draw(matrixMalla2);
break;
}
}
}
void Draw() // main drawing
{
// here you have to tell engine what to draw on the screen
Renderer(Render);
}
/******************************************************************************/
Regards