1 /***************************************************************************
3 * Copyright 2010,2011 BMW Car IT GmbH
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 ****************************************************************************/
23 #include "Layermanager.h"
24 #include "CommandList.h"
25 #include "ShaderMap.h"
26 #include "LayerGroup.h"
27 #include "LayerGroupMap.h"
28 #include "SurfaceGroup.h"
29 #include "SurfaceGroupMap.h"
30 #include "SurfaceMap.h"
32 #include "ShaderMap.h"
33 #include "LayerList.h"
40 * Represents a list of Layers which contain the Surfaces.
42 class Scene: public IScene
44 // TODO: these should use public interface instead
45 friend class Layermanager;
46 friend class CommitCommand;
47 friend class CreateShaderCommand;
48 friend class DestroyShaderCommand;
49 friend class SetShaderCommand;
50 friend class SetUniformsCommand;
56 virtual Layer* createLayer(const uint id);
57 virtual Surface *createSurface(const uint id);
58 virtual LayerGroup *createLayerGroup(const uint id);
59 virtual SurfaceGroup *createSurfaceGroup(const uint id);
61 virtual void removeLayer(Layer* layer);
62 virtual void removeSurface(Surface* surface);
63 virtual Layer* getLayer(const uint id) const;
64 virtual Surface* getSurface(const uint id) const;
65 virtual SurfaceGroup* getSurfaceGroup(const uint id) const;
66 virtual LayerGroup* getLayerGroup(const uint id) const;
68 virtual void getLayerIDs(uint* length, uint** array) const;
69 virtual bool getLayerIDsOfScreen(const uint screenID, uint* length, uint** array) const;
70 virtual void getSurfaceGroupIDs(uint* length, uint** array) const;
71 virtual void getLayerGroupIDs(uint* length, uint** array) const;
72 virtual void getSurfaceIDs(uint* length, uint** array) const;
74 virtual void lockScene();
75 virtual void unlockScene();
78 // TODO: should be private -> not in ILayerList; clients should use only the interface
79 LayerList& getCurrentRenderOrder();
80 void removeSurfaceGroup(SurfaceGroup *surface);
81 void removeLayerGroup(LayerGroup *layer);
82 const SurfaceMap getAllSurfaces() const;
85 const LayerMap getAllLayers() const;
86 void removeLayerFromAllLayerGroups(Layer* layer);
87 void removeSurfaceFromAllLayers(Surface* surface);
88 void removeSurfaceFromAllSurfaceGroups(Surface* surface);
91 CommandList m_toBeCommittedList;
92 ShaderMap m_shaderMap;
93 pthread_mutex_t m_layerListMutex;
94 LayerGroupMap m_layerGroupMap;
95 SurfaceGroupMap m_surfaceGroupMap;
96 SurfaceMap m_surfaceMap;
98 LayerList m_currentRenderOrder;
101 inline const LayerMap Scene::getAllLayers() const
106 inline LayerList& Scene::getCurrentRenderOrder() // TODO: const
108 return m_currentRenderOrder;
111 inline const SurfaceMap Scene::getAllSurfaces() const
116 inline void Scene::lockScene()
118 pthread_mutex_lock(&m_layerListMutex);
121 inline void Scene::unlockScene()
123 pthread_mutex_unlock(&m_layerListMutex);
126 #endif /* _SCENE_H_ */