Zurück   Flashforum > Flash > ActionScript > ActionScript 3

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 14-05-2007, 09:36   #1 (permalink)
habs vergessen
 
Benutzerbild von pwdVergesser
 
Registriert seit: Feb 2006
Beiträge: 990
3D Mesh... test.

...anbei mal meine ersten Tests mit der PP3D-Engine und einem
in XSI erstellten Character.

Statisch klappt das Ganze prima, ich habe jetzt nur noch keinen
Erfolg beim einlesen und darstellen komplexer "Bones-Animationen"
gehabt ( geht das überhaupt? ...bestimmt, oder ? )

>> Ansehen ( ...dauert zu Anfangs ein wenig bis das Model angezeigt wird! )

Der Source-Code ist eigentlich nicht erwähnenswert, da noch sehr PP3D-Standard, aber wer will, der schaue hier:
Code:

// --------------------------------------------------------------------------------------------------


stop();


// --------------------------------------------------------------------------------------------------

///////////////////////////////////
// import classes
///////////////////////////////////


import flash.display.*;
import flash.events.*;
import flash.filters.BlurFilter;
import flash.filters.GlowFilter;
import flash.geom.Point;
import flash.geom.Matrix;
import flash.geom.ColorTransform;	

import org.papervision3d.scenes.*;
import org.papervision3d.objects.*;
import org.papervision3d.cameras.*;
import org.papervision3d.materials.*;
import org.papervision3d.events.*;


// --------------------------------------------------------------------------------------------------

///////////////////////////////////
// define vartypes
///////////////////////////////////


var container	:Sprite;
var scene		:Scene3D;
var camera		:Camera3D;
var rootNode	:DisplayObject3D;

var efxBmp		:BitmapData 	= new BitmapData( 400, 400, true, 0x00FFFFFF);

var glow		:GlowFilter 	= new GlowFilter( 0xFFFFFFF, .5, 20, 20, 2, 2, false, false );
var blur		:BlurFilter 	= new BlurFilter( 2, 2, 1 );
var alphaTrans	:ColorTransform = new ColorTransform( 1, 1, 1, 1, -1, -1, -1, -28);

var baseMatrix  :Matrix;



// --------------------------------------------------------------------------------------------------

///////////////////////////////////
// define stage values
///////////////////////////////////

stage.quality = "MEDIUM";
stage.scaleMode = "noScale";


addChild( new Bitmap( efxBmp ) )


// --------------------------------------------------------------------------------------------------

///////////////////////////////////
// initialise 3d object & camera
///////////////////////////////////

function init3D(){

	// Create canvas movieclip and center it
	this.container = new Sprite();
	addChild( this.container );
	this.container.x = 200;
	this.container.y = 200;

	// Create scene
	this.scene = new Scene3D(this.container);

	// Create camera
	camera = new Camera3D();
	camera.x = 3000;
	camera.z = -2000;
	camera.zoom = 12;
	camera.focus = 12;

	// Add an empty object "rootNode" to the scene
	rootNode = scene.addChild( new Collada( "meshes/xsi2max_martin_static.DAE" ), "rootNode" );
	
	
	
	this.container.filters = [ glow ];

	// Initiates 3d rendering
	this.addEventListener(Event.ENTER_FRAME, loop3D);
	
			
}

init3D();



// --------------------------------------------------------------------------------------------------

///////////////////////////////////
// render 3d scene
///////////////////////////////////


function loop3D( event:Event ) {
	
	efxBmp.colorTransform( efxBmp.rect, alphaTrans );
	
	camera.x = ( ( -container.mouseX *5 ) - camera.x ) / 10;
	camera.y = ( ( -container.mouseY *5 ) - camera.y ) / 10;
	
	rootNode.rotationY = camera.x;
	rootNode.rotationX = camera.y;

	// Render the scene
	this.scene.renderCamera(camera);
	
	baseMatrix = new Matrix();
	baseMatrix.translate( container.x, container.y );
	
	efxBmp.applyFilter( efxBmp, efxBmp.rect, new Point( 0,0 ), blur );
	efxBmp.draw( container, baseMatrix );	
}
Feedback - immer gerne.

Und wer mir mehr zum Thema, "Bones-Animationen" parsen/ benutzen/ usw.
direkt mit PP3D sagen kann - your welcome.


pwd
__________________
Blog/Lab Xing
pwdVergesser ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 12:49 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele