This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?act=Print&client=printer&f=17&t=393 as retrieved on 15 Aug 2007 13:15:27 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:ekcEyxy6FnsJ:www.flashsandy.org/forum/index.php%3Fact%3DPrint%26client%3Dprinter%26f%3D17%26t%3D393+act%3DPrint+%22index+php%22+-lofiversion+site:www.flashsandy.org&hl=en&ct=clnk&cd=11


Google is neither affiliated with the authors of this page nor responsible for its content.
These terms only appear in links pointing to this page: act print index php

Printable Version of Topic

Click here to view this topic in its original format

Sandy's Forum _ AS2 1.x versions _ Using the MovieSkin class?

Posted by: Hellraiser Mar 21 2007, 03:03 PM

Hi,

Ive been playing around with Sandy 1.1 and the cano panoramic demo. Very impressive smile.gif

What im struggling with though is how to place actual move clips on the inside of the cude instead of bitmaps. So basically that anything playing in those movie clips will work independently, like animations and buttons for example.

Ive checked through the documentation and the class files and understand i need to use the MovieSkin class in some way but ive tried many variations fo code and I just cant get it working.

Are there any tutorials on this subject caus ive searched for literally hours and havent found anything I can use.

Thanks in advance for any help.

Posted by: Petit Mar 21 2007, 03:59 PM

QUOTE(Hellraiser @ Mar 21 2007, 04:03 PM) *

So basically that anything playing in those movie clips will work independently, like animations and buttons for example.
Are there any tutorials on this subject caus ive searched for literally hours and havent found anything I can use.


In the second part of my http://www.petitpub.com/labs/media/flash/sandy/skinning.shtml, I use a MovieSkin and a VideoSkin, albeit on the outside of a cube.
You may combine that with what you already have.

Posted by: Hellraiser Mar 21 2007, 04:48 PM

Hey,

Ive actually been through that tut but couldnt get a grasp on how to integrate your function with what ive already got.

Ive changed the code a little from (your file?) what it was originally, loading in swfs.

Heres the code im using:

CODE

/*
CubicPanoPetit is a simplification the original CubicPanoTest
running on Sandy 1.1
It is to be included in the first frame of a fla.
Stage area is 300 by 300 px
*/

import sandy.core.group.Group;
import sandy.core.face.Face;
import sandy.primitive.Box;
import sandy.skin.TextureSkin;
import sandy.skin.MovieSkin;
import sandy.view.Camera3D;
import sandy.view.ClipScreen;
import sandy.view.IScreen;
import sandy.core.World3D;
import sandy.util.*;

import sandy.core.transform.Transform3D;
import sandy.core.group.TransformGroup;

