Sure. Right now I'm loading it from a file... eventually it will be from the camera.
Also, I just realized it's not upside down, it's just on the side of the model... let me explain. The model is a dog (like a cartoon dog, think scooby doo), my image is loading on the head, but it's not upside down like I thought, it's just in the wrong direction. The picture is of my son, and his nose is showing up on the right ear of the dog. So when I rotate the dog, I can see that the picture was place on the side. Why is this? Obviously I'm a very beginner type of 3D user hahaha so thank you for the patience and help.
Here's the code, which is a mix&match from the tutorial files:
public function Test()
{
// stage configuration.
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
// creates a new 3d scene.
scene = new Viewer3D( this );
scene.camera = new Camera3D( "myOwnCamera" );
scene.camera.setPosition( -20, 20, 5);
scene.camera.lookAt( 0, 0, 0 );
// add global scene progress and complete events.
scene.addEventListener( Scene3D.PROGRESS_EVENT, progressEvent );
scene.addEventListener( Scene3D.COMPLETE_EVENT, completeEvent );
// loads the objects.
sample_model = scene.addChildFromFile( "../resources/dog.f3d" );
picture_texture = scene.addTextureFromFile( "../resources/testImage.jpg" );
// this prevents to flare3d to start render before the objects are completly loaded.
scene.pause();
}
private function completeEvent(e:Event):void
{
// once the scene has been loaded, resume the render.
scene.resume();
// start to update the scene.
scene.addEventListener( Scene3D.UPDATE_EVENT, updateEvent );
}
private function updateEvent(e:Event):void
{
if ( Input3D.keyDown( Input3D.UP ) )
{
var mesh:Mesh3D = (
sample_model.getChildByName("Head") as Mesh3D);
var surface:Surface3D = mesh.surfaces[0];
var shader:Shader3D = surface.material as Shader3D;
shader.filters[0].texture =
picture_texture;
}
}