• API
• FAQ
• Tools
• Archive
daily pastebin goal
40%
SHARE
TWEET

# Geometry - usage 2

Archon Jun 5th, 2011 102 Never
ENDING IN00days00hours00mins00secs

1.    CUSTOMVERTEX vertices[] = {
2.       //ground
3.       {D3DXVECTOR3(-20, 0, -20), D3DXVECTOR3(0, 1, 0), 0x008800},
4.       {D3DXVECTOR3(-20, 0,  20), D3DXVECTOR3(0, 1, 0), 0x008800}, //triangle 1
5.       {D3DXVECTOR3( 20, 0,  20), D3DXVECTOR3(0, 1, 0), 0x008800},
6.
7.       {D3DXVECTOR3( 20, 0,  20), D3DXVECTOR3(0, 1, 0), 0x008800},
8.       {D3DXVECTOR3( 20, 0, -20), D3DXVECTOR3(0, 1, 0), 0x008800}, //triangle 2
9.       {D3DXVECTOR3(-20, 0, -20), D3DXVECTOR3(0, 1, 0), 0x008800},
10.
11.       //tree
12.       {D3DXVECTOR3(-.5, 0, -.5), D3DXVECTOR3(0, 1, 0), 0x402000},
13.       {D3DXVECTOR3(0  , 5, 0  ), D3DXVECTOR3(0, 1, 0), 0x402000},
14.       {D3DXVECTOR3( .5, 0,  .5), D3DXVECTOR3(0, 1, 0), 0x402000}, //2-sided triangle 1
15.       {D3DXVECTOR3( .5, 0,  .5), D3DXVECTOR3(0, 1, 0), 0x402000},
16.       {D3DXVECTOR3(0  , 5, 0  ), D3DXVECTOR3(0, 1, 0), 0x402000},
17.       {D3DXVECTOR3(-.5, 0, -.5), D3DXVECTOR3(0, 1, 0), 0x402000},
18.
19.       {D3DXVECTOR3(-.5, 0,  .5), D3DXVECTOR3(0, 1, 0), 0x402000},
20.       {D3DXVECTOR3(0  , 5, 0  ), D3DXVECTOR3(0, 1, 0), 0x402000},
21.       {D3DXVECTOR3( .5, 0, -.5), D3DXVECTOR3(0, 1, 0), 0x402000}, //2-sided triangle 2
22.       {D3DXVECTOR3( .5, 0, -.5), D3DXVECTOR3(0, 1, 0), 0x402000},
23.       {D3DXVECTOR3(0  , 5, 0  ), D3DXVECTOR3(0, 1, 0), 0x402000},
24.       {D3DXVECTOR3(-.5, 0,  .5), D3DXVECTOR3(0, 1, 0), 0x402000},
25.    };
26.
27.    D3DMATERIAL9 groundMaterial;
28.    ZeroMemory( &groundMaterial, sizeof(groundMaterial) );
29.    groundMaterial.Diffuse.r = groundMaterial.Ambient.r = 0.0f;
30.    groundMaterial.Diffuse.g = groundMaterial.Ambient.g = 1.0f;
31.    groundMaterial.Diffuse.b = groundMaterial.Ambient.b = 0.0f;
32.    groundMaterial.Diffuse.a = groundMaterial.Ambient.a = 1.0f;
33.
34.    D3DMATERIAL9 woodMaterial;
35.    ZeroMemory( &woodMaterial, sizeof(woodMaterial) );
36.    woodMaterial.Diffuse.r = woodMaterial.Ambient.r = 1.0f;
37.    woodMaterial.Diffuse.g = woodMaterial.Ambient.g = 1.0f;
38.    woodMaterial.Diffuse.b = woodMaterial.Ambient.b = 1.0f;
39.    woodMaterial.Diffuse.a = woodMaterial.Ambient.a = 1.0f;
40.
41.    Geometry g;
43.    int
44.       tree1 = g.addShape(vertices +  6, 12, &woodMaterial),
45.       tree2 = g.addShape(vertices +  6, 12, &woodMaterial);
46.
47.    g.translate(tree1, 5, 0, 6);
48.
49.    g.scale    (tree2, .5, .5, .5);
50.    g.rotate   (tree2, AXIS_Y, 1);
51.    g.translate(tree2, 6, 0, 4);
52.
53.    g.pushBuffer();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top