2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/internal/update/rendering/scene-graph-geometry.h>
21 #include <dali/integration-api/debug.h>
22 #include <dali/internal/common/buffer-index.h>
23 #include <dali/internal/update/rendering/scene-graph-property-buffer.h>
33 : mGraphics( nullptr ),
35 mGeometryType( Dali::Geometry::TRIANGLES ),
36 mIndicesChanged(false),
37 mHasBeenUpdated(false),
38 mAttributesChanged(true)
46 void Geometry::Initialize( Integration::Graphics::Graphics& graphics )
48 mGraphics = &graphics;
51 void Geometry::AddPropertyBuffer( SceneGraph::PropertyBuffer* propertyBuffer )
53 mVertexBuffers.PushBack( propertyBuffer );
54 mAttributesChanged = true;
57 void Geometry::SetIndexBuffer( Dali::Vector<unsigned short>& indices )
59 mIndices.Swap( indices );
60 mIndicesChanged = true;
63 void Geometry::RemovePropertyBuffer( const SceneGraph::PropertyBuffer* propertyBuffer )
65 size_t bufferCount = mVertexBuffers.Size();
66 for( size_t i(0); i<bufferCount; ++i )
68 if( propertyBuffer == mVertexBuffers[i] )
70 //This will delete the gpu buffer associated to the RenderPropertyBuffer if there is one
71 mVertexBuffers.Remove( mVertexBuffers.Begin()+i );
72 mAttributesChanged = true;
78 } // namespace SceneGraph
79 } // namespace Internal