import flash.display.BitmapData;
     // Image names for the six bitmaps that will constitute the cubic view
     var planeNames:Array = ["straight_ahead", "behind", "down", "up", "right", "left"];
     var CUBE_DIM         = 600;
     var ANIM_DIM         = 600;
     var CUBE_QUALITY     = 3;
     var cube:Box;
    
     var _fps:Number;
     var _tf:TextField;
     var _ms:Number;

     var _yaw:Number = 0;
     var _pitch:Number = 0;
     var _fov:Number;

     var world:World3D;
     var faces:Array;
     var bitmaps:Array = new Array(6);
     var imageCount = 0; // Count of loaded images
     var qFactor:Number;
    
     function init():Void{
        world = World3D.getInstance();
        world.setRootGroup( makeScene() );
        world.addEventListener(World3D.onRenderEVENT, this, interactions);
        var screen:IScreen = new ClipScreen(this.createEmptyMovieClip("screen", this.getNextHighestDepth()), ANIM_DIM, ANIM_DIM);
        var cam:Camera3D = new Camera3D( 500, screen );
        _fov = fov(100);
        world.addCamera(cam);
        _ms = getTimer();
        _fps = 0;
        createFPS();
        // Quality factor to select faces dressed by the same image
        qFactor = Math.pow(2,CUBE_QUALITY -1);
        trace(qFactor);
        qFactor = 2*qFactor*qFactor;
        loadImages();
        world.render();
    }

    // Make up the scene
    function makeScene():Group {
        var g:Group = new Group();    
        cube = new Box( CUBE_DIM, CUBE_DIM, CUBE_DIM, 'tri', CUBE_QUALITY );
        faces = cube.getFaces(); // An array of all faces
        // Swap to render the images only on the inside
        cube.swapCulling();
        var trfG:TransformGroup = new TransformGroup();
        var rot:Transform3D = new Transform3D();
        // Turn upside down to accomodate for diff in coord sys from Sandy 1.0
        rot.rotZ(180);
        trfG.setTransform(rot);
        trfG.addChild( cube );
        g.addChild( trfG );
        return g;
    }

    // Load the images using one MovieClipLoader per image
    function loadImages(){
        for ( var i = 0; i < 6;i++ ){
            var holder:MovieClip = this.createEmptyMovieClip("holder"+i, this.getNextHighestDepth());
            // Hide images on stage
            holder._alpha = 0;
            var loader = new MovieClipLoader();
            loader.addListener( this );
            loader.loadClip(planeNames[i] + ".swf", holder );
            //holder.attachMovie(planeNames[i], planeNames[i], i+1*2000);
        }
    }
    
    // Image on load handler called once for each image
    onLoadInit = function( mc:MovieClip ){
        // Count images loaded ( for work around in frame event handler )
        imageCount ++;
        // Create a skin from this image
        var bitmap:BitmapData = new BitmapData( mc._width, mc._height,true,0x00FFFFFF);
        bitmap.draw( mc );
        var theSkin:TextureSkin = new TextureSkin( bitmap );
        // The number of this image * the quality factor
        var start = Number( mc._name.substr(6,1) )* qFactor;
        // Set the correct skin on one side of the cube ( 32 faces )
        for ( var i = start; i < start + qFactor; i++ ){
            faces[i].setSkin( theSkin );
        }
    }
    // Frame rate counter field
    function createFPS():Void
    {
        _tf = createTextField ("fps", getNextHighestDepth(), 5, 10, 40, 20);
        _tf.border = true;
        _tf.borderColor = 0xFFFFFF;
    }
        
    // ============= On every frame check the keyboard ================
    function interactions():Void
    {
        var newMS:Number = getTimer();
        if (newMS - 1000 > _ms){
            _ms = newMS;
            _tf.text = _fps + " fps";
            _fps = 0;
        } else {
            _fps++;
        }

        var cam:Camera3D = world.getCamera();
        // Shake up only the first frame after all images are loaded
        if ( imageCount == 6 ) {
            cam.rotateY(0);
            imageCount = 0;
        }
        
        // interactions go here    
        if (Key.isDown(Key.RIGHT))
        {
            cam.rotateY(5);        // yaw
            _yaw += 5;
        }
        if (Key.isDown(Key.LEFT))
        {
            cam.rotateY(-5);    // yaw
            _yaw -= 5;
        }
        if (Key.isDown(Key.UP))
        {
            cam.tilt(5);        // pitch (not really but OK since we don't roll)
            _pitch += 5;
        }
        if (Key.isDown(Key.DOWN))
        {
            cam.tilt(-5);        // pitch (not really but OK since we don't roll)
            _pitch -= 5;
        }

        if (_yaw > 180){
            _yaw -= 360;
        } else if (_yaw < -180){
            _yaw += 360;
        }
    }

    function fov(foc:Number):Number    // fov in degrees
    {
        return 360 * Math.atan(ANIM_DIM/(2 * foc)) / Math.PI;
    }

    function foc(fov:Number):Number    // fov in degrees
    {
        return ANIM_DIM / (2 * Math.tan(Math.PI * fov/360));
    }
init();


IM looking for an easy way to chane this code so i can keep the swfs as actual swfs on the cube and not convert them to bitmaps. I have fiddled with your code ans other code for a while but as yet havent found the correct way of doing it.

Thanks again for any help.

Posted by: zeusprod Mar 21 2007, 04:57 PM

QUOTE(Hellraiser @ Mar 21 2007, 11:48 AM) *

var theSkin:TextureSkin = new TextureSkin( bitmap );


You need to use new MovieSkin() instead of new TextureSkin().

Bruce - zeusprod

Posted by: Hellraiser Mar 21 2007, 05:11 PM

Sorry i shouldve been clearer. I have tried that and many different variations but it doesnt work for some reason. I noticed there is a function in there that seems to be converting the mcs to bitmaps and ive also played around with that but to no avail. Just so im being clear, I have had a go at many different variations from the code ive pasted here. I pasted that code caus it works but only in creating bitmaps of the swfs im loading in.

Thanks again.

Posted by: zeusprod Mar 21 2007, 05:33 PM

