SDLPP: add option to specify background objects in scene and move Z index of objects just above those background objects
This commit is contained in:
@@ -69,6 +69,9 @@ void Scene::moveZTop( const std::shared_ptr< RenderObject > &obj ) {
|
||||
void Scene::moveZBottom( const std::shared_ptr< RenderObject > &obj ) {
|
||||
setZIndex( obj, 0 );
|
||||
}
|
||||
void Scene::moveZJustAboveBackground( const std::shared_ptr< RenderObject > &obj ) {
|
||||
setZIndex( obj, first_non_background_index );
|
||||
}
|
||||
std::shared_ptr< RenderObject > Scene::getObject( int index ) {
|
||||
return render_objects[index];
|
||||
}
|
||||
@@ -231,6 +234,19 @@ void Scene::resetScene() {
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::setBackgroundObjectIDs(const std::unordered_set<uint64_t> &ids) {
|
||||
background_ids = ids;
|
||||
}
|
||||
void Scene::updateBackgroundObjectZIndex() {
|
||||
first_non_background_index = 1;
|
||||
for(uint64_t i = 1; i < render_objects.size(); i++) {
|
||||
if(background_ids.find(render_objects[i]->getId()) != background_ids.end()) {
|
||||
setZIndex(render_objects[i], 1);
|
||||
first_non_background_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::checkKilled() {
|
||||
std::lock_guard< std::mutex > lock( render_mutex );
|
||||
std::vector< int > killed;
|
||||
|
||||
Reference in New Issue
Block a user