# Candera Base

#### Camera Groups

[CameraGroup](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_camera_group.html) is a container that groups cameras from multiple scenes. [CameraGroup](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_camera_group.html) has an arbitrary number of 2D and/or 3D cameras from different scenes and it is used by applications to easily access and change camera settings uniformly, e.g. in transitions.

<div class="contents" id="bkmrk-see-also%3A-texture-re"><div class="contents"><div class="textblock"><dl class="see"><dt>**See also:**</dt><dd><span style="color: rgb(230, 126, 35);">[Texture Render Targets](https://doc316en.candera.eu/link/539#bkmrk-page-title)</span></dd></dl>---

</div></div></div>#### Unified Cloning Interface

Base classes implement a virtual "Clone() const" method, which is overridden in all children. "Clone() const" builds a new instance of the class using the copy constructor. Copy constructors are protected for use only in derived copy constructors. Copying via assignment operator is prohibited, as it could cause problems, like orphaned nodes, memory leaks or dangling pointers. Assignment operators are thus private.

Cloning is shallow, with only shared pointers and constant character pointers being copied. All other coupling via pointers is broken for the clones.

For more complex cloning see <span style="color: rgb(230, 126, 35);">[Tree Cloner](https://doc316en.candera.eu/link/977#bkmrk-tree-cloner)</span> and <span style="color: rgb(230, 126, 35);">[Tree Cloning Strategies](https://doc316en.candera.eu/link/977#bkmrk-tree-cloning-strateg)</span>.

##### Tree Cloner

[TreeClonerBase](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_tree_cloner_base.html "This class clones scene subtrees.") is provided for cloning trees. The default clone strategy is to call the Clone interface on each node, and build the clone tree with the same node pattern as the original tree. For deeper cloning, [TreeClonerBase](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_tree_cloner_base.html "This class clones scene subtrees.") supports attaching a [TreeCloneStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_tree_clone_strategy.html "This is an interface for strategies used during cloning by TreeCloner."). This [TreeCloneStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_tree_clone_strategy.html "This is an interface for strategies used during cloning by TreeCloner.") is typically aware of different types of nodes, and delegates to other strategies.

##### Tree Cloning Strategies

The deep cloning strategies respect the following rules:

<div class="contents" id="bkmrk-all-shared-resources"><div class="contents"><div class="textblock">- all shared resources are deep cloned as long as they are not device objects; shared resources in the destination are shared in the same pattern as in the source tree.
- node references are rebuilt as long as source references are found as descendants of the source root; descendants are mapped to the destination tree.
- strategies are designed to support the decorator pattern.
- general strategies delegate to more specific strategies.

---

</div></div></div>#### Bitmap as SharedPointer

Instances of class [Bitmap](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap.html "A 2-dimensional bitmap that can be used as a texture, background or sprite. A bitmap pointing to a va...") can only be created by calling static method [Bitmap::Create()](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap.html#a53c1f585b24819ae815fbeb54820fe23) which returns a SharedPointer.

All interfaces have been changed to pass the shared pointer and the corresponding disposer function has been removed from the interfaces.

Old interface (example):

```
void <a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap_image2_d.html#a08c2f33716d31ff5de24c14cdd0a7550">BitmapImage2D::SetBitmap</a>(Bitmap* bitmap, BitmapDisposerFn disposerFn);
```

New interface (example):

```
void <a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap_image2_d.html#a08c2f33716d31ff5de24c14cdd0a7550">BitmapImage2D::SetBitmap</a>(Bitmap::SharedPointer bitmap);
```

<div class="contents" id="bkmrk-"><div class="contents"><div class="textblock"><div class="fragment">  
</div>---

</div></div></div>#### Changes in Bitmap Enumerations

Until now, [Bitmap](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap.html "A 2-dimensional bitmap that can be used as a texture, background or sprite. A bitmap pointing to a va...") class described the organization of the pixels with the enumerators Bitmap::Format and Bitmap::Type.

With introducing <span style="color: rgb(230, 126, 35);">[OpenGL ES 3.0 ETC2/EAC Texture Compression](https://doc316en.candera.eu/link/975#bkmrk-opengl-es-3.0-etc2%2Fe)</span>, it came up that the bitmap description was not suitable for describing compressed images (which have a format descriptor, but no type descriptor). Another problem was that the [Bitmap](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap.html "A 2-dimensional bitmap that can be used as a texture, background or sprite. A bitmap pointing to a va...") class allowed invalid combinations of Format and Type, e.g. Bitmap::Format::RgbFormat (3 components) and UnsignedShort4444Type (4 components).

In order to enable compressed bitmaps and to avoid invalid combinations the enumerator [Bitmap::PixelFormat](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap.html#a0028006b9fd5b6e630bc6aca572603cb) has been introduced, here Format and Type have been merged to valid enumeration items, while the ETC2/EAC items have been added.

For this reason Bitmap::Format and Bitmap::Type have become deprecated. Of course it is still possible to use custom formats.

<div class="contents" id="bkmrk--0"><div class="contents"><div class="textblock">---

</div></div></div>#### Shared Pointer Concept in Animation Framework

Objects of the following classes can only be created by calling static method [Create()](http://dev.doc.cgistudio.at/APILINK/group___c_o_u_r_i_e_r___v_i_s_u_a_l_i_z_a_t_i_o_n.html#ggaf0e93dc4242f607c3c8d13dafd036af9aaabfa5309af24986d3111a092449f857) which returns a SharedPointer:

<div class="contents" id="bkmrk-animationcontroller-"><div class="contents"><div class="textblock">- AnimationController
- AnimationTimeDispatcher
- AbstractEasingFunction (and all derived classes)
- InterpolationStrategy (and all derived classes)
- AnimationPropertySetter (and all derived classes)

</div></div></div>All interfaces have been changed to pass the shared pointer and the corresponding disposer function has been removed from the interfaces.

Old interface (example):

```
void AnimationPlayer::SetController(AnimationController* controller, DisposerFn disposerFn = 0);
```

New interface (example):

```
void AnimationPlayer::SetController(AnimationController::SharedPointer controller);
```

<div class="contents" id="bkmrk--1"><div class="contents"><div class="textblock"><div class="fragment">  
</div>---

</div></div></div>#### TreeTraverserBase for 'const' Traversing

Interface of template class [TreeTraverserBase](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_tree_traverser_base.html "Traverses a Node tree depth-first. What is done at each node is customized in the ProcessNode virtual...") has been changed to use only Traverse() and ProcessNode(). TraverseConst() and ProcessConstNode() have been removed. This ensures type safe const correct usage but enforce all const-traverser implementations to be changed. Const traversers have to be defined the following way:

```
class MyTraverser : public TreeTraverserBase<const Node> {
    protected:
        virtual TraverserAction ProcessNode(const Node& node)
        {
        ...
        }
};
```

<div class="contents" id="bkmrk--2"><div class="contents"><div class="textblock"><div class="fragment">  
</div>---

</div></div></div>#### Candera::Animation Namespace extension

Classes and Types located in `<cgi_studio_candera>/src/Candera/EngineBase/Animation` which formerly belonged to the *[Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]")* namespace were reassigned to the Candera::Animation namespace.

Affected classes/types:

<div class="contents" id="bkmrk-abstracteasingfuncti"><div class="contents"><div class="textblock">- [AbstractEasingFunction](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_abstract_easing_function.html)
- [AnimationBlendedProperty](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_blended_property.html)
- [AnimationController](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_controller.html)
- [AnimationGroupPlayer](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_group_player.html)
- [AnimationKeyframeSequence](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_keyframe_sequence.html)
- [AnimationPlayer](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_player.html)
- [AnimationPlayerBase](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_player_base.html)
- [AnimationPlayerListener](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_player_listener.html)
- [AnimationPropertySetter](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_property_setter.html)
- [AnimationTimeDispatcher](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_time_dispatcher.html)
- WorldTimeType
- SequenceTimeType
- [BackEaseFunction](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_back_ease_function.html)
- [BezierInterpolationStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_bezier_interpolation_strategy.html)
- [BounceEaseFunction](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_bounce_ease_function.html)
- [EaseInterpolationStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_ease_interpolation_strategy.html)
- [ElasticEaseFunction](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_elastic_ease_function.html)
- [ExponentialEaseFunction](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_exponential_ease_function.html)
- [InterpolationStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_interpolation_strategy.html)
- [KeyframeSequence](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_keyframe_sequence.html)
- [LinearInterpolationStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_linear_interpolation_strategy.html)
- [PowerEaseFunction](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_power_ease_function.html)
- [SplineInterpolationStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_spline_interpolation_strategy.html)
- [StepInterpolationStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_step_interpolation_strategy.html)

</div></div></div><dl class="note" id="bkmrk-moved-classes-and-ty"><dd><p class="callout info">Moved classes and types are still accessible via the *[Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]")* namespace in CGI-Studio 3.0.0 but these deprecated interfaces will be removed in the next release.</p>

</dd></dl><div class="contents" id="bkmrk--3"><div class="contents"><div class="textblock">---

</div></div></div>#### CanderaObject becomes DynamicPropertyHost

[CanderaObject](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_candera_object.html "Represents the base class for Candera objects related to 3D rendering. Every CanderaObject can have a...") inherits from DynamicPropertyHost. Objects previously inheriting from DynamicPropertyHost now inherit from [CanderaObject](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_candera_object.html "Represents the base class for Candera objects related to 3D rendering. Every CanderaObject can have a..."). [ApplicationData](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_application_data.html "This class supports to attach custom ApplicationData to any CanderaObject. This is possible by creati...") is deprecated. The DynamicPropertyHost allows to attach multiple application data objects.

---