QUOTE(Hellraiser @ Mar 21 2007, 12:11 PM) *

Sorry i shouldve been clearer. I have tried that and many different variations but it doesnt work for some reason. I noticed there is a function in there that seems to be converting the mcs to bitmaps and ive also played around with that but to no avail. Just so im being clear, I have had a go at many different variations from the code ive pasted here. I pasted that code caus it works but only in creating bitmaps of the swfs im loading in.

Thanks again.


Are you using Flash 8 and publishing to Flash 8 format?

Flash 8's BitmapData class is required for TextureSkin and MovieSkin.

Also, are you properly setting the Boolean flag in the MovieSkin constructor to false? (otherwise, it disables animation of the movie clip).

And are you sure you have the correct movie clip symbol name(s) in your library and that they are properly identified/exported?


Bruce

Posted by: Hellraiser Mar 21 2007, 05:45 PM

Hey yeh I did set the boolean to false. Im in flash 8 and publishing in as2 so theres no problems there. The exporting names are right, if i disable turning the holder invisible it shows the mcs, well the last one created caus they cover each other. So I cant see any obvious things im doing wrong.

If I change the texture to movie and import MovieSkin class all i get is a cube showing the tri blocks but nothing on them so it just looks like a mesh.

Posted by: Petit Mar 22 2007, 01:07 PM

QUOTE(Hellraiser @ Mar 21 2007, 06:45 PM) *

If I change the texture to movie and import MovieSkin class all i get is a cube showing the tri blocks but nothing on them so it just looks like a mesh.

Whatever you do, listen to zeusprod: You have to use a MovieSkin.
You cannot do this:
CODE
// Create a skin from this image
var bitmap:BitmapData = new BitmapData( mc._width, mc._height,true,0x00FFFFFF);
bitmap.draw( mc );
var theSkin:TextureSkin = new TextureSkin( bitmap )

When you do bitmap.draw( mc ), you are taking a snapshot of the MovieClip at this very moment.
That bitmap will never change, so everything is frozen.
In the case of the MovieSkin with an animated MovieClip, such a snapshot is taken every frame of the World3D rendering process, and the animation lives on the cube.

Posted by: Hellraiser Mar 22 2007, 04:36 PM

Hi,

Ive played around with it some more and animation in mcs plays fine. Have two problems tho.

1. The skins only appear when the cube is being rotated, when static all i get is a white screen.

2. I have abutton inside the one of the mcs and want that to be able to be clicked and scaled, moved etc along with the skin itself. What actually happens is the button stays in the same position all the time.

Is it possible to have buttons in the skin itself that scale and move with the skin itself, ie the mc it is inside that has been skinned to the cube?

Heres my code:

CODE
/*
CubicPanoPetit is a simplification the original CubicPanoTest
running on Sandy 1.1
It is to be included in the first frame of a fla.
Stage area is 300 by 300 px
*/

import sandy.core.group.Group;
import sandy.core.face.Face;
import sandy.primitive.Box;
import sandy.skin.TextureSkin;
import sandy.skin.MovieSkin;
import sandy.view.Camera3D;
import sandy.view.ClipScreen;
import sandy.view.IScreen;
import sandy.core.World3D;
import sandy.util.*;

import sandy.core.transform.Transform3D;
import sandy.core.group.TransformGroup;

