|
@@ -10,536 +10,502 @@
|
|
|
#include <GraphicsApi.h>
|
|
|
#include "Login.h"
|
|
|
|
|
|
-void createDefaultCube( Bildschirm* zScreen )
|
|
|
+void createDefaultCube(Bildschirm* zScreen)
|
|
|
{
|
|
|
- Model3DData* data = zScreen->zGraphicsApi()->createModel( "cube" );
|
|
|
- data->setAmbientFactor( 0.8f );
|
|
|
- data->setDiffusFactor( 0.1f );
|
|
|
- data->setSpecularFactor( 0.1f );
|
|
|
- float size = 1;
|
|
|
- float left, right, top, bottom;
|
|
|
- // Calculate the screen coordinates of the left side of the bitmap.
|
|
|
- left = (float)((size / 2.0) * -1);
|
|
|
- // Calculate the screen coordinates of the right side of the bitmap.
|
|
|
- right = left + (float)size;
|
|
|
- // Calculate the screen coordinates of the top of the bitmap.
|
|
|
- top = (float)(size / 2.0);
|
|
|
- // Calculate the screen coordinates of the bottom of the bitmap.
|
|
|
- bottom = top - (float)size;
|
|
|
- float front = -size / 2;
|
|
|
- float back = front + size;
|
|
|
+ Model3DData* data = zScreen->zGraphicsApi()->createModel("cube");
|
|
|
+ data->setAmbientFactor(0.8f);
|
|
|
+ data->setDiffusFactor(0.1f);
|
|
|
+ data->setSpecularFactor(0.1f);
|
|
|
+ float size = 1;
|
|
|
+ float left, right, top, bottom;
|
|
|
+ // Calculate the screen coordinates of the left side of the bitmap.
|
|
|
+ left = (float)((size / 2.0) * -1);
|
|
|
+ // Calculate the screen coordinates of the right side of the bitmap.
|
|
|
+ right = left + (float)size;
|
|
|
+ // Calculate the screen coordinates of the top of the bitmap.
|
|
|
+ top = (float)(size / 2.0);
|
|
|
+ // Calculate the screen coordinates of the bottom of the bitmap.
|
|
|
+ bottom = top - (float)size;
|
|
|
+ float front = -size / 2;
|
|
|
+ float back = front + size;
|
|
|
|
|
|
- Vertex3D* vertecies = new Vertex3D[ 24 ];
|
|
|
- for( int i = 0; i < 24; i++ )
|
|
|
- vertecies[ i ].knochenId = 0;
|
|
|
- vertecies[ 0 ].pos = Vec3<float >( left, top, front );
|
|
|
- vertecies[ 0 ].tPos = Vec2< float >( 0.f, 0.f );
|
|
|
- vertecies[ 1 ].pos = Vec3<float >( right, top, front );
|
|
|
- vertecies[ 1 ].tPos = Vec2< float >( 1.f, 0.f );
|
|
|
- vertecies[ 2 ].pos = Vec3<float >( left, bottom, front );
|
|
|
- vertecies[ 2 ].tPos = Vec2< float >( 0.f, 1.f );
|
|
|
- vertecies[ 3 ].pos = Vec3<float >( right, bottom, front );
|
|
|
- vertecies[ 3 ].tPos = Vec2< float >( 1.f, 1.f );
|
|
|
- vertecies[ 4 ].pos = Vec3<float >( left, top, back );
|
|
|
- vertecies[ 4 ].tPos = Vec2< float >( 0.0f, 0.0f );
|
|
|
- vertecies[ 5 ].pos = Vec3<float >( right, top, back );
|
|
|
- vertecies[ 5 ].tPos = Vec2< float >( 1.0f, 0.0f );
|
|
|
- vertecies[ 6 ].pos = Vec3<float >( left, bottom, back );
|
|
|
- vertecies[ 6 ].tPos = Vec2< float >( 0.0f, 1.0f );
|
|
|
- vertecies[ 7 ].pos = Vec3<float >( right, bottom, back );
|
|
|
- vertecies[ 7 ].tPos = Vec2< float >( 1.0f, 1.0f );
|
|
|
+ Vertex3D* vertecies = new Vertex3D[24];
|
|
|
+ for (int i = 0; i < 24; i++)
|
|
|
+ vertecies[i].knochenId = 0;
|
|
|
+ vertecies[0].pos = Vec3<float >(left, top, front);
|
|
|
+ vertecies[0].tPos = Vec2< float >(0.f, 0.f);
|
|
|
+ vertecies[1].pos = Vec3<float >(right, top, front);
|
|
|
+ vertecies[1].tPos = Vec2< float >(1.f, 0.f);
|
|
|
+ vertecies[2].pos = Vec3<float >(left, bottom, front);
|
|
|
+ vertecies[2].tPos = Vec2< float >(0.f, 1.f);
|
|
|
+ vertecies[3].pos = Vec3<float >(right, bottom, front);
|
|
|
+ vertecies[3].tPos = Vec2< float >(1.f, 1.f);
|
|
|
+ vertecies[4].pos = Vec3<float >(left, top, back);
|
|
|
+ vertecies[4].tPos = Vec2< float >(0.0f, 0.0f);
|
|
|
+ vertecies[5].pos = Vec3<float >(right, top, back);
|
|
|
+ vertecies[5].tPos = Vec2< float >(1.0f, 0.0f);
|
|
|
+ vertecies[6].pos = Vec3<float >(left, bottom, back);
|
|
|
+ vertecies[6].tPos = Vec2< float >(0.0f, 1.0f);
|
|
|
+ vertecies[7].pos = Vec3<float >(right, bottom, back);
|
|
|
+ vertecies[7].tPos = Vec2< float >(1.0f, 1.0f);
|
|
|
|
|
|
- vertecies[ 8 ].pos = Vec3<float >( left, top, front );
|
|
|
- vertecies[ 8 ].tPos = Vec2< float >( 1.f, 0.f );
|
|
|
- vertecies[ 9 ].pos = Vec3<float >( right, top, front );
|
|
|
- vertecies[ 9 ].tPos = Vec2< float >( 0.f, 0.f );
|
|
|
- vertecies[ 10 ].pos = Vec3<float >( left, bottom, front );
|
|
|
- vertecies[ 10 ].tPos = Vec2< float >( 1.f, 1.f );
|
|
|
- vertecies[ 11 ].pos = Vec3<float >( right, bottom, front );
|
|
|
- vertecies[ 11 ].tPos = Vec2< float >( 0.f, 1.f );
|
|
|
- vertecies[ 12 ].pos = Vec3<float >( left, top, back );
|
|
|
- vertecies[ 12 ].tPos = Vec2< float >( 0.0f, 0.0f );
|
|
|
- vertecies[ 13 ].pos = Vec3<float >( right, top, back );
|
|
|
- vertecies[ 13 ].tPos = Vec2< float >( 1.0f, 0.0f );
|
|
|
- vertecies[ 14 ].pos = Vec3<float >( left, bottom, back );
|
|
|
- vertecies[ 14 ].tPos = Vec2< float >( 0.0f, 1.0f );
|
|
|
- vertecies[ 15 ].pos = Vec3<float >( right, bottom, back );
|
|
|
- vertecies[ 15 ].tPos = Vec2< float >( 1.0f, 1.0f );
|
|
|
+ vertecies[8].pos = Vec3<float >(left, top, front);
|
|
|
+ vertecies[8].tPos = Vec2< float >(1.f, 0.f);
|
|
|
+ vertecies[9].pos = Vec3<float >(right, top, front);
|
|
|
+ vertecies[9].tPos = Vec2< float >(0.f, 0.f);
|
|
|
+ vertecies[10].pos = Vec3<float >(left, bottom, front);
|
|
|
+ vertecies[10].tPos = Vec2< float >(1.f, 1.f);
|
|
|
+ vertecies[11].pos = Vec3<float >(right, bottom, front);
|
|
|
+ vertecies[11].tPos = Vec2< float >(0.f, 1.f);
|
|
|
+ vertecies[12].pos = Vec3<float >(left, top, back);
|
|
|
+ vertecies[12].tPos = Vec2< float >(0.0f, 0.0f);
|
|
|
+ vertecies[13].pos = Vec3<float >(right, top, back);
|
|
|
+ vertecies[13].tPos = Vec2< float >(1.0f, 0.0f);
|
|
|
+ vertecies[14].pos = Vec3<float >(left, bottom, back);
|
|
|
+ vertecies[14].tPos = Vec2< float >(0.0f, 1.0f);
|
|
|
+ vertecies[15].pos = Vec3<float >(right, bottom, back);
|
|
|
+ vertecies[15].tPos = Vec2< float >(1.0f, 1.0f);
|
|
|
|
|
|
- vertecies[ 16 ].pos = Vec3<float >( left, top, front );
|
|
|
- vertecies[ 16 ].tPos = Vec2< float >( 0.f, 1.f );
|
|
|
- vertecies[ 17 ].pos = Vec3<float >( right, top, front );
|
|
|
- vertecies[ 17 ].tPos = Vec2< float >( 1.f, 1.f );
|
|
|
- vertecies[ 18 ].pos = Vec3<float >( left, bottom, front );
|
|
|
- vertecies[ 18 ].tPos = Vec2< float >( 0.f, 0.f );
|
|
|
- vertecies[ 19 ].pos = Vec3<float >( right, bottom, front );
|
|
|
- vertecies[ 19 ].tPos = Vec2< float >( 1.f, 0.f );
|
|
|
- vertecies[ 20 ].pos = Vec3<float >( left, top, back );
|
|
|
- vertecies[ 20 ].tPos = Vec2< float >( 0.0f, 0.0f );
|
|
|
- vertecies[ 21 ].pos = Vec3<float >( right, top, back );
|
|
|
- vertecies[ 21 ].tPos = Vec2< float >( 1.0f, 0.0f );
|
|
|
- vertecies[ 22 ].pos = Vec3<float >( left, bottom, back );
|
|
|
- vertecies[ 22 ].tPos = Vec2< float >( 0.0f, 1.0f );
|
|
|
- vertecies[ 23 ].pos = Vec3<float >( right, bottom, back );
|
|
|
- vertecies[ 23 ].tPos = Vec2< float >( 1.0f, 1.0f );
|
|
|
+ vertecies[16].pos = Vec3<float >(left, top, front);
|
|
|
+ vertecies[16].tPos = Vec2< float >(0.f, 1.f);
|
|
|
+ vertecies[17].pos = Vec3<float >(right, top, front);
|
|
|
+ vertecies[17].tPos = Vec2< float >(1.f, 1.f);
|
|
|
+ vertecies[18].pos = Vec3<float >(left, bottom, front);
|
|
|
+ vertecies[18].tPos = Vec2< float >(0.f, 0.f);
|
|
|
+ vertecies[19].pos = Vec3<float >(right, bottom, front);
|
|
|
+ vertecies[19].tPos = Vec2< float >(1.f, 0.f);
|
|
|
+ vertecies[20].pos = Vec3<float >(left, top, back);
|
|
|
+ vertecies[20].tPos = Vec2< float >(0.0f, 0.0f);
|
|
|
+ vertecies[21].pos = Vec3<float >(right, top, back);
|
|
|
+ vertecies[21].tPos = Vec2< float >(1.0f, 0.0f);
|
|
|
+ vertecies[22].pos = Vec3<float >(left, bottom, back);
|
|
|
+ vertecies[22].tPos = Vec2< float >(0.0f, 1.0f);
|
|
|
+ vertecies[23].pos = Vec3<float >(right, bottom, back);
|
|
|
+ vertecies[23].tPos = Vec2< float >(1.0f, 1.0f);
|
|
|
|
|
|
- data->setVertecies( vertecies, 24 );
|
|
|
- // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
|
|
|
- // down side
|
|
|
- Polygon3D* p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 6 + 16;
|
|
|
- p->indexList[ 1 ] = 2 + 16;
|
|
|
- p->indexList[ 2 ] = 3 + 16;
|
|
|
- p->indexList[ 3 ] = 6 + 16;
|
|
|
- p->indexList[ 4 ] = 3 + 16;
|
|
|
- p->indexList[ 5 ] = 7 + 16;
|
|
|
- data->addPolygon( p );
|
|
|
- // right side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 1 + 8;
|
|
|
- p->indexList[ 1 ] = 7 + 8;
|
|
|
- p->indexList[ 2 ] = 3 + 8;
|
|
|
- p->indexList[ 3 ] = 1 + 8;
|
|
|
- p->indexList[ 4 ] = 5 + 8;
|
|
|
- p->indexList[ 5 ] = 7 + 8;
|
|
|
- data->addPolygon( p );
|
|
|
- // top side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 4 + 16;
|
|
|
- p->indexList[ 1 ] = 1 + 16;
|
|
|
- p->indexList[ 2 ] = 0 + 16;
|
|
|
- p->indexList[ 3 ] = 4 + 16;
|
|
|
- p->indexList[ 4 ] = 5 + 16;
|
|
|
- p->indexList[ 5 ] = 1 + 16;
|
|
|
- data->addPolygon( p );
|
|
|
- // left side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 0 + 8;
|
|
|
- p->indexList[ 1 ] = 2 + 8;
|
|
|
- p->indexList[ 2 ] = 6 + 8;
|
|
|
- p->indexList[ 3 ] = 0 + 8;
|
|
|
- p->indexList[ 4 ] = 6 + 8;
|
|
|
- p->indexList[ 5 ] = 4 + 8;
|
|
|
- data->addPolygon( p );
|
|
|
- // back side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 4;
|
|
|
- p->indexList[ 1 ] = 6;
|
|
|
- p->indexList[ 2 ] = 7;
|
|
|
- p->indexList[ 3 ] = 4;
|
|
|
- p->indexList[ 4 ] = 7;
|
|
|
- p->indexList[ 5 ] = 5;
|
|
|
- data->addPolygon( p );
|
|
|
- // front side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 0;
|
|
|
- p->indexList[ 1 ] = 3;
|
|
|
- p->indexList[ 2 ] = 2;
|
|
|
- p->indexList[ 3 ] = 0;
|
|
|
- p->indexList[ 4 ] = 1;
|
|
|
- p->indexList[ 5 ] = 3;
|
|
|
- data->addPolygon( p );
|
|
|
- data->calculateNormals();
|
|
|
- data->release();
|
|
|
+ data->setVertecies(vertecies, 24);
|
|
|
+ // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
|
|
|
+ // down side
|
|
|
+ Polygon3D* p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 6 + 16;
|
|
|
+ p->indexList[1] = 2 + 16;
|
|
|
+ p->indexList[2] = 3 + 16;
|
|
|
+ p->indexList[3] = 6 + 16;
|
|
|
+ p->indexList[4] = 3 + 16;
|
|
|
+ p->indexList[5] = 7 + 16;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // right side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 1 + 8;
|
|
|
+ p->indexList[1] = 7 + 8;
|
|
|
+ p->indexList[2] = 3 + 8;
|
|
|
+ p->indexList[3] = 1 + 8;
|
|
|
+ p->indexList[4] = 5 + 8;
|
|
|
+ p->indexList[5] = 7 + 8;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // top side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 4 + 16;
|
|
|
+ p->indexList[1] = 1 + 16;
|
|
|
+ p->indexList[2] = 0 + 16;
|
|
|
+ p->indexList[3] = 4 + 16;
|
|
|
+ p->indexList[4] = 5 + 16;
|
|
|
+ p->indexList[5] = 1 + 16;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // left side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 0 + 8;
|
|
|
+ p->indexList[1] = 2 + 8;
|
|
|
+ p->indexList[2] = 6 + 8;
|
|
|
+ p->indexList[3] = 0 + 8;
|
|
|
+ p->indexList[4] = 6 + 8;
|
|
|
+ p->indexList[5] = 4 + 8;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // back side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 4;
|
|
|
+ p->indexList[1] = 6;
|
|
|
+ p->indexList[2] = 7;
|
|
|
+ p->indexList[3] = 4;
|
|
|
+ p->indexList[4] = 7;
|
|
|
+ p->indexList[5] = 5;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // front side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 0;
|
|
|
+ p->indexList[1] = 3;
|
|
|
+ p->indexList[2] = 2;
|
|
|
+ p->indexList[3] = 0;
|
|
|
+ p->indexList[4] = 1;
|
|
|
+ p->indexList[5] = 3;
|
|
|
+ data->addPolygon(p);
|
|
|
+ data->calculateNormals();
|
|
|
+ data->release();
|
|
|
}
|
|
|
|
|
|
-void createCubeItem( Bildschirm* zScreen )
|
|
|
+void createCubeItem(Bildschirm* zScreen)
|
|
|
{
|
|
|
- Framework::Model3DData* data = window->zBildschirm()->zGraphicsApi()->createModel( "itemCube" );
|
|
|
- data->setAmbientFactor( 0.8f );
|
|
|
- data->setDiffusFactor( 0.1f );
|
|
|
- data->setSpecularFactor( 0.1f );
|
|
|
- float size = 0.2f;
|
|
|
- float left, right, top, bottom;
|
|
|
- // Calculate the screen coordinates of the left side of the bitmap.
|
|
|
- left = (float)((size / 2.0) * -1);
|
|
|
- // Calculate the screen coordinates of the right side of the bitmap.
|
|
|
- right = left + (float)size;
|
|
|
- // Calculate the screen coordinates of the top of the bitmap.
|
|
|
- top = (float)(size / 2.0);
|
|
|
- // Calculate the screen coordinates of the bottom of the bitmap.
|
|
|
- bottom = top - (float)size;
|
|
|
- float front = -size / 2;
|
|
|
- float back = front + size;
|
|
|
+ Framework::Model3DData* data = window->zBildschirm()->zGraphicsApi()->createModel("itemCube");
|
|
|
+ data->setAmbientFactor(0.8f);
|
|
|
+ data->setDiffusFactor(0.1f);
|
|
|
+ data->setSpecularFactor(0.1f);
|
|
|
+ float size = 0.2f;
|
|
|
+ float left, right, top, bottom;
|
|
|
+ // Calculate the screen coordinates of the left side of the bitmap.
|
|
|
+ left = (float)((size / 2.0) * -1);
|
|
|
+ // Calculate the screen coordinates of the right side of the bitmap.
|
|
|
+ right = left + (float)size;
|
|
|
+ // Calculate the screen coordinates of the top of the bitmap.
|
|
|
+ top = (float)(size / 2.0);
|
|
|
+ // Calculate the screen coordinates of the bottom of the bitmap.
|
|
|
+ bottom = top - (float)size;
|
|
|
+ float front = -size / 2;
|
|
|
+ float back = front + size;
|
|
|
|
|
|
- Vertex3D* vertecies = new Vertex3D[ 24 ];
|
|
|
- for( int i = 0; i < 24; i++ )
|
|
|
- vertecies[ i ].knochenId = 0;
|
|
|
- vertecies[ 0 ].pos = Vec3<float >( left, top, front );
|
|
|
- vertecies[ 0 ].tPos = Vec2< float >( 0.f, 0.f );
|
|
|
- vertecies[ 1 ].pos = Vec3<float >( right, top, front );
|
|
|
- vertecies[ 1 ].tPos = Vec2< float >( 1.f, 0.f );
|
|
|
- vertecies[ 2 ].pos = Vec3<float >( left, bottom, front );
|
|
|
- vertecies[ 2 ].tPos = Vec2< float >( 0.f, 1.f );
|
|
|
- vertecies[ 3 ].pos = Vec3<float >( right, bottom, front );
|
|
|
- vertecies[ 3 ].tPos = Vec2< float >( 1.f, 1.f );
|
|
|
- vertecies[ 4 ].pos = Vec3<float >( left, top, back );
|
|
|
- vertecies[ 4 ].tPos = Vec2< float >( 0.0f, 0.0f );
|
|
|
- vertecies[ 5 ].pos = Vec3<float >( right, top, back );
|
|
|
- vertecies[ 5 ].tPos = Vec2< float >( 1.0f, 0.0f );
|
|
|
- vertecies[ 6 ].pos = Vec3<float >( left, bottom, back );
|
|
|
- vertecies[ 6 ].tPos = Vec2< float >( 0.0f, 1.0f );
|
|
|
- vertecies[ 7 ].pos = Vec3<float >( right, bottom, back );
|
|
|
- vertecies[ 7 ].tPos = Vec2< float >( 1.0f, 1.0f );
|
|
|
+ Vertex3D* vertecies = new Vertex3D[24];
|
|
|
+ for (int i = 0; i < 24; i++)
|
|
|
+ vertecies[i].knochenId = 0;
|
|
|
+ vertecies[0].pos = Vec3<float >(left, top, front);
|
|
|
+ vertecies[0].tPos = Vec2< float >(0.f, 0.f);
|
|
|
+ vertecies[1].pos = Vec3<float >(right, top, front);
|
|
|
+ vertecies[1].tPos = Vec2< float >(1.f, 0.f);
|
|
|
+ vertecies[2].pos = Vec3<float >(left, bottom, front);
|
|
|
+ vertecies[2].tPos = Vec2< float >(0.f, 1.f);
|
|
|
+ vertecies[3].pos = Vec3<float >(right, bottom, front);
|
|
|
+ vertecies[3].tPos = Vec2< float >(1.f, 1.f);
|
|
|
+ vertecies[4].pos = Vec3<float >(left, top, back);
|
|
|
+ vertecies[4].tPos = Vec2< float >(0.0f, 0.0f);
|
|
|
+ vertecies[5].pos = Vec3<float >(right, top, back);
|
|
|
+ vertecies[5].tPos = Vec2< float >(1.0f, 0.0f);
|
|
|
+ vertecies[6].pos = Vec3<float >(left, bottom, back);
|
|
|
+ vertecies[6].tPos = Vec2< float >(0.0f, 1.0f);
|
|
|
+ vertecies[7].pos = Vec3<float >(right, bottom, back);
|
|
|
+ vertecies[7].tPos = Vec2< float >(1.0f, 1.0f);
|
|
|
|
|
|
- vertecies[ 8 ].pos = Vec3<float >( left, top, front );
|
|
|
- vertecies[ 8 ].tPos = Vec2< float >( 1.f, 0.f );
|
|
|
- vertecies[ 9 ].pos = Vec3<float >( right, top, front );
|
|
|
- vertecies[ 9 ].tPos = Vec2< float >( 0.f, 0.f );
|
|
|
- vertecies[ 10 ].pos = Vec3<float >( left, bottom, front );
|
|
|
- vertecies[ 10 ].tPos = Vec2< float >( 1.f, 1.f );
|
|
|
- vertecies[ 11 ].pos = Vec3<float >( right, bottom, front );
|
|
|
- vertecies[ 11 ].tPos = Vec2< float >( 0.f, 1.f );
|
|
|
- vertecies[ 12 ].pos = Vec3<float >( left, top, back );
|
|
|
- vertecies[ 12 ].tPos = Vec2< float >( 0.0f, 0.0f );
|
|
|
- vertecies[ 13 ].pos = Vec3<float >( right, top, back );
|
|
|
- vertecies[ 13 ].tPos = Vec2< float >( 1.0f, 0.0f );
|
|
|
- vertecies[ 14 ].pos = Vec3<float >( left, bottom, back );
|
|
|
- vertecies[ 14 ].tPos = Vec2< float >( 0.0f, 1.0f );
|
|
|
- vertecies[ 15 ].pos = Vec3<float >( right, bottom, back );
|
|
|
- vertecies[ 15 ].tPos = Vec2< float >( 1.0f, 1.0f );
|
|
|
+ vertecies[8].pos = Vec3<float >(left, top, front);
|
|
|
+ vertecies[8].tPos = Vec2< float >(1.f, 0.f);
|
|
|
+ vertecies[9].pos = Vec3<float >(right, top, front);
|
|
|
+ vertecies[9].tPos = Vec2< float >(0.f, 0.f);
|
|
|
+ vertecies[10].pos = Vec3<float >(left, bottom, front);
|
|
|
+ vertecies[10].tPos = Vec2< float >(1.f, 1.f);
|
|
|
+ vertecies[11].pos = Vec3<float >(right, bottom, front);
|
|
|
+ vertecies[11].tPos = Vec2< float >(0.f, 1.f);
|
|
|
+ vertecies[12].pos = Vec3<float >(left, top, back);
|
|
|
+ vertecies[12].tPos = Vec2< float >(0.0f, 0.0f);
|
|
|
+ vertecies[13].pos = Vec3<float >(right, top, back);
|
|
|
+ vertecies[13].tPos = Vec2< float >(1.0f, 0.0f);
|
|
|
+ vertecies[14].pos = Vec3<float >(left, bottom, back);
|
|
|
+ vertecies[14].tPos = Vec2< float >(0.0f, 1.0f);
|
|
|
+ vertecies[15].pos = Vec3<float >(right, bottom, back);
|
|
|
+ vertecies[15].tPos = Vec2< float >(1.0f, 1.0f);
|
|
|
|
|
|
- vertecies[ 16 ].pos = Vec3<float >( left, top, front );
|
|
|
- vertecies[ 16 ].tPos = Vec2< float >( 0.f, 1.f );
|
|
|
- vertecies[ 17 ].pos = Vec3<float >( right, top, front );
|
|
|
- vertecies[ 17 ].tPos = Vec2< float >( 1.f, 1.f );
|
|
|
- vertecies[ 18 ].pos = Vec3<float >( left, bottom, front );
|
|
|
- vertecies[ 18 ].tPos = Vec2< float >( 0.f, 0.f );
|
|
|
- vertecies[ 19 ].pos = Vec3<float >( right, bottom, front );
|
|
|
- vertecies[ 19 ].tPos = Vec2< float >( 1.f, 0.f );
|
|
|
- vertecies[ 20 ].pos = Vec3<float >( left, top, back );
|
|
|
- vertecies[ 20 ].tPos = Vec2< float >( 0.0f, 0.0f );
|
|
|
- vertecies[ 21 ].pos = Vec3<float >( right, top, back );
|
|
|
- vertecies[ 21 ].tPos = Vec2< float >( 1.0f, 0.0f );
|
|
|
- vertecies[ 22 ].pos = Vec3<float >( left, bottom, back );
|
|
|
- vertecies[ 22 ].tPos = Vec2< float >( 0.0f, 1.0f );
|
|
|
- vertecies[ 23 ].pos = Vec3<float >( right, bottom, back );
|
|
|
- vertecies[ 23 ].tPos = Vec2< float >( 1.0f, 1.0f );
|
|
|
+ vertecies[16].pos = Vec3<float >(left, top, front);
|
|
|
+ vertecies[16].tPos = Vec2< float >(0.f, 1.f);
|
|
|
+ vertecies[17].pos = Vec3<float >(right, top, front);
|
|
|
+ vertecies[17].tPos = Vec2< float >(1.f, 1.f);
|
|
|
+ vertecies[18].pos = Vec3<float >(left, bottom, front);
|
|
|
+ vertecies[18].tPos = Vec2< float >(0.f, 0.f);
|
|
|
+ vertecies[19].pos = Vec3<float >(right, bottom, front);
|
|
|
+ vertecies[19].tPos = Vec2< float >(1.f, 0.f);
|
|
|
+ vertecies[20].pos = Vec3<float >(left, top, back);
|
|
|
+ vertecies[20].tPos = Vec2< float >(0.0f, 0.0f);
|
|
|
+ vertecies[21].pos = Vec3<float >(right, top, back);
|
|
|
+ vertecies[21].tPos = Vec2< float >(1.0f, 0.0f);
|
|
|
+ vertecies[22].pos = Vec3<float >(left, bottom, back);
|
|
|
+ vertecies[22].tPos = Vec2< float >(0.0f, 1.0f);
|
|
|
+ vertecies[23].pos = Vec3<float >(right, bottom, back);
|
|
|
+ vertecies[23].tPos = Vec2< float >(1.0f, 1.0f);
|
|
|
|
|
|
- data->setVertecies( vertecies, 24 );
|
|
|
- // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
|
|
|
- // down side
|
|
|
- Polygon3D* p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 6 + 16;
|
|
|
- p->indexList[ 1 ] = 2 + 16;
|
|
|
- p->indexList[ 2 ] = 3 + 16;
|
|
|
- p->indexList[ 3 ] = 6 + 16;
|
|
|
- p->indexList[ 4 ] = 3 + 16;
|
|
|
- p->indexList[ 5 ] = 7 + 16;
|
|
|
- data->addPolygon( p );
|
|
|
- // right side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 1 + 8;
|
|
|
- p->indexList[ 1 ] = 7 + 8;
|
|
|
- p->indexList[ 2 ] = 3 + 8;
|
|
|
- p->indexList[ 3 ] = 1 + 8;
|
|
|
- p->indexList[ 4 ] = 5 + 8;
|
|
|
- p->indexList[ 5 ] = 7 + 8;
|
|
|
- data->addPolygon( p );
|
|
|
- // top side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 4 + 16;
|
|
|
- p->indexList[ 1 ] = 1 + 16;
|
|
|
- p->indexList[ 2 ] = 0 + 16;
|
|
|
- p->indexList[ 3 ] = 4 + 16;
|
|
|
- p->indexList[ 4 ] = 5 + 16;
|
|
|
- p->indexList[ 5 ] = 1 + 16;
|
|
|
- data->addPolygon( p );
|
|
|
- // left side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 0 + 8;
|
|
|
- p->indexList[ 1 ] = 2 + 8;
|
|
|
- p->indexList[ 2 ] = 6 + 8;
|
|
|
- p->indexList[ 3 ] = 0 + 8;
|
|
|
- p->indexList[ 4 ] = 6 + 8;
|
|
|
- p->indexList[ 5 ] = 4 + 8;
|
|
|
- data->addPolygon( p );
|
|
|
- // back side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 4;
|
|
|
- p->indexList[ 1 ] = 6;
|
|
|
- p->indexList[ 2 ] = 7;
|
|
|
- p->indexList[ 3 ] = 4;
|
|
|
- p->indexList[ 4 ] = 7;
|
|
|
- p->indexList[ 5 ] = 5;
|
|
|
- data->addPolygon( p );
|
|
|
- // front side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 0;
|
|
|
- p->indexList[ 1 ] = 3;
|
|
|
- p->indexList[ 2 ] = 2;
|
|
|
- p->indexList[ 3 ] = 0;
|
|
|
- p->indexList[ 4 ] = 1;
|
|
|
- p->indexList[ 5 ] = 3;
|
|
|
- data->addPolygon( p );
|
|
|
- data->calculateNormals();
|
|
|
- data->release();
|
|
|
+ data->setVertecies(vertecies, 24);
|
|
|
+ // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
|
|
|
+ // down side
|
|
|
+ Polygon3D* p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 6 + 16;
|
|
|
+ p->indexList[1] = 2 + 16;
|
|
|
+ p->indexList[2] = 3 + 16;
|
|
|
+ p->indexList[3] = 6 + 16;
|
|
|
+ p->indexList[4] = 3 + 16;
|
|
|
+ p->indexList[5] = 7 + 16;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // right side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 1 + 8;
|
|
|
+ p->indexList[1] = 7 + 8;
|
|
|
+ p->indexList[2] = 3 + 8;
|
|
|
+ p->indexList[3] = 1 + 8;
|
|
|
+ p->indexList[4] = 5 + 8;
|
|
|
+ p->indexList[5] = 7 + 8;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // top side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 4 + 16;
|
|
|
+ p->indexList[1] = 1 + 16;
|
|
|
+ p->indexList[2] = 0 + 16;
|
|
|
+ p->indexList[3] = 4 + 16;
|
|
|
+ p->indexList[4] = 5 + 16;
|
|
|
+ p->indexList[5] = 1 + 16;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // left side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 0 + 8;
|
|
|
+ p->indexList[1] = 2 + 8;
|
|
|
+ p->indexList[2] = 6 + 8;
|
|
|
+ p->indexList[3] = 0 + 8;
|
|
|
+ p->indexList[4] = 6 + 8;
|
|
|
+ p->indexList[5] = 4 + 8;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // back side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 4;
|
|
|
+ p->indexList[1] = 6;
|
|
|
+ p->indexList[2] = 7;
|
|
|
+ p->indexList[3] = 4;
|
|
|
+ p->indexList[4] = 7;
|
|
|
+ p->indexList[5] = 5;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // front side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 0;
|
|
|
+ p->indexList[1] = 3;
|
|
|
+ p->indexList[2] = 2;
|
|
|
+ p->indexList[3] = 0;
|
|
|
+ p->indexList[4] = 1;
|
|
|
+ p->indexList[5] = 3;
|
|
|
+ data->addPolygon(p);
|
|
|
+ data->calculateNormals();
|
|
|
+ data->release();
|
|
|
}
|
|
|
|
|
|
-void createPlayer( Bildschirm* zScreen )
|
|
|
+void createPlayer(Bildschirm* zScreen)
|
|
|
{
|
|
|
- Framework::Model3DData* data = window->zBildschirm()->zGraphicsApi()->createModel( "player" );
|
|
|
- data->setAmbientFactor( 0.8f );
|
|
|
- data->setDiffusFactor( 0.1f );
|
|
|
- data->setSpecularFactor( 0.1f );
|
|
|
- float size = 0.8f;
|
|
|
- float left, right, top, bottom;
|
|
|
- // Calculate the screen coordinates of the left side of the bitmap.
|
|
|
- left = (float)((size / 2.0) * -1);
|
|
|
- // Calculate the screen coordinates of the right side of the bitmap.
|
|
|
- right = left + (float)size;
|
|
|
- // Calculate the screen coordinates of the top of the bitmap.
|
|
|
- top = (float)(size / 2.0);
|
|
|
- // Calculate the screen coordinates of the bottom of the bitmap.
|
|
|
- bottom = top - (float)size;
|
|
|
- float front = -1.5f / 2;
|
|
|
- float back = front + 1.5f;
|
|
|
+ Framework::Model3DData* data = window->zBildschirm()->zGraphicsApi()->createModel("player");
|
|
|
+ data->setAmbientFactor(0.8f);
|
|
|
+ data->setDiffusFactor(0.1f);
|
|
|
+ data->setSpecularFactor(0.1f);
|
|
|
+ float size = 0.8f;
|
|
|
+ float left, right, top, bottom;
|
|
|
+ // Calculate the screen coordinates of the left side of the bitmap.
|
|
|
+ left = (float)((size / 2.0) * -1);
|
|
|
+ // Calculate the screen coordinates of the right side of the bitmap.
|
|
|
+ right = left + (float)size;
|
|
|
+ // Calculate the screen coordinates of the top of the bitmap.
|
|
|
+ top = (float)(size / 2.0);
|
|
|
+ // Calculate the screen coordinates of the bottom of the bitmap.
|
|
|
+ bottom = top - (float)size;
|
|
|
+ float front = -1.5f / 2;
|
|
|
+ float back = front + 1.5f;
|
|
|
|
|
|
- Vertex3D* vertecies = new Vertex3D[ 24 ];
|
|
|
- for( int i = 0; i < 24; i++ )
|
|
|
- vertecies[ i ].knochenId = 0;
|
|
|
- vertecies[ 0 ].pos = Vec3<float >( left, top, front );
|
|
|
- vertecies[ 0 ].tPos = Vec2< float >( 0.f, 0.f );
|
|
|
- vertecies[ 1 ].pos = Vec3<float >( right, top, front );
|
|
|
- vertecies[ 1 ].tPos = Vec2< float >( 1.f, 0.f );
|
|
|
- vertecies[ 2 ].pos = Vec3<float >( left, bottom, front );
|
|
|
- vertecies[ 2 ].tPos = Vec2< float >( 0.f, 1.f );
|
|
|
- vertecies[ 3 ].pos = Vec3<float >( right, bottom, front );
|
|
|
- vertecies[ 3 ].tPos = Vec2< float >( 1.f, 1.f );
|
|
|
- vertecies[ 4 ].pos = Vec3<float >( left, top, back );
|
|
|
- vertecies[ 4 ].tPos = Vec2< float >( 0.0f, 0.0f );
|
|
|
- vertecies[ 5 ].pos = Vec3<float >( right, top, back );
|
|
|
- vertecies[ 5 ].tPos = Vec2< float >( 1.0f, 0.0f );
|
|
|
- vertecies[ 6 ].pos = Vec3<float >( left, bottom, back );
|
|
|
- vertecies[ 6 ].tPos = Vec2< float >( 0.0f, 1.0f );
|
|
|
- vertecies[ 7 ].pos = Vec3<float >( right, bottom, back );
|
|
|
- vertecies[ 7 ].tPos = Vec2< float >( 1.0f, 1.0f );
|
|
|
+ Vertex3D* vertecies = new Vertex3D[24];
|
|
|
+ for (int i = 0; i < 24; i++)
|
|
|
+ vertecies[i].knochenId = 0;
|
|
|
+ vertecies[0].pos = Vec3<float >(left, top, front);
|
|
|
+ vertecies[0].tPos = Vec2< float >(0.f, 0.f);
|
|
|
+ vertecies[1].pos = Vec3<float >(right, top, front);
|
|
|
+ vertecies[1].tPos = Vec2< float >(1.f, 0.f);
|
|
|
+ vertecies[2].pos = Vec3<float >(left, bottom, front);
|
|
|
+ vertecies[2].tPos = Vec2< float >(0.f, 1.f);
|
|
|
+ vertecies[3].pos = Vec3<float >(right, bottom, front);
|
|
|
+ vertecies[3].tPos = Vec2< float >(1.f, 1.f);
|
|
|
+ vertecies[4].pos = Vec3<float >(left, top, back);
|
|
|
+ vertecies[4].tPos = Vec2< float >(0.0f, 0.0f);
|
|
|
+ vertecies[5].pos = Vec3<float >(right, top, back);
|
|
|
+ vertecies[5].tPos = Vec2< float >(1.0f, 0.0f);
|
|
|
+ vertecies[6].pos = Vec3<float >(left, bottom, back);
|
|
|
+ vertecies[6].tPos = Vec2< float >(0.0f, 1.0f);
|
|
|
+ vertecies[7].pos = Vec3<float >(right, bottom, back);
|
|
|
+ vertecies[7].tPos = Vec2< float >(1.0f, 1.0f);
|
|
|
|
|
|
- vertecies[ 8 ].pos = Vec3<float >( left, top, front );
|
|
|
- vertecies[ 8 ].tPos = Vec2< float >( 1.f, 0.f );
|
|
|
- vertecies[ 9 ].pos = Vec3<float >( right, top, front );
|
|
|
- vertecies[ 9 ].tPos = Vec2< float >( 0.f, 0.f );
|
|
|
- vertecies[ 10 ].pos = Vec3<float >( left, bottom, front );
|
|
|
- vertecies[ 10 ].tPos = Vec2< float >( 1.f, 1.f );
|
|
|
- vertecies[ 11 ].pos = Vec3<float >( right, bottom, front );
|
|
|
- vertecies[ 11 ].tPos = Vec2< float >( 0.f, 1.f );
|
|
|
- vertecies[ 12 ].pos = Vec3<float >( left, top, back );
|
|
|
- vertecies[ 12 ].tPos = Vec2< float >( 0.0f, 0.0f );
|
|
|
- vertecies[ 13 ].pos = Vec3<float >( right, top, back );
|
|
|
- vertecies[ 13 ].tPos = Vec2< float >( 1.0f, 0.0f );
|
|
|
- vertecies[ 14 ].pos = Vec3<float >( left, bottom, back );
|
|
|
- vertecies[ 14 ].tPos = Vec2< float >( 0.0f, 1.0f );
|
|
|
- vertecies[ 15 ].pos = Vec3<float >( right, bottom, back );
|
|
|
- vertecies[ 15 ].tPos = Vec2< float >( 1.0f, 1.0f );
|
|
|
+ vertecies[8].pos = Vec3<float >(left, top, front);
|
|
|
+ vertecies[8].tPos = Vec2< float >(1.f, 0.f);
|
|
|
+ vertecies[9].pos = Vec3<float >(right, top, front);
|
|
|
+ vertecies[9].tPos = Vec2< float >(0.f, 0.f);
|
|
|
+ vertecies[10].pos = Vec3<float >(left, bottom, front);
|
|
|
+ vertecies[10].tPos = Vec2< float >(1.f, 1.f);
|
|
|
+ vertecies[11].pos = Vec3<float >(right, bottom, front);
|
|
|
+ vertecies[11].tPos = Vec2< float >(0.f, 1.f);
|
|
|
+ vertecies[12].pos = Vec3<float >(left, top, back);
|
|
|
+ vertecies[12].tPos = Vec2< float >(0.0f, 0.0f);
|
|
|
+ vertecies[13].pos = Vec3<float >(right, top, back);
|
|
|
+ vertecies[13].tPos = Vec2< float >(1.0f, 0.0f);
|
|
|
+ vertecies[14].pos = Vec3<float >(left, bottom, back);
|
|
|
+ vertecies[14].tPos = Vec2< float >(0.0f, 1.0f);
|
|
|
+ vertecies[15].pos = Vec3<float >(right, bottom, back);
|
|
|
+ vertecies[15].tPos = Vec2< float >(1.0f, 1.0f);
|
|
|
|
|
|
- vertecies[ 16 ].pos = Vec3<float >( left, top, front );
|
|
|
- vertecies[ 16 ].tPos = Vec2< float >( 0.f, 1.f );
|
|
|
- vertecies[ 17 ].pos = Vec3<float >( right, top, front );
|
|
|
- vertecies[ 17 ].tPos = Vec2< float >( 1.f, 1.f );
|
|
|
- vertecies[ 18 ].pos = Vec3<float >( left, bottom, front );
|
|
|
- vertecies[ 18 ].tPos = Vec2< float >( 0.f, 0.f );
|
|
|
- vertecies[ 19 ].pos = Vec3<float >( right, bottom, front );
|
|
|
- vertecies[ 19 ].tPos = Vec2< float >( 1.f, 0.f );
|
|
|
- vertecies[ 20 ].pos = Vec3<float >( left, top, back );
|
|
|
- vertecies[ 20 ].tPos = Vec2< float >( 0.0f, 0.0f );
|
|
|
- vertecies[ 21 ].pos = Vec3<float >( right, top, back );
|
|
|
- vertecies[ 21 ].tPos = Vec2< float >( 1.0f, 0.0f );
|
|
|
- vertecies[ 22 ].pos = Vec3<float >( left, bottom, back );
|
|
|
- vertecies[ 22 ].tPos = Vec2< float >( 0.0f, 1.0f );
|
|
|
- vertecies[ 23 ].pos = Vec3<float >( right, bottom, back );
|
|
|
- vertecies[ 23 ].tPos = Vec2< float >( 1.0f, 1.0f );
|
|
|
+ vertecies[16].pos = Vec3<float >(left, top, front);
|
|
|
+ vertecies[16].tPos = Vec2< float >(0.f, 1.f);
|
|
|
+ vertecies[17].pos = Vec3<float >(right, top, front);
|
|
|
+ vertecies[17].tPos = Vec2< float >(1.f, 1.f);
|
|
|
+ vertecies[18].pos = Vec3<float >(left, bottom, front);
|
|
|
+ vertecies[18].tPos = Vec2< float >(0.f, 0.f);
|
|
|
+ vertecies[19].pos = Vec3<float >(right, bottom, front);
|
|
|
+ vertecies[19].tPos = Vec2< float >(1.f, 0.f);
|
|
|
+ vertecies[20].pos = Vec3<float >(left, top, back);
|
|
|
+ vertecies[20].tPos = Vec2< float >(0.0f, 0.0f);
|
|
|
+ vertecies[21].pos = Vec3<float >(right, top, back);
|
|
|
+ vertecies[21].tPos = Vec2< float >(1.0f, 0.0f);
|
|
|
+ vertecies[22].pos = Vec3<float >(left, bottom, back);
|
|
|
+ vertecies[22].tPos = Vec2< float >(0.0f, 1.0f);
|
|
|
+ vertecies[23].pos = Vec3<float >(right, bottom, back);
|
|
|
+ vertecies[23].tPos = Vec2< float >(1.0f, 1.0f);
|
|
|
|
|
|
- data->setVertecies( vertecies, 24 );
|
|
|
- // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
|
|
|
- // down side
|
|
|
- Polygon3D* p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 6 + 16;
|
|
|
- p->indexList[ 1 ] = 2 + 16;
|
|
|
- p->indexList[ 2 ] = 3 + 16;
|
|
|
- p->indexList[ 3 ] = 6 + 16;
|
|
|
- p->indexList[ 4 ] = 3 + 16;
|
|
|
- p->indexList[ 5 ] = 7 + 16;
|
|
|
- data->addPolygon( p );
|
|
|
- // right side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 1 + 8;
|
|
|
- p->indexList[ 1 ] = 7 + 8;
|
|
|
- p->indexList[ 2 ] = 3 + 8;
|
|
|
- p->indexList[ 3 ] = 1 + 8;
|
|
|
- p->indexList[ 4 ] = 5 + 8;
|
|
|
- p->indexList[ 5 ] = 7 + 8;
|
|
|
- data->addPolygon( p );
|
|
|
- // top side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 4 + 16;
|
|
|
- p->indexList[ 1 ] = 1 + 16;
|
|
|
- p->indexList[ 2 ] = 0 + 16;
|
|
|
- p->indexList[ 3 ] = 4 + 16;
|
|
|
- p->indexList[ 4 ] = 5 + 16;
|
|
|
- p->indexList[ 5 ] = 1 + 16;
|
|
|
- data->addPolygon( p );
|
|
|
- // left side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 0 + 8;
|
|
|
- p->indexList[ 1 ] = 2 + 8;
|
|
|
- p->indexList[ 2 ] = 6 + 8;
|
|
|
- p->indexList[ 3 ] = 0 + 8;
|
|
|
- p->indexList[ 4 ] = 6 + 8;
|
|
|
- p->indexList[ 5 ] = 4 + 8;
|
|
|
- data->addPolygon( p );
|
|
|
- // back side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 4;
|
|
|
- p->indexList[ 1 ] = 6;
|
|
|
- p->indexList[ 2 ] = 7;
|
|
|
- p->indexList[ 3 ] = 4;
|
|
|
- p->indexList[ 4 ] = 7;
|
|
|
- p->indexList[ 5 ] = 5;
|
|
|
- data->addPolygon( p );
|
|
|
- // front side
|
|
|
- p = new Polygon3D();
|
|
|
- p->indexAnz = 6;
|
|
|
- p->indexList = new int[ p->indexAnz ];
|
|
|
- p->indexList[ 0 ] = 0;
|
|
|
- p->indexList[ 1 ] = 3;
|
|
|
- p->indexList[ 2 ] = 2;
|
|
|
- p->indexList[ 3 ] = 0;
|
|
|
- p->indexList[ 4 ] = 1;
|
|
|
- p->indexList[ 5 ] = 3;
|
|
|
- data->addPolygon( p );
|
|
|
- data->calculateNormals();
|
|
|
- data->release();
|
|
|
+ data->setVertecies(vertecies, 24);
|
|
|
+ // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
|
|
|
+ // down side
|
|
|
+ Polygon3D* p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 6 + 16;
|
|
|
+ p->indexList[1] = 2 + 16;
|
|
|
+ p->indexList[2] = 3 + 16;
|
|
|
+ p->indexList[3] = 6 + 16;
|
|
|
+ p->indexList[4] = 3 + 16;
|
|
|
+ p->indexList[5] = 7 + 16;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // right side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 1 + 8;
|
|
|
+ p->indexList[1] = 7 + 8;
|
|
|
+ p->indexList[2] = 3 + 8;
|
|
|
+ p->indexList[3] = 1 + 8;
|
|
|
+ p->indexList[4] = 5 + 8;
|
|
|
+ p->indexList[5] = 7 + 8;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // top side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 4 + 16;
|
|
|
+ p->indexList[1] = 1 + 16;
|
|
|
+ p->indexList[2] = 0 + 16;
|
|
|
+ p->indexList[3] = 4 + 16;
|
|
|
+ p->indexList[4] = 5 + 16;
|
|
|
+ p->indexList[5] = 1 + 16;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // left side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 0 + 8;
|
|
|
+ p->indexList[1] = 2 + 8;
|
|
|
+ p->indexList[2] = 6 + 8;
|
|
|
+ p->indexList[3] = 0 + 8;
|
|
|
+ p->indexList[4] = 6 + 8;
|
|
|
+ p->indexList[5] = 4 + 8;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // back side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 4;
|
|
|
+ p->indexList[1] = 6;
|
|
|
+ p->indexList[2] = 7;
|
|
|
+ p->indexList[3] = 4;
|
|
|
+ p->indexList[4] = 7;
|
|
|
+ p->indexList[5] = 5;
|
|
|
+ data->addPolygon(p);
|
|
|
+ // front side
|
|
|
+ p = new Polygon3D();
|
|
|
+ p->indexAnz = 6;
|
|
|
+ p->indexList = new int[p->indexAnz];
|
|
|
+ p->indexList[0] = 0;
|
|
|
+ p->indexList[1] = 3;
|
|
|
+ p->indexList[2] = 2;
|
|
|
+ p->indexList[3] = 0;
|
|
|
+ p->indexList[4] = 1;
|
|
|
+ p->indexList[5] = 3;
|
|
|
+ data->addPolygon(p);
|
|
|
+ data->calculateNormals();
|
|
|
+ data->release();
|
|
|
}
|
|
|
|
|
|
-void createModels( Bildschirm* zScreen )
|
|
|
+void createModels(Bildschirm* zScreen)
|
|
|
{
|
|
|
- createDefaultCube( zScreen );
|
|
|
- createCubeItem( zScreen );
|
|
|
- createPlayer( zScreen );
|
|
|
+ createDefaultCube(zScreen);
|
|
|
+ createCubeItem(zScreen);
|
|
|
+ createPlayer(zScreen);
|
|
|
}
|
|
|
|
|
|
|
|
|
-LoadMenu::LoadMenu( Bildschirm* zScreen )
|
|
|
- : Menu( zScreen )
|
|
|
+LoadMenu::LoadMenu(Bildschirm* zScreen)
|
|
|
+ : Menu(zScreen)
|
|
|
{
|
|
|
- step = initFBalken( 10, 90, 200, 30, FBalken::Style::normal );
|
|
|
- stage = initFBalken( 10, 50, 200, 30, FBalken::Style::normal );
|
|
|
- all = initFBalken( 10, 10, 200, 30, FBalken::Style::normal );
|
|
|
- elements.add( step );
|
|
|
- elements.add( stage );
|
|
|
- elements.add( all );
|
|
|
+ step = initFBalken(10, 90, 200, 30, FBalken::Style::normal);
|
|
|
+ stage = initFBalken(10, 50, 200, 30, FBalken::Style::normal);
|
|
|
+ all = initFBalken(10, 10, 200, 30, FBalken::Style::normal);
|
|
|
+ elements.add(step);
|
|
|
+ elements.add(stage);
|
|
|
+ elements.add(all);
|
|
|
|
|
|
- new AsynchronCall( "Load Menu", [this, zScreen]() {
|
|
|
- Sleep( 1000 );
|
|
|
- all->setAktionAnzahl( 2 );
|
|
|
- all->reset();
|
|
|
- // loading textures
|
|
|
- Datei texturF;
|
|
|
- texturF.setDatei( "data/textures" );
|
|
|
- RCArray<Text>* files = texturF.getDateiListe();
|
|
|
- if( files )
|
|
|
- {
|
|
|
- int count = 0;
|
|
|
- for( Text* fileName : *files )
|
|
|
- {
|
|
|
- LTDBDatei dat;
|
|
|
- dat.setDatei( new Text( Text( "data/textures/" ) + *fileName ) );
|
|
|
- dat.leseDaten( 0 );
|
|
|
- count += dat.getBildAnzahl();
|
|
|
- }
|
|
|
- stage->setAktionAnzahl( count );
|
|
|
- stage->reset();
|
|
|
- for( Text* fileName : *files )
|
|
|
- {
|
|
|
- LTDBDatei dat;
|
|
|
- dat.setDatei( new Text( Text( "data/textures/" ) + *fileName ) );
|
|
|
- dat.leseDaten( 0 );
|
|
|
- for( Text* name : *dat.zBildListe() )
|
|
|
- {
|
|
|
- step->reset();
|
|
|
- Bild* b = dat.laden( step, new Text( *name ) );
|
|
|
- zScreen->zGraphicsApi()->createOrGetTextur( *fileName + "/" + *name, b )->release();
|
|
|
- stage->aktionPlus();
|
|
|
- }
|
|
|
- }
|
|
|
- files->release();
|
|
|
- }
|
|
|
- createModels( zScreen );
|
|
|
- all->aktionPlus();
|
|
|
- stage->reset();
|
|
|
- stage->setAktionAnzahl( STATIC_REGISTRY( ItemType ).getCount() );
|
|
|
- // pre rendering item icons
|
|
|
- Kam3D* kam = new Kam3D();
|
|
|
- Welt3D* w = new Welt3D();
|
|
|
- w->addDiffuseLight( DiffuseLight{ Vec3<float>( 0.5f, 0.5f, -1.f ), Vec3<float>( 1.f, 1.f, 1.f ) } );
|
|
|
- kam->setWelt( w );
|
|
|
- kam->setBildschirmPosition( 0, 0 );
|
|
|
- kam->setBildschirmSize( 50, 50 );
|
|
|
- kam->setPosition( Vec3<float>( 0, 0, 0 ) );
|
|
|
- kam->setRotation( { 2.f, 0, -1.f } );
|
|
|
- Bild* b = new Bild();
|
|
|
- b->neuBild( 50, 50, 0 );
|
|
|
- for( int i = 0; i < STATIC_REGISTRY( ItemType ).getCount(); i++ )
|
|
|
- {
|
|
|
- Model3D* mdl = new Model3D();
|
|
|
- mdl->setModelDaten( STATIC_REGISTRY( ItemType ).zElement( i )->getItemModel() );
|
|
|
- mdl->setModelTextur( STATIC_REGISTRY( ItemType ).zElement( i )->getItemTextur() );
|
|
|
- mdl->setPosition( Vec3<float>( -0.8f, -0.45f, -0.4f ) );
|
|
|
- mdl->setSize( 2.f );
|
|
|
- w->addZeichnung( mdl );
|
|
|
- w->tick( 0 );
|
|
|
- zScreen->lock();
|
|
|
- DX11Textur* t = (DX11Textur*)zScreen->zGraphicsApi()->createOrGetTextur( Text( "rendered/items/" ) + STATIC_REGISTRY( ItemType ).zElement( i )->getDefaultItemName(), dynamic_cast<Bild*>(b->getThis()) );
|
|
|
- zScreen->zGraphicsApi()->renderKamera( kam, t );
|
|
|
- Bild* result = new Bild();
|
|
|
- t->copyToImage( result );
|
|
|
- itemIcons->add( result );
|
|
|
- t->release();
|
|
|
- zScreen->unlock();
|
|
|
- w->removeZeichnung( mdl );
|
|
|
- stage->aktionPlus();
|
|
|
- }
|
|
|
- b->release();
|
|
|
- kam->release();
|
|
|
- all->aktionPlus();
|
|
|
- zScreen->lock();
|
|
|
- hide();
|
|
|
- ((LoginMenu*)(Menu*)menuRegister->get( "login" ))->onLoadingFinished();
|
|
|
- menuRegister->get( "login" )->show();
|
|
|
- zScreen->unlock();
|
|
|
- } );
|
|
|
+ new AsynchronCall("Load Menu", [this, zScreen]()
|
|
|
+ {
|
|
|
+ Sleep(1000);
|
|
|
+ all->setAktionAnzahl(1);
|
|
|
+ all->reset();
|
|
|
+ // loading textures
|
|
|
+ Datei texturF;
|
|
|
+ texturF.setDatei("data/textures");
|
|
|
+ RCArray<Text>* files = texturF.getDateiListe();
|
|
|
+ if (files)
|
|
|
+ {
|
|
|
+ int count = 0;
|
|
|
+ for (Text* fileName : *files)
|
|
|
+ {
|
|
|
+ LTDBDatei dat;
|
|
|
+ dat.setDatei(new Text(Text("data/textures/") + *fileName));
|
|
|
+ dat.leseDaten(0);
|
|
|
+ count += dat.getBildAnzahl();
|
|
|
+ }
|
|
|
+ stage->setAktionAnzahl(count);
|
|
|
+ stage->reset();
|
|
|
+ for (Text* fileName : *files)
|
|
|
+ {
|
|
|
+ LTDBDatei dat;
|
|
|
+ dat.setDatei(new Text(Text("data/textures/") + *fileName));
|
|
|
+ dat.leseDaten(0);
|
|
|
+ for (Text* name : *dat.zBildListe())
|
|
|
+ {
|
|
|
+ step->reset();
|
|
|
+ Bild* b = dat.laden(step, new Text(*name));
|
|
|
+ zScreen->zGraphicsApi()->createOrGetTextur(*fileName + "/" + *name, b)->release();
|
|
|
+ stage->aktionPlus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ files->release();
|
|
|
+ }
|
|
|
+ createModels(zScreen);
|
|
|
+ all->aktionPlus();
|
|
|
+ stage->reset();
|
|
|
+ zScreen->lock();
|
|
|
+ hide();
|
|
|
+ ((LoginMenu*)(Menu*)menuRegister->get("login"))->onLoadingFinished();
|
|
|
+ menuRegister->get("login")->show();
|
|
|
+ zScreen->unlock();
|
|
|
+ });
|
|
|
}
|