//Create a vertex buffer for vertex positions and texture coordinates
Dali::Property::Map vertexFormat;
vertexFormat["aCoefficient"] = Dali::Property::VECTOR3;
- Dali::PropertyBuffer vertexBuffer = Dali::PropertyBuffer::New( vertexFormat );
+ Dali::VertexBuffer vertexBuffer = Dali::VertexBuffer::New( vertexFormat );
vertexBuffer.SetData( vertexData, sizeof(vertexData)/sizeof(vertexData[0]));
//Create the geometry
//Create a vertex buffer for vertex positions and texture coordinates
Dali::Property::Map vertexFormat;
vertexFormat["aCoefficient"] = Dali::Property::VECTOR3;
- Dali::PropertyBuffer vertexBuffer = Dali::PropertyBuffer::New( vertexFormat );
+ Dali::VertexBuffer vertexBuffer = Dali::VertexBuffer::New( vertexFormat );
vertexBuffer.SetData( vertexData, sizeof(vertexData)/sizeof(vertexData[0]));
//Create the geometry
//Create a vertex buffer for vertex positions and texture coordinates
Dali::Property::Map vertexFormat;
vertexFormat["aCoefficient"] = Dali::Property::VECTOR3;
- Dali::PropertyBuffer vertexBuffer = Dali::PropertyBuffer::New( vertexFormat );
+ Dali::VertexBuffer vertexBuffer = Dali::VertexBuffer::New( vertexFormat );
vertexBuffer.SetData( vertexData, sizeof(vertexData)/sizeof(vertexData[0]));
//Create the geometry
Property::Map curveVertexFormat;
curveVertexFormat["aPosition"] = Property::VECTOR2;
- mCurveVertices = PropertyBuffer::New( curveVertexFormat );
+ mCurveVertices = VertexBuffer::New( curveVertexFormat );
Vector2 vertexData[2] = { Vector2(-0.5f, 0.5f), Vector2( 0.5f, -0.5f ) };
mCurveVertices.SetData( vertexData, 2 );
return actor;
}
- Actor CreateControlLine( PropertyBuffer vertexBuffer )
+ Actor CreateControlLine( VertexBuffer vertexBuffer )
{
Actor line = Actor::New();
line.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Property::Map lineVertexFormat;
lineVertexFormat["aPosition"] = Property::VECTOR2;
- mLine1Vertices = PropertyBuffer::New( lineVertexFormat );
- mLine2Vertices = PropertyBuffer::New( lineVertexFormat );
+ mLine1Vertices = VertexBuffer::New( lineVertexFormat );
+ mLine2Vertices = VertexBuffer::New( lineVertexFormat );
mControlLine1 = CreateControlLine( mLine1Vertices );
mControlLine2 = CreateControlLine( mLine2Vertices );
Timer mTimer;
Animation mDragAnimation;
Animation mBezierAnimation;
- PropertyBuffer mCurveVertices;
- PropertyBuffer mLine1Vertices;
- PropertyBuffer mLine2Vertices;
+ VertexBuffer mCurveVertices;
+ VertexBuffer mLine1Vertices;
+ VertexBuffer mLine2Vertices;
Vector2 mRelativeDragPoint;
Vector2 mLastControlPointPosition1;
Vector2 mLastControlPointPosition2;
Property::Map circleVertexFormat;
circleVertexFormat["aPositionCircle"] = Property::VECTOR2;
- PropertyBuffer circleVertices = PropertyBuffer::New( circleVertexFormat );
+ VertexBuffer circleVertices = VertexBuffer::New( circleVertexFormat );
circleVertices.SetData( circleBuffer, vertexCount );
// Create the Quad Geometry
Property::Map vertexFormat;
vertexFormat["aPositionQuad"] = Property::VECTOR2;
- PropertyBuffer quadVertices2 = PropertyBuffer::New( vertexFormat );
+ VertexBuffer quadVertices2 = VertexBuffer::New( vertexFormat );
quadVertices2.SetData( quadBuffer, vertexCount );
// Create the geometry object itself
out vec4 vPosition;
out vec3 vNormal;
-vec4 Map(vec4 v) // projection space -> texture
+vec4 Map(vec4 v) // projection space -> texture
{
return vec4(v.xyz / (2.f * v.w) + vec3(.5f), (v.w - NEAR) * INV_DEPTH);
}
// Light source uniforms
struct Light
{
- vec3 position; // view space
+ vec3 position; // view space
float radius;
vec3 color;
};
out vec4 oColor;
-vec4 Unmap(vec4 m) // texture -> projection
+vec4 Unmap(vec4 m) // texture -> projection
{
m.w = m.w * DEPTH + NEAR;
m.xyz = (m.xyz - vec3(.5)) * (2.f * m.w);
rel /= distance;
float a = uLights[i].radius / (kAttenuationConst + kAttenuationLinear * distance +
- kAttenuationQuadratic * distance * distance); // attenuation
+ kAttenuationQuadratic * distance * distance); // attenuation
- float l = max(0.f, dot(normal, rel)); // lambertian
- float s = pow(max(0.f, dot(viewDirRefl, rel)), 256.f); // specular
+ float l = max(0.f, dot(normal, rel)); // lambertian
+ float s = pow(max(0.f, dot(viewDirRefl, rel)), 256.f); // specular
light += (uLights[i].color * (l + s)) * a;
}
std::swap(vertexData[1].aTexCoord, vertexData[3].aTexCoord);
}
- PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map()
+ VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
.Add( "aPosition", Property::VECTOR3 )
.Add( "aTexCoord", Property::VECTOR2 ) );
vertexBuffer.SetData( vertexData, std::extent<decltype(vertexData)>::value );
}
// Configure property buffers and create geometry.
- PropertyBuffer vertexBuffer = PropertyBuffer::New(Property::Map()
+ VertexBuffer vertexBuffer = VertexBuffer::New(Property::Map()
.Add("aPosition", Property::VECTOR3)
.Add("aNormal", Property::VECTOR3));
vertexBuffer.SetData(vertexData, std::extent<decltype(vertexData)>::value);
mHeader = *(reinterpret_cast<ModelHeader*>( bytes.data() + bytes.size()/2 ));
}
- mVertexBuffer = Dali::PropertyBuffer::New( Dali::Property::Map().
- Add( "aPosition", Dali::Property::VECTOR3 ).
- Add( "aNormal", Dali::Property::VECTOR3 ).
- Add( "aTexCoord", Dali::Property::VECTOR2 )
- );
+ mVertexBuffer = Dali::VertexBuffer::New( Dali::Property::Map().
+ Add( "aPosition", Dali::Property::VECTOR3 ).
+ Add( "aNormal", Dali::Property::VECTOR3 ).
+ Add( "aTexCoord", Dali::Property::VECTOR2 )
+ );
mVertexBuffer.SetData( bytes.data() + mHeader.dataBeginOffset, mHeader.vertexBufferSize/mHeader.vertexStride );
*/
#include <dali/public-api/rendering/geometry.h>
-#include <dali/public-api/rendering/property-buffer.h>
+#include <dali/public-api/rendering/vertex-buffer.h>
#include <inttypes.h>
/**
* @brief The GameModel class
* GameModel represents model geometry. It loads model data from external model file ( .mod file ).
- * Such data is ready to be used as GL buffer so it can be copied directly into the PropertyBuffer
+ * Such data is ready to be used as GL buffer so it can be copied directly into the VertexBuffer
* object.
*
* Model file is multi-architecture so can be loaded on little and big endian architectures
private:
Dali::Geometry mGeometry;
- Dali::PropertyBuffer mVertexBuffer;
+ Dali::VertexBuffer mVertexBuffer;
ModelHeader mHeader;
pentagonVertexFormat["aPosition1"] = Property::VECTOR2;
pentagonVertexFormat["aPosition2"] = Property::VECTOR2;
pentagonVertexFormat["aColor"] = Property::VECTOR3;
- PropertyBuffer pentagonVertices = PropertyBuffer::New( pentagonVertexFormat );
+ VertexBuffer pentagonVertices = VertexBuffer::New( pentagonVertexFormat );
pentagonVertices.SetData(pentagonVertexData, 5);
Property::Map initialPositionVertexFormat;
initialPositionVertexFormat["aInitPos"] = Property::VECTOR2;
- PropertyBuffer initialPositionVertices = PropertyBuffer::New( initialPositionVertexFormat );
+ VertexBuffer initialPositionVertices = VertexBuffer::New( initialPositionVertexFormat );
initialPositionVertices.SetData( quad, numberOfVertices );
Property::Map finalPositionVertexFormat;
finalPositionVertexFormat["aFinalPos"] = Property::VECTOR2;
- PropertyBuffer finalPositionVertices = PropertyBuffer::New( finalPositionVertexFormat );
+ VertexBuffer finalPositionVertices = VertexBuffer::New( finalPositionVertexFormat );
finalPositionVertices.SetData( cat, numberOfVertices );
Property::Map colorVertexFormat;
colorVertexFormat["aColor"] = Property::VECTOR3;
- PropertyBuffer colorVertices = PropertyBuffer::New( colorVertexFormat );
+ VertexBuffer colorVertices = VertexBuffer::New( colorVertexFormat );
colorVertices.SetData( colors, numberOfVertices );
// Create the geometry object
// Vertices
Property::Map positionVertexFormat;
positionVertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat );
+ VertexBuffer positionVertices = VertexBuffer::New( positionVertexFormat );
positionVertices.SetData( vertices, numberOfVertices );
// Textures
Property::Map textureVertexFormat;
textureVertexFormat["aTexture"] = Property::VECTOR2;
- PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat );
+ VertexBuffer textureVertices = VertexBuffer::New( textureVertexFormat );
textureVertices.SetData( textures, numberOfVertices );
// Indices
// Vertices
Property::Map positionVertexFormat;
positionVertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat );
+ VertexBuffer positionVertices = VertexBuffer::New( positionVertexFormat );
positionVertices.SetData( vertices, numberOfVertices );
// Textures
Property::Map textureVertexFormat;
textureVertexFormat["aTexture"] = Property::VECTOR2;
- PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat );
+ VertexBuffer textureVertices = VertexBuffer::New( textureVertexFormat );
textureVertices.SetData( textures, numberOfVertices );
// Indices
Property::Map polyhedraVertexFormat;
polyhedraVertexFormat["aPosition"] = Property::VECTOR2;
polyhedraVertexFormat["aHue"] = Property::FLOAT;
- PropertyBuffer polyhedraVertices = PropertyBuffer::New( polyhedraVertexFormat );
+ VertexBuffer polyhedraVertices = VertexBuffer::New( polyhedraVertexFormat );
polyhedraVertices.SetData( polyhedraVertexData, numSides );
// Create the geometry object
Property::Map vertexFormat;
vertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer vertexBuffer = PropertyBuffer::New( vertexFormat );
+ VertexBuffer vertexBuffer = VertexBuffer::New( vertexFormat );
const float P( 0.5f );
const Vector2 vertices[] = {
/**
* Create matching property buffer
*/
- auto vertexBuffer = PropertyBuffer::New( Property::Map()
+ auto vertexBuffer = VertexBuffer::New( Property::Map()
.Add("aPosition", Property::VECTOR3 )
.Add("aNormal", Property::VECTOR3)
.Add("aTexCoord", Property::VECTOR2)
vertexFormat["aPosition"] = Property::VECTOR3;
vertexFormat["aNormal"] = Property::VECTOR3;
vertexFormat["aTexCoord"] = Property::VECTOR2;
- PropertyBuffer surfaceVertices = PropertyBuffer::New( vertexFormat );
+ VertexBuffer surfaceVertices = VertexBuffer::New( vertexFormat );
surfaceVertices.SetData( &vertices[0], vertices.size() );
Geometry surface = Geometry::New();
vertexFormat[NORMAL] = Property::VECTOR3;
vertexFormat[TEXTURE] = Property::VECTOR2;
- PropertyBuffer surfaceVertices = PropertyBuffer::New( vertexFormat );
+ VertexBuffer surfaceVertices = VertexBuffer::New( vertexFormat );
surfaceVertices.SetData( &vertices[0u], vertices.Size() );
Geometry geometry = Geometry::New();
property.Insert( "aPosition", Property::VECTOR3 );
property.Insert( "aNormal", Property::VECTOR3 );
- PropertyBuffer vertexBuffer = PropertyBuffer::New( property );
+ VertexBuffer vertexBuffer = VertexBuffer::New( property );
vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vertex) );
{ Vector3( 1.0f, -1.0f, 1.0f ) }
};
- PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map()
- .Add( "aPosition", Property::VECTOR3 ) );
+ VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
+ .Add( "aPosition", Property::VECTOR3 ) );
vertexBuffer.SetData( skyboxVertices, sizeof(skyboxVertices) / sizeof(Vertex) );
geometry = Geometry::New();
Property::Map positionMap;
positionMap["aPosition"] = Property::VECTOR3;
- PropertyBuffer positionBuffer = PropertyBuffer::New( positionMap );
+ VertexBuffer positionBuffer = VertexBuffer::New( positionMap );
positionBuffer.SetData( positions.Begin(), positions.Count() );
Property::Map normalMap;
normalMap["aNormal"] = Property::VECTOR3;
- PropertyBuffer normalBuffer = PropertyBuffer::New( normalMap );
+ VertexBuffer normalBuffer = VertexBuffer::New( normalMap );
normalBuffer.SetData( normals.Begin(), normals.Count() );
surface.AddVertexBuffer( positionBuffer );
{
Property::Map tangentMap;
tangentMap["aTangent"] = Property::VECTOR3;
- PropertyBuffer tangentBuffer = PropertyBuffer::New( tangentMap );
+ VertexBuffer tangentBuffer = VertexBuffer::New( tangentMap );
tangentBuffer.SetData( tangents.Begin(), tangents.Count() );
surface.AddVertexBuffer( tangentBuffer );
{
Property::Map textCoordMap;
textCoordMap["aTexCoord"] = Property::VECTOR2;
- PropertyBuffer texCoordBuffer = PropertyBuffer::New( textCoordMap );
+ VertexBuffer texCoordBuffer = VertexBuffer::New( textCoordMap );
texCoordBuffer.SetData( textures.Begin(), textures.Count() );
surface.AddVertexBuffer( texCoordBuffer );
{ Vector3( -1.0f, 1.0f, 1.0f ), COLOR2 },
};
- PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map()
+ VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
.Add( "aPosition", Property::VECTOR3 )
.Add( "aColor", Property::VECTOR3 ) );
vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vertex) );
Vector2( 1.0f, 1.0f )
};
- PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map()
- .Add( "aPosition", Property::VECTOR2 ) );
+ VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
+ .Add( "aPosition", Property::VECTOR2 ) );
vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vector2) );
mGeometry = Geometry::New();
vertexFormat[ "aPosition" ] = Property::VECTOR3;
// describe vertex format ( only 2-dimensional positions )
- PropertyBuffer vertexBuffer = PropertyBuffer::New( vertexFormat );
+ VertexBuffer vertexBuffer = VertexBuffer::New( vertexFormat );
vertexBuffer.SetData( vertices.data(), vertices.size() );
// create geometry
Property::Map vertexFormat;
vertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer vertexBuffer = PropertyBuffer::New( vertexFormat );
+ VertexBuffer vertexBuffer = VertexBuffer::New( vertexFormat );
const float P( 0.5f );
const Vector2 vertices[] = {
{ Vector3( -1.0f, 1.0f, 1.0f ), Vector2( 0.0, 0.0 ) },
};
- PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map()
- .Add( "aPosition", Property::VECTOR3 )
- .Add( "aTexCoord", Property::VECTOR2 ) );
+ VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
+ .Add( "aPosition", Property::VECTOR3 )
+ .Add( "aTexCoord", Property::VECTOR2 ) );
vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vertex) );
// create indices
{ Vector3( 1.0f, -1.0f, 1.0f ) }
};
- PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map()
- .Add( "aPosition", Property::VECTOR3 ) );
+ VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
+ .Add( "aPosition", Property::VECTOR3 ) );
vertexBuffer.SetData( skyboxVertices, sizeof(skyboxVertices) / sizeof(Vertex) );
mSkyboxGeometry = Geometry::New();
{ Vector3( -1.0f, 1.0f, 1.0f ), Vector2( 0.0, 0.0 ) },
};
- PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map()
- .Add( "aPosition", Property::VECTOR3 )
- .Add( "aTexCoord", Property::VECTOR2 ) );
+ VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
+ .Add( "aPosition", Property::VECTOR3 )
+ .Add( "aTexCoord", Property::VECTOR2 ) );
vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vertex) );
// create indices
Vector2( -1.0f, 1.0f )
};
- PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map()
- .Add( "aPosition", Property::VECTOR2 ) );
+ VertexBuffer vertexBuffer = VertexBuffer::New( Property::Map()
+ .Add( "aPosition", Property::VECTOR2 ) );
vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vector2) );
mGeometry = Geometry::New();
Property::Map property;
property.Add("aPosition", Property::VECTOR2).Add("aTexCoord", Property::VECTOR2);
- PropertyBuffer vertexBuffer = PropertyBuffer::New(property);
+ VertexBuffer vertexBuffer = VertexBuffer::New(property);
vertexBuffer.SetData(vertices, sizeof(vertices) / sizeof(Vertex));
vertexFormat["aParticlePath4"] = Property::VECTOR2;
vertexFormat["aParticlePath5"] = Property::VECTOR2;
- PropertyBuffer propertyBuffer = PropertyBuffer::New( vertexFormat );
- propertyBuffer.SetData( &vertices[0], vertices.size() );
+ VertexBuffer vertexBuffer = VertexBuffer::New( vertexFormat );
+ vertexBuffer.SetData( &vertices[0], vertices.size() );
Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( propertyBuffer );
+ geometry.AddVertexBuffer( vertexBuffer );
geometry.SetIndexBuffer( &faces[0], faces.size() );
geometry.SetType( Geometry::TRIANGLES );
application.MainLoop();
return 0;
}
-
{ Dali::Vector2( -0.5f, 0.5f ), Dali::Vector2( 0.0f, 1.0f ) },
{ Dali::Vector2( 0.5f, 0.5f ), Dali::Vector2( 1.0f, 1.0f ) }};
- Dali::PropertyBuffer vertexBuffer;
+ Dali::VertexBuffer vertexBuffer;
Dali::Property::Map vertexFormat;
vertexFormat["aPosition"] = Dali::Property::VECTOR2;
vertexFormat["aTexCoord"] = Dali::Property::VECTOR2;
//Create a vertex buffer for vertex positions and texture coordinates
- vertexBuffer = Dali::PropertyBuffer::New( vertexFormat );
+ vertexBuffer = Dali::VertexBuffer::New( vertexFormat );
vertexBuffer.SetData( data, 4u );
//Create the geometry