import flash.display.BitmapData;
     // Image names for the six bitmaps that will constitute the cubic view
     var planeNames:Array = ["straight_ahead", "behind", "down", "up", "right", "left"];
     var CUBE_DIM         = 600;
     var ANIM_DIM         = 600;
     var CUBE_QUALITY     = 4;
     var cube:Box;
    
     var _fps:Number;
     var _tf:TextField;
     var _ms:Number;

     var _yaw:Number = 0;
     var _pitch:Number = 0;
     var _fov:Number;

     var world:World3D;
     var faces:Array;
     var bitmaps:Array = new Array(6);
     var imageCount = 0; // Count of loaded images
     var qFactor:Number;
    
     function init():Void{
        world = World3D.getInstance();
        world.setRootGroup( makeScene() );
        world.addEventListener(World3D.onRenderEVENT, this, interactions);
        var screen:IScreen = new ClipScreen(this.createEmptyMovieClip("screen", this.getNextHighestDepth()), ANIM_DIM, ANIM_DIM);
        var cam:Camera3D = new Camera3D( 500, screen );
        _fov = fov(100);
        world.addCamera(cam);
        _ms = getTimer();
        _fps = 0;
        createFPS();
        // Quality factor to select faces dressed by the same image
        qFactor = Math.pow(2,CUBE_QUALITY -1);
        trace(qFactor);
        qFactor = 2*qFactor*qFactor;
        loadImages();
        world.render();
    }

    // Make up the scene
    function makeScene():Group {
        var g:Group = new Group();    
        cube = new Box( CUBE_DIM, CUBE_DIM, CUBE_DIM, 'tri', CUBE_QUALITY );
        faces = cube.getFaces(); // An array of all faces
        // Swap to render the images only on the inside
        cube.swapCulling();
        var trfG:TransformGroup = new TransformGroup();
        var rot:Transform3D = new Transform3D();
        // Turn upside down to accomodate for diff in coord sys from Sandy 1.0
        rot.rotZ(180);
        trfG.setTransform(rot);
        trfG.addChild( cube );
        g.addChild( trfG );
        return g;
    }

    // Load the images using one MovieClipLoader per image
    function loadImages(){
        for ( var i = 0; i < 6;i++ ){
            var holder:MovieClip = this.createEmptyMovieClip("holder"+i, this.getNextHighestDepth());
            // Hide images on stage
            holder._alpha = 0;
            var loader = new MovieClipLoader();
            loader.addListener( this );
            loader.loadClip(planeNames[i] + ".swf", holder );
            //holder.attachMovie(planeNames[i], planeNames[i], i+1*2000);
        }
    }
    
    // Image on load handler called once for each image
    onLoadInit = function( mc:MovieClip ){
        // Count images loaded ( for work around in frame event handler )
        imageCount ++;
        // Create a skin from this image
        //var bitmap:BitmapData = new BitmapData( mc._width, mc._height,true,0x00FFFFFF);
        //bitmap.draw( mc );
        var theSkin:MovieSkin = new MovieSkin( mc, false );
        // The number of this image * the quality factor
        var start = Number( mc._name.substr(6,1) )* qFactor;
        // Set the correct skin on one side of the cube ( 32 faces )
        for ( var i = start; i < start + qFactor; i++ ){
            faces[i].setSkin( theSkin );
        }
    }
    // Frame rate counter field
    function createFPS():Void
    {
        _tf = createTextField ("fps", getNextHighestDepth(), 5, 10, 40, 20);
        _tf.border = true;
        _tf.borderColor = 0xFFFFFF;
    }
        
    // ============= On every frame check the keyboard ================
    function interactions():Void
    {
        var newMS:Number = getTimer();
        if (newMS - 1000 > _ms){
            _ms = newMS;
            _tf.text = _fps + " fps";
            _fps = 0;
        } else {
            _fps++;
        }

        var cam:Camera3D = world.getCamera();
        // Shake up only the first frame after all images are loaded
        if ( imageCount == 6 ) {
            cam.rotateY(0);
            imageCount = 0;
        }
        
        // interactions go here    
        if (Key.isDown(Key.RIGHT))
        {
            cam.rotateY(5);        // yaw
            _yaw += 5;
            
            
        }
        if (Key.isDown(Key.LEFT))
        {
            cam.rotateY(-5);    // yaw
            _yaw -= 5;
        }
        if (Key.isDown(Key.UP))
        {
            if(_pitch<=60){
                cam.tilt(5);        // pitch (not really but OK since we don't roll)
                _pitch += 5;
            }
        }
        if (Key.isDown(Key.DOWN))
        {
            if(_pitch>=-60){
                cam.tilt(-5);        // pitch (not really but OK since we don't roll)
                _pitch -= 5;
            }
        }

        
    }

    function fov(foc:Number):Number    // fov in degrees
    {
        return 360 * Math.atan(ANIM_DIM/(2 * foc)) / Math.PI;
    }

    function foc(fov:Number):Number    // fov in degrees
    {
        return ANIM_DIM / (2 * Math.tan(Math.PI * fov/360));
    }
init();


Thanks for any info on this.

If it is not possible im gonna have to look into more complicated methods of achieving what i want.

Posted by: Petit Mar 22 2007, 05:17 PM

QUOTE(Hellraiser @ Mar 22 2007, 05:36 PM) *

1. The skins only appear when the cube is being rotated, when static all i get is a white screen.
2. I have abutton inside the one of the mcs and want that to be able to be clicked and scaled, moved etc along with the skin itself. What actually happens is the button stays in the same position all the time.

