3D
From EcereWiki
Revision as of 04:34, 2 December 2007 by 209.161.232.177 (Talk)
3D Graphics
Cameras
import "ecere"
class MyApp : GuiApplication
{
driver = "OpenGL";
};
Camera camera
{
attachedQuaternion,
position = { 0, 0, -250 },
orientation = Euler { 120, 30, 0 },
zMin = 0.01f;
fov = 53;
};
Lights
Light light
{
diffuse = white;
specular = white;
orientation = Euler { pitch = 10, yaw = 30 };
};
3D Test
class Test3D : Window
{
hasClose = true;
size = { 640, 480 };
Cube model { size = { 100, 100, 100 } };
bool OnLoadGraphics()
{
model.Create(displaySystem);
return true;
}
void OnResize(int w, int h) { camera.Setup(w, h, null); }
void OnRedraw(Surface surface)
{
surface.Clear(depthBuffer);
camera.Update();
display.SetLight(0, light);
display.SetCamera(surface, camera);
display.DrawObject(model);
display.SetCamera(surface, null);
}
}
Test3D test { };
