+ Vector3 position1;
+ Vector3 position2;
+ };
+ // 4 vertices 2 triangles per layer. The depth interval between each layer is 0.01
+ VertexPosition vertexData[12] = {
+ //bottom layer
+ { Vector3( -0.5f, -0.5f, 0.f ), Vector3( -0.5f, -0.5f, 0.f ) },
+ { Vector3( 0.5f, -0.5f, 0.f ), Vector3( 0.5f, -0.5f, 0.f ) },
+ { Vector3( -0.5f, -0.5f, 0.f ), Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[0], 0.f ) },
+ { Vector3( 0.5f, -0.5f, 0.f ), Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[0], 0.f ) },
+ // middle layer
+ { Vector3( -0.5f, -0.5f, 0.01f ), Vector3( -0.5f, -0.5f, 0.01f ) },
+ { Vector3( 0.5f, -0.5f, 0.01f ), Vector3( 0.5f, -0.5f, 0.01f ) },
+ { Vector3( -0.5f, -0.5f, 0.01f ), Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[1], 0.01f ) },
+ { Vector3( 0.5f, -0.5f, 0.01f ), Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[1], 0.01f ) },
+ // top layer
+ { Vector3( -0.5f, -0.5f, 0.02f ), Vector3( -0.5f, -0.5f, 0.02f ) },
+ { Vector3( 0.5f, -0.5f, 0.02f ), Vector3( 0.5f, -0.5f, 0.02f ) },
+ { Vector3( -0.5f, -0.5f, 0.02f ), Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[2], 0.02f ) },
+ { Vector3( 0.5f, -0.5f, 0.02f ), Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[2], 0.02f ) }
+ };
+ Property::Map vertexFormat;
+ vertexFormat["aPosition1"] = Property::VECTOR3;
+ vertexFormat["aPosition2"] = Property::VECTOR3;
+ PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, 12u );
+ vertices.SetData( vertexData );
+
+ unsigned int indexData[18] = { 0,3,1,0,2,3,4,7,5,4,6,7,8,11,9,8,10,11 };
+ Property::Map indexFormat;
+ indexFormat["indices"] = Property::INTEGER;
+ PropertyBuffer indices = PropertyBuffer::New( indexFormat, 18u );
+ indices.SetData( indexData );
+
+ Geometry meshGeometry = Geometry::New();
+ meshGeometry.AddVertexBuffer( vertices );
+ meshGeometry.SetIndexBuffer( indices );
+
+ // Create material
+ Shader shader = Shader::New( MESH_VERTEX_SHADER, MESH_FRAGMENT_SHADER );
+ Material material = Material::New( shader );
+
+ // Create renderer
+ Renderer renderer = Renderer::New( meshGeometry, material );
+
+ // Create actor
+ Actor meshActor= Actor::New();
+ meshActor.AddRenderer( renderer );
+
+ // Register property
+ bouncePropertyIndex = meshActor.RegisterProperty("uBounceCoefficient", 0.f);