It's certainly good to see success, even if partial wink.gif

I think I recognize problem no 1.
The solution when the rendering engine thinks there's nothing to do, is to introduce a fake movement. I the interactions() event handler, which is called once every frame, add this code:
CODE
cam.rotateY(0);

Nothing happens with the camera of course, but the fake rotation tells the engine to render.

Problem no 2.
No Button buttons on in the MovieClip used for the MovieSkin will work.
A snapshot bitmap is taken of the MovieClip every frame, so what you have is a BitmapData object ( a bitmap )

What you can do is to enable object events on one or more faces ( or for the whole object ).
Any Face or Objec3D that has object events enable reacts to mouse and fires mouse events.

ps. By selecting your code after you paste it here and clicking the code button #, you get this nice red color on white ( I edited it for you wink.gif). You can also easily attach lengthy code snippets, by browsing and adding below the input dialog.

Posted by: Hellraiser Mar 23 2007, 10:35 AM

Hey,

The skins appear at all times which is cool. Im still struggling with getting the buttons to work properly tho. Ive enabled the mouse events on the faces but all i get now is the mouse cursor appears at all times. Plus the buttons themselves dont work, i presume this is because they are being covered by something. Thing is ive moved the holders off stage so it cant be those. Any ideas what might be happening?

Heres the code snippet im using, trying to activate the button events tongue.gif :

CODE
onLoadInit = function( mc:MovieClip ){
        // Count images loaded ( for work around in frame event handler )
        imageCount ++;
        // Create a skin from this image
        //var bitmap:Object3D = new Object3D( mc._width, mc._height,true,0x00FFFFFF);
        //bitmap.draw( mc );
        var theSkin:MovieSkin = new MovieSkin( mc, false );
        // The number of this image * the quality factor
        var start = Number( mc._name.substr(6,1) )* qFactor;
        // Set the correct skin on one side of the cube ( 32 faces )
        for ( var i = start; i < start + qFactor; i++ ){
            faces[i].setSkin( theSkin );
            faces[i].enableEvents(true);
                
        }
        
    }

Posted by: kiroukou Mar 23 2007, 11:12 AM

hi,
Good step forward smile.gif

Now you need to listen to the events you want! So you have to subscribe to the object or the face you want, to a specific event (onPressEVENT, onReleaseEVENT, etc.)

Best,
Thomas

Posted by: Hellraiser Mar 23 2007, 12:15 PM

Hey,

I understand what you mean. Only problem is I cant seem to add the listeners properly. Ive tried a few differetn ways, adding one listener that tries to read the face you are on and adding a listener for each face, but neither is working.

Ive noticed the faces are the individual tri blocks so there are plenty of them. Do i want to add functionality to each of those or just to the 6 overall faces?

Sorry if it seems im trying to get people to do this for me but im really struggling.

Thanks again for your help so far.

Posted by: Petit Mar 23 2007, 01:01 PM

QUOTE(Hellraiser @ Mar 23 2007, 01:15 PM) *

Do i want to add functionality to each of those or just to the 6 overall faces?

Sorry if it seems im trying to get people to do this for me but im really struggling.

Hi, no one thinks you're lazy tongue.gif
Normal questions, no doubt.
Faces and surfaces can be confusing at times.
This is how it works:
As you have noticed one side of the cube comprises many triangular faces.

To make on whole side of the cube sensitive for mouse events, you have to enable object events for all the faces. There is no other way to sensitize a surface = side of the cube.

So, loop through the faces and enable object events on them.
At the same time, add listeners to the faces. If you don't get the listeners to work, give us the code again.
( You know that you can attach longer code snippets to a post here, if you want )

For the button question, I may not have been clear enough.
If you have a MovieClip 'mc' with Buttons on it, and you use mc for a MovieSkin, the buttons will not work.
They may be visibly there, but what you see is only a snapshot bitmap - no button functionality.
To make buttons for the skin, you have to fake them, by enabling the faces carrying the button image.

Posted by: Petit Mar 23 2007, 01:40 PM

What you can do is this.
In your onLoadInit() metod:

CODE

for ( var i = start; i < start + qFactor; i++ ){
       faces[i].setSkin( theSkin );
        faces[i].enableEvents(true);
        faces[i].addEventListener( ObjectEvent.onRollOverEVENT, this, doSomeThing );
}        


