Tutorial: CubeCreator

This tutorial program shows how to add textures, materials, and animation to meshes representing a model (in this case, a cube). Operations include:

High level operations Low level operations
Constructing the baseline scene - Defining the animation stack and animation layer that will contain the animation
Adding animation to the camera Constructing the initial scene graph.
Note:

Builds and runs on Windows only.

Project Organization

The CubeCreator project is located at <yourFBXSDKpath>\examples\UI Examples\CubeCreator\.

CubeCreator has two source files:

Source file Description
SDK_Utility.cxx Contains all the code that calls FBX SDK to create the scene, add the cubes, and add materials, textures and animation to the cubes.This tutorial explains much of the code in this file.
UI.cxx Contains the code that displays the tree view of the scene and that interacts with the user. The code uses FBX SDK to retrieve the scene data that the UI displays in its tree view.This tutorial does not explain any of the code in this file.

User Interface

The CubeCreator sample program shows you how to add textures, materials, and animation to models in a scene.

At startup, CubeCreator displays a tree view of a scene containing only a marker and a camera.

As a user, you can add cubes one at a time to the scene. For each cube, you can opt to:

You can save the scene as an FBX file (or in any file format exported by FBX SDK).

Here is what 8cubes.fbx (the scene shown as a tree, above) looks like when opened in FBX for QuickTime:

Location of a Texture File at Run Time

<yourFBXSDKpath>\examples\UI Examples\CubeCreator\ contains a file named crate.jpg, which CubeCreator uses as a texture file.

You must copy this texture file into the folder where the executable for CubeCreator will start. Unless you change the settings for the CubeCreator project:

If FBX for QuickTime cannot find a texture file for a surface, it renders the surface as a checkerboard pattern. Here is how that looks for the faces of our cubes:

Main Logic

CubeCreator does the following operations: