08.11.2012 Views

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

d3d_light_define_direction(ind,dx,dy,dz,col) Defines a directed<br />

light. ind is the index of the light (use a small positive number). (dx,dy,dz) is<br />

the direction of the light. col is the color of the light (often you want to use<br />

c_white. This function does not turn the light on.<br />

d3d_light_define_point(ind,x,y,z,range,col) Defines a point light.<br />

ind is the index of the light use a small positive number). (x,y,z) is the<br />

position of the light. range indicates till how far the light shines. The intensity<br />

of the light will decrease over this range. col is the color of the light. This<br />

function does not turn the light on.<br />

d3d_light_enable(ind,enable) Enables (true) or disables (false) light<br />

number ind.<br />

The way an object reflects light depends on the angle between the light direction and the<br />

normal of the surface, that is, the vector pointing away from the surface. Hence, to create<br />

lighted objects you need not only provide the position of the vertices but also their normals.<br />

For this four additional functions are avaliable to define the vertices of primitives:<br />

d3d_vertex_normal(x,y,z,nx,ny,nz) Add vertex (x,y,z) to the primitive,<br />

<strong>with</strong> normal vector (nx,ny,nz).<br />

d3d_vertex_normal_color(x,y,z,nx,ny,nz,col,alpha) Add vertex<br />

(x,y,z) to the primitive, <strong>with</strong> normal vector (nx,ny,nz), and <strong>with</strong> its own color<br />

and alpha value.<br />

d3d_vertex_normal_texture(x,y,z,nx,ny,nz,xtex,ytex) Add vertex<br />

(x,y,z) to the primitive, <strong>with</strong> normal vector (nx,ny,nz), and <strong>with</strong> position<br />

(xtex,ytex) in the texture, blending <strong>with</strong> the color and alpha value set before.<br />

d3d_vertex_normal_texture_color(x,y,z,nx,ny,nz,xtex,ytex,co<br />

l,alpha) Add vertex (x,y,z) to the primitive, <strong>with</strong> normal vector (nx,ny,nz),<br />

and <strong>with</strong> position (xtex,ytex) in the texture, blending <strong>with</strong> its own color and<br />

alpha value.<br />

Note that for the basic shapes that you can draw the normals are automatically set correctly.<br />

Creating models

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!