#import <CC3ResourceNode.h>
Class Methods | |
(id) | + nodeFromFile: |
(id) | + nodeFromFile:expectsVerticallyFlippedTextures: |
(id) | + nodeFromResourceFile: |
(id) | + nodeWithName:fromFile: |
(id) | + nodeWithName:fromResourceFile: |
Class Methods inherited from CC3Node | |
(GLfloat) | + __deprecated |
(CGFloat) | + descriptorFontSize |
(ccColor4F) | + directionMarkerColor |
(id) | + node |
(id) | + nodeAtIndex:fromPODResource: |
(id) | + nodeWithName: |
(id) | + nodeWithTag: |
(id) | + nodeWithTag:withName: |
(void) | + setDefaultScaleTolerance: |
(void) | + setDescriptorFontSize: |
(void) | + setDirectionMarkerColor: |
(void) | + setWireframeBoxColor: |
(ccColor4F) | + wireframeBoxColor |
Class Methods inherited from CC3Identifiable | |
(GLint) | + instanceCount |
(void) | + resetTagAllocation |
A CC3ResourceNode is a CC3Node that that can be populated from a CC3NodesResource, and forms the root of the node structural assembly loaded from a resource file.
This is an abstract class, and subclasses are specialized for loading different types of resource files.
A subclass instance can be populated in one of several ways:
Under iOS, a texture whose width and height are not each a power-of-two, will be converted to a size whose width and height are a power-of-two. The result is a texture that can have empty space on the top and right sides. If the texture coordinates of the mesh do not take this into consideration, the result will be that only the lower left of the mesh will be covered by the texture.
In addition, the vertical axis of the coordinate system of OpenGL is inverted relative to the iOS view coordinate system. This results in textures being displayed upside-down, relative to the OpenGL coordinate system.
The CC3NodesResource that actually loads the file content will automatically adjust the meshes to compensate for this. Meshes loaded by this resource loader will have their texture coordinates adjusted to align with the usable area of an NPOT texture, and to vertically flip a texture that has been loaded upside-down.
To determine whether textures will need to be vertically flipped, the loader needs to know whether or not the meshes have already been flipped (by the 3D editor or file exporter). The initialization and loading methods have an option to pass an indication of whether the texture coordinates have already been flipped.
- (id) initFromFile: | (NSString *) | aFilepath |
Initializes this instance, loads the file at the specified file path, extracts the loaded CC3Nodes from the resource, and adds them as child nodes to this resource node.
The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.
This method invokes the loadFromFile: method to load the file.
The name of this node will be set to that of the resource, which is usually the name of the file loaded.
- (id) initFromFile: | (NSString *) | aFilepath | |
expectsVerticallyFlippedTextures: | (BOOL) | flipped | |
Initializes this instance, loads the file at the specified file path, extracts the loaded CC3Nodes from the resource, and adds them as child nodes to this resource node.
The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.
This method invokes the loadFromFile:expectsVerticallyFlippedTextures: method to load the file.
The name of this node will be set to that of the resource, which is usually the name of the file loaded.
- (id) initFromResourceFile: | (NSString *) | __deprecated |
- (id) initWithName: | (NSString *) | aName | |
fromFile: | (NSString *) | aFilepath | |
Initializes this instance, loads the file at the specified file path, extracts the loaded CC3Nodes from the resource, and adds them as child nodes to this resource node.
The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.
The name of this node will be set to the specified name.
- (id) initWithName: | (NSString *) | aName | |
fromResourceFile: | (NSString *) | __deprecated | |
- (void) loadFromFile: | (NSString *) | aFilepath |
Loads the file at the specified file path, extracts the loaded CC3Nodes from the resource, and adds them as child nodes to this resource node.
The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.
This method invokes the resourceFromFile: class method on the class returned by the resourceClass property, and sets the resource property of this node to the returned instance.
If not already set, the name of this node will be set to that of the resource, which is usually the name of the file loaded.
- (void) loadFromFile: | (NSString *) | aFilepath | |
expectsVerticallyFlippedTextures: | (BOOL) | flipped | |
Loads the file at the specified file path, extracts the loaded CC3Nodes from the resource, and adds them as child nodes to this resource node.
The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.
This method invokes the resourceFromFile:expectsVerticallyFlippedTextures: class method on the class returned by the resourceClass property, and sets the resource property of this node to the returned instance.
If not already set, the name of this node will be set to that of the resource, which is usually the name of the file loaded.
- (void) loadFromResourceFile: | (NSString *) | __deprecated |
+ (id) nodeFromFile: | (NSString *) | aFilepath |
Allocates and initializes an autoreleased instance, loads the file at the specified file path, extracts the loaded CC3Nodes from the resource, and adds them as child nodes to this resource node.
The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.
This method invokes the loadFromFile: method to load the file.
The name of this node will be set to that of the resource, which is usually the name of the file loaded.
+ (id) nodeFromFile: | (NSString *) | aFilepath | |
expectsVerticallyFlippedTextures: | (BOOL) | flipped | |
Allocates and initializes an autoreleased instance, loads the file at the specified file path, extracts the loaded CC3Nodes from the resource, and adds them as child nodes to this resource node.
The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.
This method invokes the loadFromFile:expectsVerticallyFlippedTextures: method to load the file.
The name of this node will be set to that of the resource, which is usually the name of the file loaded.
+ (id) nodeFromResourceFile: | (NSString *) | __deprecated |
+ (id) nodeWithName: | (NSString *) | aName | |
fromFile: | (NSString *) | aFilepath | |
Allocates and initializes an autoreleased instance, loads the file at the specified file path, extracts the loaded CC3Nodes from the resource, and adds them as child nodes to this resource node.
The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.
The name of this node will be set to the specified name.
+ (id) nodeWithName: | (NSString *) | aName | |
fromResourceFile: | (NSString *) | __deprecated | |
- (void) populateFromResource: | (CC3NodesResource *) | resource |
Populates this instance from the specified resource, which must be of the type specified by the resourceClass property.
This method removes all child nodes of this instance and replaces them with the nodes extracted from the nodes property of the specified resource.
If this node has not yet been assigned a name, it will be set to the name of the specified resource.
The userData property of this node will be set to the userData property of the resource.
This method is automatically invoked by the loadFromFile:... methods, and in turn, from any of the initialization methods that load content from a file.
Subclass may override to extract additional content from the resource.
|
readwritenonatomicretain |
|
readwritenonatomicassign |
|
readnonatomicassign |
Returns the class of the CC3NodesResource instance used to load 3D content files.
The returned value is used by the initializers that load a file, and determines the type of resource that can be passed to the populateFromResource: method.
Default implementation triggers an assertion and returns CC3NodesResource. Subclasses must override to return an appropriate resource class.