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>
34 mGeometryType( Dali::Geometry::TRIANGLES ),
35 mIndicesChanged(false),
36 mHasBeenUpdated(false),
37 mAttributesChanged(true)
45 void Geometry::Initialize( Integration::Graphics::Graphics& graphics )
47 mGraphics = &graphics;
50 void Geometry::AddPropertyBuffer( SceneGraph::PropertyBuffer* propertyBuffer )
52 mVertexBuffers.PushBack( propertyBuffer );
53 mAttributesChanged = true;
56 void Geometry::SetIndexBuffer( Dali::Vector<unsigned short>& indices )
58 mIndices.Swap( indices );
59 mIndicesChanged = true;
62 void Geometry::RemovePropertyBuffer( const SceneGraph::PropertyBuffer* propertyBuffer )
64 size_t bufferCount = mVertexBuffers.Size();
65 for( size_t i(0); i<bufferCount; ++i )
67 if( propertyBuffer == mVertexBuffers[i] )
69 //This will delete the gpu buffer associated to the RenderPropertyBuffer if there is one
70 mVertexBuffers.Remove( mVertexBuffers.Begin()+i );
71 mAttributesChanged = true;
77 } // namespace SceneGraph
78 } // namespace Internal