Public Member Functions | Static Public Member Functions | Properties

CC3Resource Class Reference

CC3Resource is a wrapper class around a resource structure loaded from a data file containing 3D resources. More...

#import <CC3Resource.h>

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

List of all members.

Public Member Functions

(id) - initFromFile:
(id) - initFromResourceFile:
(BOOL) - loadFromFile:
(BOOL) - loadFromResourceFile:

Static Public Member Functions

(id) + resource
(id) + resourceFromFile:
(id) + resourceFromResourceFile:

Properties

NSMutableArray * nodes

Detailed Description

CC3Resource is a wrapper class around a resource structure loaded from a data file containing 3D resources.

It handles loading object data from files, and creating CC3Nodes from that data.

This is an abstract class. Specific subclasses will load files of specific types.

Of the methods defined in this class, subclasses must override the primitive template method loadFromFile:. Other methods defined by this class have been implemented using this primitive method. As a result, subclasses do not need to override any of the other methods defined by this class.

Access to 3D data objects loaded from the file is through the nodes property, which contains the root nodes of a structural 3D node assembly constructed from the 3D data loaded from the file. Subclasses should ensure that the nodes array property is fully populated upon successful completion of the loadFromFile: method.

Subclasses should ensure that the loadFromFile: method sets the name property of this instance to the name of the file, and returns whether the file was successfully loaded.


Member Function Documentation

- (id) initFromFile: (NSString *)  aFilepath

Initializes this instance and populates the internal data structures from the file at the specified path, which must be an absolute path, and extracts the nodes from the data.

This method will return nil if the file could not be loaded.

- (id) initFromResourceFile: (NSString *)  aRezPath

Initializes this instance and populates the internal data structures from the file at the specified resource path, and extracts the nodes from the data.

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.

This method will return nil if the file could not be loaded.

- (BOOL) loadFromFile: (NSString *)  aFilepath

Populates the internal data structures from the file at the specified path, which must be an absolute path, extracts the nodes from the data, and returns whether the loading was successful.

This is a template method. Default behaviour is simply to return NO. Subclasses must override this method to perform the actual file loading, parsing, and node extraction. Once this method has been successfully invoked, the application may immediately access the nodes property.

Subclasses should also set the name property to that of the file.

- (BOOL) loadFromResourceFile: (NSString *)  aRezPath

Populates the internal data structures from the file at the specified resource path, extracts the nodes from the data, and returns whether the loading was successful.

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.

+ (id) resource

Allocates and initializes an autoreleased instance, without loading a file.

The file can be loaded later using the loadFromFile: method.

Use this method if you want to perform initialization activities prior to file loading.

+ (id) resourceFromFile: (NSString *)  aFilepath

Allocates and initializes an autoreleased instance, and populates the internal data structures from the file at the specified path, which must be an absolute path, and extracts the nodes from the data.

This method will return nil if the file could not be loaded.

+ (id) resourceFromResourceFile: (NSString *)  aRezPath

Allocates and initializes an autoreleased instance, populates the internal data structures from the file at the specified resource path, and extracts the nodes from the data.

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.

This method will return nil if the file could not be loaded.


Property Documentation

- (NSMutableArray *) nodes [read, assign]

A collection of the root nodes of the node assembly extracted from the file.

Each of these nodes will usually contain child nodes.


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