CC3PerformanceScene Class Reference
Inherits from | CC3Scene : CC3Node : CC3Identifiable : NSObject |
Declared in | CC3PerformanceScene.h |
Overview
This application-specific CC3Scene provides a platform for testing and displaying various performance-related aspects of Cocos3D.
The user can select one of various node types, and determine how many copies of that node should be added to the 3D scene. Those copies are laid out in a square grid within the scene. This app then collects various statistics about the performance of the 3D scene. The customized CC3Layer can then extract these statistics and display them in real-time.
The user can also select whether the nodes in the scene are animated or not. Animating the nodes adds load because the globalTransformMatrix of each node must be updated during each update.
The statistics that are collected are available automatically in any Cocos3D application. You can collect performance statistics on your own application by setting and managing an instance of CC3PerformanceStatistics or one of its subclasses.
Interestingly, you can easily compare the performance cost of the GL drawing activity, relative to the overhead of the Cocos3D framework. To do so, uncomment the first line in the implementation of the initializeScene method of this class. See the inline comments above that first line within the initializeScene method to understand how this works.
Tasks
-
availableTemplateNodes
property -
playerDirectionControl
property -
playerLocationControl
property -
templateNode
property -
perSideCount
property -
shouldAnimateNodes
property -
– increaseNodes
-
– decreaseNodes
-
– nextNodeType
-
– prevNodeType
Properties
perSideCount
The number of nodes that are laid out per side on the square grid of nodes. The total number of copies of the template node that are added to the scene is therefore (perSideCount * perSideCount).
@property (nonatomic, assign) uint perSideCount
Declared In
CC3PerformanceScene.h
playerDirectionControl
This property controls the velocity of the change in direction of the 3D camera (a proxy for the player). This property is set by the CC3Layer, from the velocity of the corresponding joystick control.
@property (nonatomic, assign) CGPoint playerDirectionControl
Declared In
CC3PerformanceScene.h
playerLocationControl
This property controls the velocity of the change in location of the 3D camera (a proxy for the player). This property is set by the CC3Layer, from the velocity of the corresponding joystick control.
@property (nonatomic, assign) CGPoint playerLocationControl
Declared In
CC3PerformanceScene.h
shouldAnimateNodes
Indicates whether the node copies should be animated.
@property (nonatomic, assign) BOOL shouldAnimateNodes
Discussion
Animating adds load the the CPU because the globalTransformMatrix of each node must be updated during each update pass.
Animation of the nodes is performed by using a specialized CC3NodeUpdatingVisitor that animates each node in a pseudo-random manner.
Declared In
CC3PerformanceScene.h
Instance Methods
decreaseNodes
Decreases the number of nodes being displayed.
- (void)decreaseNodes
Declared In
CC3PerformanceScene.h
increaseNodes
Increases the number of nodes being displayed.
- (void)increaseNodes
Declared In
CC3PerformanceScene.h