Skip to content

Commit

Permalink
Docs: add DotScene to Manual
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Sep 8, 2022
1 parent 48cf6f1 commit 2b568fa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 29 deletions.
1 change: 1 addition & 0 deletions .codedocs
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ INPUT = OgreMain/include \
Components/Volume/include \
PlugIns \
PlugIns/PCZSceneManager/docs/readme.md \
PlugIns/DotScene/README.md \
RenderSystems \
Docs/src/apimainpage.md \
Docs/src/manual.md \
Expand Down
1 change: 1 addition & 0 deletions Docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ if(DOXYGEN_FOUND)
${COMPONENTS}
${PLUGINS}
${PROJECT_SOURCE_DIR}/PlugIns/PCZSceneManager/docs/readme.md
${PROJECT_SOURCE_DIR}/PlugIns/DotScene/README.md
${PROJECT_SOURCE_DIR}/RenderSystems
${BASIC_TUTORIALS}
${PROJECT_SOURCE_DIR}/Docs/src/apimainpage.md
Expand Down
1 change: 1 addition & 0 deletions Docs/src/tutorials/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- @subpage trays
- @subpage volume
- @subpage meshlod-generator
- @subpage dotscene_overview
- In Depth
- @subpage manual-mesh-creation
- @subpage tut_StaticGeom
Expand Down
39 changes: 10 additions & 29 deletions PlugIns/DotScene/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
# DotScene Overview
# DotScene Overview {#dotscene_overview}

DotScene (aka .scene) is just a standardized XML file format.

This file format is meant to be used to set up a scene or scene-part. It is useful for any type of application/ game. Editors can export to .scene format, and apps can load the format.

Besides Ogre, the [jMonkeyEngine](http://jmonkeyengine.org/) also supports loading .scene files.

## Index
- [What is DotScene?](#what-is-dotscene?)
- [User Data](#user-data)
- [How to use DotScene](#how-to-use-dotscene)
- [Instancing](#instancing)
- [Static Geometry](#static-geometry)
- [Instancie Manager](#instancie-manager)
@tableofcontents

## What is DotScene?
DotScene file does not contain any mesh data, texture data, etc. It just contains elements that describe a scene.
Expand Down Expand Up @@ -54,6 +48,7 @@ To add logic properties to the scene you can use the `<userData>` node as follow

On the C++ side, these are acessible via e.g.
```cpp
Ogre::SceneManager* mSceneMgr = ...;
mSceneMgr->getEntity("Cube")->getUserObjectBindings().getUserAny("mass");
```
Expand All @@ -67,10 +62,10 @@ Plugin=Plugin_DotScene

The Plugin will be then automatically used when you call `SceneNode::loadChildren()` like
```cpp
SceneNode* attachmentNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
Ogre::SceneNode* attachmentNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();

// Set the desired resource group first and then load the Scene
ResourceGroupManager::getSingleton().setWorldResourceGroupName("MyGroup");
Ogre::ResourceGroupManager::getSingleton().setWorldResourceGroupName("MyGroup");
attachmentNode->loadChildren("myScene.scene");
```
Expand All @@ -81,7 +76,10 @@ attachmentNode->getUserObjectBindings().getUserAny("TerrainGroup");
The type is `std::shared_ptr<Ogre::TerrainGroup>`, hence `attachmentNode` owns it and will take it down on destruction.

## Instancing
The DotScene Plugin can process the static / instanced attributes of the Entity definition to add them to the scene as either [Static Geometry](https://ogrecave.github.io/ogre/api/latest/class_ogre_1_1_static_geometry.html) or [Instanced meshes](https://ogrecave.github.io/ogre/api/latest/class_ogre_1_1_instance_manager.html).
The DotScene Plugin can process the static / instanced attributes of the Entity definition to add them to the scene as either Static Geometry or Instanced meshes.

@see @ref WhatIsInstancing
@see @ref tut_StaticGeom

### Static Geometry
If your scene has entities with the *static* property then the name referenced by the property is interpreted by the plugin as the name of the Static Geometry Group
Expand All @@ -94,13 +92,9 @@ The plugin requires that the Static Geometry group or instance is created before
Continuing with the example above, supose you created a scene with entities belonging to the "Foliage" group.

```cpp
SceneNode* attachmentNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();

// Create the StaticGeometry
Ogre::StaticGeometry* sg = mSceneMgr->createStaticGeometry("Foliage");

// Set the desired resource group first and then load the Scene
ResourceGroupManager::getSingleton().setWorldResourceGroupName("MyGroup");
attachmentNode->loadChildren("myScene.scene");

// Build the StaticGeometry after loading the Scene
Expand All @@ -109,11 +103,6 @@ sg->build();
Any configuration for the StaticGeometry should be done before the `build()` call.
Please consult the documentation to know more about StaticGeometry and its use:
- [Ogre::StaticGeometry Class Reference](https://ogrecave.github.io/ogre/api/latest/class_ogre_1_1_static_geometry.html)
- [Tutorial - Static Geometry](https://ogrecave.github.io/ogre/api/latest/tut__static_geom.html)
### Instance Manager
If your scene has entities with the *instanced* property then the name referenced by the property is interpreted by the plugin as the name of the Instance Manager
For example:
Expand All @@ -124,21 +113,13 @@ For example:
The plugin requires that the Instance Manager is created before loading the Scene.
Continuing with the example above, supose you created a scene with entities that you want to create with the "Foliage" Instance Manager.

> **NOTE:** Be aware that only the first submesh of the mesh is taken into account, if you have an Entity with many submeshes only the first one will be shown.
@note Be aware that only the first submesh of the mesh is taken into account, if you have an Entity with many submeshes only the first one will be shown.

```cpp
SceneNode* attachmentNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();

// Create the InstanceManager
Ogre::InstanceManager* im = mSceneMgr->createInstanceManager("Foliage", "Cube.mesh", "MyGroup", Ogre::InstanceManager::ShaderBased, 80, Ogre::IM_USEALL);

// Set the desired resource group first and then load the Scene
ResourceGroupManager::getSingleton().setWorldResourceGroupName("MyGroup");
attachmentNode->loadChildren("myScene.scene");
```
Any configuration for the InstanceManager should be done before calling `loadChildren()`
Please consult the documentation to know more about Instancing and its use:
- [Ogre::InstanceManager Class Reference](https://ogrecave.github.io/ogre/api/latest/class_ogre_1_1_instance_manager.html)
- [What is instancing?](https://ogrecave.github.io/ogre/api/latest/instancing.html)

0 comments on commit 2b568fa

Please sign in to comment.