The 'this' refers to the application, which is the listener here.
The doSomeThing refers to the event handler. You add one event handler for each event you want to listen for.
Here is my handler, that only traces to tell it is called.
CODE
function doSomeThing( e:ObjectEvent ){
    var face:TriFace3D = e.getTarget();
    trace("Rolling over face:" + face.getId());
}

As you can see, the ecent handler is passed an ObjectEvent object, from which you can tell which face fired the event. We know it is a TriFace3D, and by calling its getId() method, we know which face.

It is http://www.petitpub.com/labs/media/flash/sandy/interactions.shtml under "Selecting a face".

Good luck!

Posted by: zeusprod Mar 23 2007, 03:13 PM

QUOTE(Petit @ Mar 23 2007, 08:01 AM) *

As you have noticed one side of the cube comprises many triangular faces.


I never noticed that quality setting in the constructor! (although I noticed the quality and rendermode args are in a different order than other primitive constructors). I was working with only two faces in tri mode and wasn't happy about the distortion!

Now I have to check my face-selection logic for dealing with higher qualities.

But this raises a general issue -- namely that, as a user, you shouldn't have to change your "object-face-related" logic when there is a change in quality. IOW, a cube should have 6 "object faces" even if each face is made up of multiple polygons.

Thoughts?

(Should I move this discussion to the mailing list)

Cheers,
Bruce

Posted by: Hellraiser Mar 23 2007, 05:03 PM

Thank you so much. It all seems to work now. All ive got left to do is jot down the faces with buttons on and put in the actual events.

Thanks again.

Posted by: Petit Mar 24 2007, 01:07 AM

QUOTE(zeusprod @ Mar 23 2007, 04:13 PM) *

Now I have to check my face-selection logic for dealing with higher qualities.
IOW, a cube should have 6 "object faces" even if each face is made up of multiple polygons.

The cube or rather Box is a special case - and popular too :-), and even with methods for setting the skin and enabling object events on each side, I believe there may be cases for which you want access to the faces or polygons. In Sandy 1.1 I think you can use the same logic for all quality settings to set a skin on one side.

For a cube:Box created in 'tri' mode and with a quality q, there are (q + 1)*(q + 1) faces on each side, so the logic would be
CODE
var faces:Array = cube.getFaces();
var module = 2*( q + 1 )*( q + 1 );
for( var i = 0; i < faces.length; i+=module ){
    var face:Face;
    for( var k = 0; k < module; k++ ){
       face = faces[i+k];
       face.setSkin( skins[i] ); // skin a side
    }
}

Posted by: zeusprod Mar 25 2007, 01:52 PM

QUOTE(Petit @ Mar 23 2007, 08:07 PM) *

For a cube:Box created in 'tri' mode and with a quality q, there are (q + 1)*(q + 1) faces on each side


I think the formula for the number of polys (faces) per cube side in tri mode is 2*q*q not what you have above.

So for quality 2, there are 8 polygons per cube side, right?

Bruce

Posted by: Petit Mar 25 2007, 03:04 PM

QUOTE(zeusprod @ Mar 25 2007, 01:52 PM) *

I think the formula for the number of polys (faces) per cube side in tri mode is 2*q*q not what you have above.
So for quality 2, there are 8 polygons per cube side, right?

We'll have to check if this may vary between versions.
I looked for this in the CubicPanoTest. One version used the 2*q*q, but had big holes in it.
So I checked visually to see how many faces each side has ( not all are visible at the same time ).
Then I changed the code:
With
CODE
static var CUBE_QUALITY     = 3;

the cube is created like this
CODE
cube = new Box( 300, 300, 300, 'tri', CUBE_QUALITY );

Looping through the sides and faces like this
CODE
for( var i:Number = 0, i < a.length; i+=(2*(CUBE_QUALITY+1)*(CUBE_QUALITY+1)) ){
    for(var k:Number = 0; k < 2*(CUBE_QUALITY+1)*(CUBE_QUALITY+1); k++ ){
        f = a[i+k];
        f.setSkin( skin );
    }
}

makes the CubicPano work.

Geeez...just checking the Box again.

In 'tri' mode :
q=1 renders 2 faces per side ( the default )
q=2 renders 8 faces per side
q=3 renders 32 faces per side

In 'quad' mode, this will be the series 1, 4, 16, which means that the side of the rectangular surface is not divided in q pieces, but that each step in quality means dividing the side of each face in half.
So there is an algorithm wink.gif and it is probably not the same for all primitives.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)