vertexFormat["aIndex"] = Property::FLOAT;
vertexFormat["aPosition"] = Property::VECTOR2;
vertexFormat["aTexCoord"] = Property::VECTOR2;
- PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, numVertex );
- vertices.SetData( &vertexData[0] );
+ PropertyBuffer vertices = PropertyBuffer::New( vertexFormat );
+ vertices.SetData( &vertexData[0], numVertex );
Property::Map indexFormat;
indexFormat["indices"] = Property::INTEGER;
- PropertyBuffer indices = PropertyBuffer::New( indexFormat, numIndex );
- indices.SetData( &indexData[0] );
+ PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+ indices.SetData( &indexData[0], numIndex );
Geometry geometry = Geometry::New();
geometry.AddVertexBuffer( vertices );
Property::Map vertexFormat;
vertexFormat["aPosition"] = Property::VECTOR3;
vertexFormat["aNormal"] = Property::VECTOR3;
- PropertyBuffer surfaceVertices = PropertyBuffer::New( vertexFormat, vertices.Size() );
- surfaceVertices.SetData( &vertices[0] );
+ PropertyBuffer surfaceVertices = PropertyBuffer::New( vertexFormat );
+ surfaceVertices.SetData( &vertices[0], vertices.Size() );
Geometry surface = Geometry::New();
surface.AddVertexBuffer( surfaceVertices );
{
Property::Map textureFormat;
textureFormat["aTexCoord"] = Property::VECTOR2;
- PropertyBuffer extraVertices = PropertyBuffer::New( textureFormat, textures.Size() );
- extraVertices.SetData( &textures[0] );
+ PropertyBuffer extraVertices = PropertyBuffer::New( textureFormat );
+ extraVertices.SetData( &textures[0], textures.Size() );
surface.AddVertexBuffer( extraVertices );
}
Property::Map vertexExtFormat;
vertexExtFormat["aTangent"] = Property::VECTOR3;
vertexExtFormat["aBiNormal"] = Property::VECTOR3;
- PropertyBuffer extraVertices = PropertyBuffer::New( vertexExtFormat, verticesExt.Size() );
- extraVertices.SetData( &verticesExt[0] );
+ PropertyBuffer extraVertices = PropertyBuffer::New( vertexExtFormat );
+ extraVertices.SetData( &verticesExt[0], verticesExt.Size() );
surface.AddVertexBuffer( extraVertices );
}
//Indices
Property::Map indicesVertexFormat;
indicesVertexFormat["aIndices"] = Property::INTEGER;
- PropertyBuffer indicesToVertices = PropertyBuffer::New( indicesVertexFormat, indices.Size() );
- indicesToVertices.SetData(&indices[0]);
+ PropertyBuffer indicesToVertices = PropertyBuffer::New( indicesVertexFormat );
+ indicesToVertices.SetData( &indices[0], indices.Size() );
surface.SetIndexBuffer ( indicesToVertices );
}
Property::Map borderVertexFormat;
borderVertexFormat[POSITION_ATTRIBUTE_NAME] = Property::VECTOR2;
borderVertexFormat[DRIFT_ATTRIBUTE_NAME] = Property::VECTOR2;
- PropertyBuffer borderVertices = PropertyBuffer::New( borderVertexFormat, 16 );
- borderVertices.SetData(borderVertexData);
+ PropertyBuffer borderVertices = PropertyBuffer::New( borderVertexFormat );
+ borderVertices.SetData( borderVertexData, 16 );
// Create indices
unsigned int indexData[24] = { 1,5,2,6,3,7,7,6,11,10,15,14,14,10,13,9,12,8,8,9,4,5,0,1};
Property::Map indexFormat;
indexFormat[INDEX_NAME] = Property::INTEGER;
- PropertyBuffer indices = PropertyBuffer::New( indexFormat, 24 );
- indices.SetData(indexData);
+ PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+ indices.SetData( indexData, 24 );
// Create the geometry object
Geometry geometry = Geometry::New();
Property::Map quadVertexFormat;
quadVertexFormat[POSITION_ATTRIBUTE_NAME] = Property::VECTOR2;
- PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat, 4 );
- quadVertices.SetData(quadVertexData);
+ PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+ quadVertices.SetData( quadVertexData, 4 );
// Create indices
unsigned int indexData[10] = { 0, 1, 1, 2, 2, 3, 3, 0 };
Property::Map indexFormat;
indexFormat[INDEX_NAME] = Property::INTEGER;
- PropertyBuffer indices = PropertyBuffer::New( indexFormat, sizeof(indexData)/sizeof(indexData[0]) );
- indices.SetData(indexData);
+ PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+ indices.SetData( indexData, sizeof(indexData)/sizeof(indexData[0]) );
// Create the geometry object
Geometry geometry = Geometry::New();
{
Property::Map vertexFormat;
vertexFormat[ "aPosition" ] = Property::VECTOR2;
- PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat, vertices.Size() );
+ PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat );
if( vertices.Size() > 0 )
{
- vertexPropertyBuffer.SetData( &vertices[ 0 ] );
+ vertexPropertyBuffer.SetData( &vertices[ 0 ], vertices.Size() );
}
Property::Map indexFormat;
indexFormat[ "indices" ] = Property::INTEGER;
- PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat, indices.Size() );
+ PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat );
if( indices.Size() > 0 )
{
- indexPropertyBuffer.SetData( &indices[ 0 ] );
+ indexPropertyBuffer.SetData( &indices[ 0 ], indices.Size() );
}
// Create the geometry object
{
Property::Map vertexFormat;
vertexFormat[ "aPosition" ] = Property::VECTOR2;
- PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat, vertices.Size() );
+ PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat );
if( vertices.Size() > 0 )
{
- vertexPropertyBuffer.SetData( &vertices[ 0 ] );
+ vertexPropertyBuffer.SetData( &vertices[ 0 ], vertices.Size() );
}
Property::Map indexFormat;
indexFormat[ "indices" ] = Property::INTEGER;
- PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat, indices.Size() );
+ PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat );
if( indices.Size() > 0 )
{
- indexPropertyBuffer.SetData( &indices[ 0 ] );
+ indexPropertyBuffer.SetData( &indices[ 0 ], indices.Size() );
}
// Create the geometry object
Property::Map quadVertexFormat;
quadVertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat, 4 );
- quadVertices.SetData(quadVertexData);
+ PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+ quadVertices.SetData( quadVertexData, 4 );
// Create the geometry object
Geometry geometry = Geometry::New();
Property::Map vertexFormat;
vertexFormat["aPosition1"] = Property::VECTOR3;
vertexFormat["aPosition2"] = Property::VECTOR3;
- PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, 20u );
- vertices.SetData( vertexData );
+ PropertyBuffer vertices = PropertyBuffer::New( vertexFormat );
+ vertices.SetData( vertexData, 20u );
unsigned int indexData[30] = { 0,3,1,0,2,3,4,7,5,4,6,7,8,11,9,8,10,11,12,15,13,12,14,15,16,19,17,16,18,19};
Property::Map indexFormat;
indexFormat["indices"] = Property::INTEGER;
- PropertyBuffer indices = PropertyBuffer::New( indexFormat, 30u );
- indices.SetData( indexData );
+ PropertyBuffer indices = PropertyBuffer::New( indexFormat );
+ indices.SetData( indexData, 30u );
Geometry meshGeometry = Geometry::New();
meshGeometry.AddVertexBuffer( vertices );
indices.PushBack( v + 3 );
}
- if( mQuadVertices )
+ if( ! mQuadVertices )
{
- mQuadVertices.SetSize( vertices.Size() );
- }
- else
- {
- mQuadVertices = PropertyBuffer::New( mQuadVertexFormat, vertices.Size() );
+ mQuadVertices = PropertyBuffer::New( mQuadVertexFormat );
}
- if( mQuadIndices )
- {
- mQuadIndices.SetSize( indices.Size() );
- }
- else
+ if( ! mQuadIndices )
{
- mQuadIndices = PropertyBuffer::New( mQuadIndexFormat, indices.Size() );
+ mQuadIndices = PropertyBuffer::New( mQuadIndexFormat );
}
- mQuadVertices.SetData( &vertices[ 0 ] );
- mQuadIndices.SetData( &indices[ 0 ] );
+ mQuadVertices.SetData( &vertices[ 0 ], vertices.Size() );
+ mQuadIndices.SetData( &indices[ 0 ], indices.Size() );
if( !mQuadGeometry )
{
Actor CreateMeshActor( const MeshRecord& meshRecord, const Vector2& actorSize )
{
- PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat, meshRecord.mMesh.mVertices.Size() );
- PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat, meshRecord.mMesh.mIndices.Size() );
- quadVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &meshRecord.mMesh.mVertices[ 0 ] ) );
- quadIndices.SetData( const_cast< unsigned int* >( &meshRecord.mMesh.mIndices[ 0 ] ) );
+ PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat );
+ PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat );
+ quadVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &meshRecord.mMesh.mVertices[ 0 ] ), meshRecord.mMesh.mVertices.Size() );
+ quadIndices.SetData( const_cast< unsigned int* >( &meshRecord.mMesh.mIndices[ 0 ] ), meshRecord.mMesh.mIndices.Size() );
Geometry quadGeometry = Geometry::New();
quadGeometry.AddVertexBuffer( quadVertices );
Property::Map quadVertexFormat;
quadVertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat, 4 );
- quadVertices.SetData(quadVertexData);
+ PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+ quadVertices.SetData( quadVertexData, 4 );
// Create the geometry object
Geometry geometry = Geometry::New();
var pentagonVertexDataArray = new Float32Array(pentagonVertexData.length);
pentagonVertexDataArray.set(pentagonVertexData, 0);
- var pentagonVertices = new dali.PropertyBuffer(pentagonVertexFormat, 5);
- pentagonVertices.setData(pentagonVertexDataArray);
+ var pentagonVertices = new dali.PropertyBuffer(pentagonVertexFormat);
+ pentagonVertices.setData(pentagonVertexDataArray, 5);
var pentacleVertexFormat ={ "aPosition2" : dali.PROPERTY_VECTOR2};
var pentacleVertexDataArray = new Float32Array(pentacleVertexData.length);
pentacleVertexDataArray.set(pentacleVertexData, 0);
- var pentacleVertices = new dali.PropertyBuffer(pentacleVertexFormat, 5);
- pentacleVertices.setData(pentacleVertexDataArray);
+ var pentacleVertices = new dali.PropertyBuffer(pentacleVertexFormat);
+ pentacleVertices.setData(pentacleVertexDataArray, 5);
var indexFormat ={ "indices" : dali.PROPERTY_INTEGER };
var indexDataArray = new Uint32Array(indexData.length);
indexDataArray.set(indexData, 0);
- var indices = new dali.PropertyBuffer(indexFormat, 10);
- indices.setData(indexDataArray);
+ var indices = new dali.PropertyBuffer(indexFormat);
+ indices.setData(indexDataArray, 10);
// Create geometry
var geometry = new dali.Geometry();
var initialPositionVertexDataArray = new Float32Array(initialPositionVertexData.length);
initialPositionVertexDataArray.set(initialPositionVertexData, 0);
- var initialPositionVertices = new dali.PropertyBuffer(initialPositionVertexFormat, 27);
- initialPositionVertices.setData(initialPositionVertexDataArray);
+ var initialPositionVertices = new dali.PropertyBuffer(initialPositionVertexFormat);
+ initialPositionVertices.setData(initialPositionVertexDataArray, 27);
// Create vertex buffer for final positions
var finalPositionVertexFormat = { "aFinalPos" : dali.PROPERTY_VECTOR2 };
var finalPositionVertexDataArray = new Float32Array(finalPositionVertexData.length);
finalPositionVertexDataArray.set(finalPositionVertexData, 0);
- var finalPositionVertices = new dali.PropertyBuffer(finalPositionVertexFormat, 27);
- finalPositionVertices.setData(finalPositionVertexDataArray);
+ var finalPositionVertices = new dali.PropertyBuffer(finalPositionVertexFormat);
+ finalPositionVertices.setData(finalPositionVertexDataArray, 27);
// Create vertex buffer for color
var colorVertexFormat = { "aColor" : dali.PROPERTY_VECTOR3 };
var colorVertexDataArray = new Float32Array(colorVertexData.length);
colorVertexDataArray.set(colorVertexData, 0);
- var colorVertices = new dali.PropertyBuffer(colorVertexFormat, 27);
- colorVertices.setData(colorVertexDataArray);
+ var colorVertices = new dali.PropertyBuffer(colorVertexFormat);
+ colorVertices.setData(colorVertexDataArray, 27);
// Create geometry
var geometry = new dali.Geometry();
var polyhedraVertexDataArray = new Float32Array(polyhedraVertexData.length);
polyhedraVertexDataArray.set(polyhedraVertexData, 0);
- var polyhedraVertices = new dali.PropertyBuffer(polyhedraVertexFormat, numSides);
- polyhedraVertices.setData(polyhedraVertexDataArray);
+ var polyhedraVertices = new dali.PropertyBuffer(polyhedraVertexFormat);
+ polyhedraVertices.setData(polyhedraVertexDataArray, numSides);
// Create geometry
var geometry = new dali.Geometry();
var texturedQuadVertexDataArray = new Float32Array(texturedQuadVertexData.length);
texturedQuadVertexDataArray.set(texturedQuadVertexData, 0);
- var texturedQuadVertices = new dali.PropertyBuffer(texturedQuadVertexFormat, 4);
- texturedQuadVertices.setData(texturedQuadVertexDataArray);
+ var texturedQuadVertices = new dali.PropertyBuffer(texturedQuadVertexFormat);
+ texturedQuadVertices.setData(texturedQuadVertexDataArray, 4);
var indexFormat ={ "indices" : dali.PROPERTY_INTEGER };
var indexDataArray = new Uint32Array(indexData.length);
indexDataArray.set(indexData, 0);
- var indices = new dali.PropertyBuffer(indexFormat, 6);
- indices.setData(indexDataArray);
+ var indices = new dali.PropertyBuffer(indexFormat);
+ indices.setData(indexDataArray, 6);
// Create geometry
var geometry = new dali.Geometry();
struct PropertyBufferParameters
{
PropertyBufferParameters()
- : mSize( 0 )
{
}
PropertyBuffer NewPropertyBuffer()
{
- return PropertyBuffer::New( mBufferFormat,
- mSize);
+ return PropertyBuffer::New( mBufferFormat );
}
Property::Map mBufferFormat;
- std::size_t mSize;
};
} // unnamed space
return PropertyBuffer();
}
- found = false;
- int size = V8Utils::GetIntegerParameter( PARAMETER_1, found, isolate, args, 0);
- if( !found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "missing buffer size from param 1" );
- return PropertyBuffer();
- }
-
- return PropertyBuffer::New(bufferFormat, static_cast<std::size_t>(size));
+ return PropertyBuffer::New( bufferFormat );
}
/**
* var vertexDataArray = new Float32Array(vertexData.length);
* vertexDataArray.set(vertexData, 0);
*
- * propertyBuffer.setData( vertexDataArray );
+ * propertyBuffer.setData( vertexDataArray, vertexData.length );
*```
*/
void PropertyBufferApi::SetData( const v8::FunctionCallbackInfo< v8::Value >& args )
bool found( false );
void* data = V8Utils::GetArrayBufferViewParameter( PARAMETER_0, found, isolate, args);
- if( !found )
+
+ if( ! found )
{
DALI_SCRIPT_EXCEPTION( isolate, "invalid data parameter" );
}
else
{
- buffer.SetData( data );
+ int size = V8Utils::GetIntegerParameter( PARAMETER_1, found, isolate, args, 0);
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "missing buffer size from param 1" );
+ }
+ else
+ {
+ buffer.SetData( data, size );
+ }
}
}