C:\work> 3ds2XML stealth.3ds stealth.xc3
A new file stealth.xc3 should appear in current directory.
Setting up scene consists of following steps:
/** * initial setup for Sandy3D. */ public function setupSandy(): void { // We create the camera this.camera = new Camera3D( 600, 400 ); this.camera.near = 1; // We create the "group" that is the tree of all the visible objects var root:Group = new Group(); // We create a Scene and we add the camera and the objects tree this.scene = new Scene3D( "scene", this, camera, root ); this.scene.light = new Light3D(new Vector(0,0,1),100); }
/** * initial setup for Cast3D. */ public function setupCast3D(): void { // init loading status this.loaded = false; // new Cast3D instance with created earlier 3D scene and camera this.animator = new Cast3d(this.scene, this.camera); // set animation type this.animator.animationType = Cast3d.ANIMATION_TYPE_BYFRAME; // ANIMATION_TYPE_REAL; // // set desired animation frame rate this.animator.fps = 22; // run it once this.animator.autoRewind = false; }
/** * Function performs 3D data load from a X3c file. */ private function loadData(): void { /** stealth - simple model, no animation */ this.loader = new Xc3Loader("stealth.x3c"); this.loader.resourcePath = "/data"; // optimize animation this.loader.preCalcMotion = true; // register notification of load completion this.loader.addEventListener(LoadEvent.LOAD_COMPLETE, this.cast3dLoadComplete); // register notification of load error this.loader.addEventListener(LoadEvent.LOAD_ERROR, this.cast3dLoadError); // proceed with load this.loader.load(this.animator.source); }
If you noticed the line
this.loader.resourcePath = "/data";
indicated the place where you want to put texture images and other media materials like sound, movie and video.