Public Member Functions | Static Public Member Functions | Properties

CC3ResourceNode Class Reference

A CC3ResourceNode is a CC3Node that that wraps an instance of a subclass of CC3Resource in the resource property, extracts the nodes from that resource, and forms the root of the resulting node structural assembly. More...

#import <CC3ResourceNode.h>

Inheritance diagram for CC3ResourceNode:
Inheritance graph
[legend]
Collaboration diagram for CC3ResourceNode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

(id) - initFromFile:
(id) - initFromResourceFile:
(id) - initWithName:fromFile:
(id) - initWithName:fromResourceFile:
(void) - loadFromFile:
(void) - loadFromResourceFile:
(Class) - resourceClass

Static Public Member Functions

(id) + nodeFromFile:
(id) + nodeFromResourceFile:
(id) + nodeWithName:fromFile:
(id) + nodeWithName:fromResourceFile:

Properties

CC3Resourceresource

Detailed Description

A CC3ResourceNode is a CC3Node that that wraps an instance of a subclass of CC3Resource in the resource property, extracts the nodes from that resource, and forms the root of the resulting node structural assembly.

All that is needed is to set the resource property to an instance of a subclass of CC3Resource. Once the resource property has been set, this node can simply be added to a CC3World as a child node. Since the node structural assembly is hierarchical, adding this node to the CC3World will automatically add all the nodes extracted from the 3D data file.

There are several ways to instantiate an instance of CC3ResourceNode. The simplest way is to simply use the inherited node class method. Once instantiated, the resource property can be set.

There are also several class and instance initialization methods that will load directly from a file and set the resource property from that file. To make use of these methods, this class must be subclassed, and the subclass must override the resourceClass method to indicate witch resource type is to be loaded.

When a copy is made of a CC3ResourceNode instance, a copy is not made of the encapsulated CC3Resource instance. Instead, the CC3Resource is retained by reference and shared between both the original CC3ResourceNode, and the new copy.


Member Function Documentation

- (id) initFromFile: (NSString *)  aFilepath

Initializes this instance, loads the file at the specified path, which must be an absolute path, into an instance of the subclass of CC3Resource specified by the resourceClass method, and sets the resource property to that CC3Resource subclass instance.

The name of this node will be set to that of the resource.

To make use of this method, create a subclass that overrides resourceClass.

- (id) initFromResourceFile: (NSString *)  aRezPath

Initializes this instance, loads the file at the specified resource path into an instance of the subclass of CC3Resource specified by the resourceClass method, and sets the resource property to that CC3Resource subclass instance.

The specified file path is a path relative to the resource directory. Typically this means that the specified path can just be the name of the file, with no path information.

The name of this node will be set to that of the resource.

To make use of this method, create a subclass that overrides resourceClass.

- (id) initWithName: (NSString *)  aName
fromFile: (NSString *)  aFilepath 

Initializes this instance, loads the file at the specified path, which must be an absolute path, into an instance of the subclass of CC3Resource specified by the resourceClass method, and sets the resource property to that CC3Resource subclass instance.

The name of this node will be set to the specified name.

To make use of this method, create a subclass that overrides resourceClass.

- (id) initWithName: (NSString *)  aName
fromResourceFile: (NSString *)  aRezPath 

Initializes this instance, loads the file at the specified resource path into an instance of the subclass of CC3Resource specified by the resourceClass method, and sets the resource property to that CC3Resource subclass instance.

The specified file path is a path relative to the resource directory. Typically this means that the specified path can just be the name of the file, with no path information.

The name of this node will be set to the specified name.

To make use of this method, create a subclass that overrides resourceClass.

- (void) loadFromFile: (NSString *)  aFilepath

Loads the file at the specified path, which must be an absolute path, into an instance of the subclass of CC3Resource specified by the resourceClass method, and sets the resource property to that CC3Resource subclass instance.

If this node has not yet been assigned a name, it will be set to the name of the loaded resource.

To make use of this method, create a subclass that overrides resourceClass.

- (void) loadFromResourceFile: (NSString *)  aRezPath

Loads the file at the specified resource path into an instance of the subclass of CC3Resource specified by the resourceClass method, and sets the resource property to that CC3Resource subclass instance.

The specified file path is a path relative to the resource directory. Typically this means that the specified path can just be the name of the file, with no path information.

If this node has not yet been assigned a name, it will be set to the name of the loaded resource.

To make use of this method, create a subclass that overrides resourceClass.

+ (id) nodeFromFile: (NSString *)  aFilepath

Allocates and initializes an autoreleased instance, loads the file at the specified path, which must be an absolute path, into an instance of the subclass of CC3Resource specified by the resourceClass method, and sets the resource property to that CC3Resource subclass instance.

The name of this node will be set to that of the resource.

To make use of this method, create a subclass that overrides resourceClass.

+ (id) nodeFromResourceFile: (NSString *)  aRezPath

Allocates and initializes an autoreleased instance, loads the file at the specified resource path into an instance of the subclass of CC3Resource specified by the resourceClass method, and sets the resource property to that CC3Resource subclass instance.

The specified file path is a path relative to the resource directory. Typically this means that the specified path can just be the name of the file, with no path information.

The name of this node will be set to that of the resource.

To make use of this method, create a subclass that overrides resourceClass.

+ (id) nodeWithName: (NSString *)  aName
fromFile: (NSString *)  aFilepath 

Allocates and initializes an autoreleased instance, loads the file at the specified path, which must be an absolute path, into an instance of the subclass of CC3Resource specified by the resourceClass method, and sets the resource property to that CC3Resource subclass instance.

The name of this node will be set to the specified name.

To make use of this method, create a subclass that overrides resourceClass.

+ (id) nodeWithName: (NSString *)  aName
fromResourceFile: (NSString *)  aRezPath 

Allocates and initializes an autoreleased instance, loads the file at the specified resource path into an instance of the subclass of CC3Resource specified by the resourceClass method, and sets the resource property to that CC3Resource subclass instance.

The specified file path is a path relative to the resource directory. Typically this means that the specified path can just be the name of the file, with no path information.

The name of this node will be set to the specified name.

To make use of this method, create a subclass that overrides resourceClass.

- (Class) resourceClass

Returns the class of the CC3Resource instance used to load 3D data files.

This returned value is used by the initializers that load the file, and must be overridden in a sublcass if those initializers are to be used.

Default implementation triggers and assertion and returns CC3Resource. Subclasses must override.


Property Documentation

- (CC3Resource *) resource [read, write, retain]

The underlying CC3Resource instance containing the 3D nodes.

Setting this property will remove all child nodes of this CC3ResourceNode and replace them with the nodes extracted from the nodes property of the new CC3Resource instance.

If this node has not yet been assigned a name, it will be set to the name of the resource when this property is set.

When setting this property to a resource, the resource should already be loaded before setting this property.


The documentation for this class was generated from the following file: