Open main menu

CDOT Wiki β

Changes

GAM670/DPS905 Weekly Schedule 20121

78 bytes removed, 20:04, 20 March 2012
This Week
iGraphic* CreateIBox(float, float, float, float, float, float,
float = 1, float = 1);
iGraphic* CreateGrid(float, float, int);
iGraphic* TriangleList(const wchar_t* file);
iGraphic* TriangleList(const wchar_t*, const Colour&);
iGraphic* CreateRectangleList(float, float, float, float,
float = 1, float = 1);
iGraphic* CreateIRectangleList(float, float, float, float,
float = 1, float = 1);
iGraphic* CreateMesh(PrimitiveType, float*, int*);
iGraphic* CreateMesh(const wchar_t*);
iGraphic* CreateMeshBox(float, float, float, float, float,
float, float = 1, float = 1);
return indexedList;
}
 
// CreateGrid builds a grid-like line list of n by n lines in the x-z plane
//
iGraphic* CreateGrid(float min, float max, int n) {
VertexList<Vertex>* vertexList =
(VertexList<Vertex>*)CreateVertexList<Vertex>(LINE_LIST, 2*n+2);
 
float x = (min + max) / 2;
min -= x;
max -= x;
// bounding sphere
vertexList->setRadius(1.73205f * max);
float cur = min, inc = (max - min) / float(n - 1);
for (int i = 0; i < n; i++, cur += inc) {
// in the local x direction
vertexList->add(Vertex(Vector(min, 0, cur), Vector(0, 1, 0)));
vertexList->add(Vertex(Vector(max, 0, cur), Vector(0, 1, 0)));
// in the local z direction
vertexList->add(Vertex(Vector(cur, 0, min), Vector(0, 1, 0)));
vertexList->add(Vertex(Vector(cur, 0, max), Vector(0, 1, 0)));
}
 
return vertexList;
}
:
<syntaxhighlight lang="cpp">
bool tex_1_On; // texture switch
int tex_mode; // addressing mode
texture tex_1;
 
sampler2D tex_1_ww = sampler_state {
texture = <tex_1>;
Filter = MIN_MAG_MIP_LINEAR;
AddressU = WRAP;
AddressV = WRAP;
};
 
sampler2D tex_1_mm = sampler_state {
texture = <tex_1>;
Filter = MIN_MAG_MIP_LINEAR;
AddressU = MIRROR;
AddressV = MIRROR;
};
 
sampler2D tex_1_cc = sampler_state {
texture = <tex_1>;
Filter = MIN_MAG_MIP_LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
};
 
</syntaxhighlight>
* Texturing - Multi-Texturing
:
<syntaxhighlight lang="cpp">
bool tex_2_On; // texture switch
texture tex_2;
 
sampler2D tex_2_ww = sampler_state {
texture = <tex_2>;
Filter = MIN_MAG_MIP_LINEAR;
AddressU = WRAP;
AddressV = WRAP;
};
 
sampler2D tex_2_mm = sampler_state {
texture = <tex_2>;
Filter = MIN_MAG_MIP_LINEAR;
AddressU = MIRROR;
AddressV = MIRROR;
};
 
sampler2D tex_2_cc = sampler_state {
texture = <tex_2>;
Filter = MIN_MAG_MIP_LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
};
 
</syntaxhighlight>