[Papervision3D] - again ShadedMaterial & Cube == trouble

o renken renkster at gmail.com
Fri Feb 27 09:10:36 PST 2009


Sorry to be annoying :-)
Any chance to talk about that problem?

olee

2009/2/27 o renken <renkster at gmail.com>

> sorry, i forgot: rev877
>
> 2009/2/27 o renken <renkster at gmail.com>
>
> Hey Team,
>>
>> again some trouble with a simple setup with a cube and shadedMaterial.
>>
>> No long words, check here (code below):
>> http://lab.renkster.de/bench/troubleThings/shadedMaterialCube/
>>
>> Is it really needed to create a shadedMaterial for *each* side of the
>> cube? I need it in my current project ( 5-10 cubes) and it eats that much
>> performance.
>> Is it a bug? Is there a workaround? Do i miss something?
>>
>> Any statement/ tricks/ hints are highly appreciated.
>>
>> Thanks,
>> olee
>>
>> [CODE]
>>
>> package shadedMaterialCubesTrouble
>> {
>>     import renkster.papervision3d.cameras.HoverCamera;
>>
>>     import org.papervision3d.lights.PointLight3D;
>>     import org.papervision3d.materials.BitmapMaterial;
>>     import org.papervision3d.materials.shaders.FlatShader;
>>     import org.papervision3d.materials.shaders.ShadedMaterial;
>>     import org.papervision3d.materials.utils.MaterialsList;
>>     import org.papervision3d.objects.primitives.Cube;
>>     import org.papervision3d.view.BasicView;
>>
>>     import flash.display.BitmapData;
>>     import flash.events.Event;
>>
>>     /**
>>      * @author renkster
>>      */
>>     public class ShadedTrouble extends BasicView
>>     {
>>         private var _cube : Cube;
>>         private var _light : PointLight3D;
>>         private var _hoverCamera : HoverCamera;
>>
>>         public function ShadedTrouble(viewportWidth : Number = 640,
>> viewportHeight : Number = 480, scaleToStage : Boolean = true, interactive :
>> Boolean = false, cameraType : String = "Target")
>>         {
>>             super(viewportWidth, viewportHeight, scaleToStage,
>> interactive, cameraType);
>>
>>             addChildren();
>>         }
>>
>>         private function addChildren() : void
>>         {
>>             _light = new PointLight3D(true);
>>             scene.addChild(_light);
>>             _light.moveUp(300);
>>             _light.z = 0;
>>
>>             var light_col : uint = 0xEEEEEE;
>>             var ambientCol : uint = 0x333333;
>>
>>             var bd:BitmapData = new BitmapData(256,256,false,0xFF0000);
>>             var shader:FlatShader = new FlatShader(_light, light_col,
>> ambientCol);
>>             var mat : BitmapMaterial = new BitmapMaterial(bd);
>>             var shadedMat:ShadedMaterial = new ShadedMaterial(mat,shader);
>>             var matList : MaterialsList = new MaterialsList();
>>             matList.addMaterial(shadedMat, "all");
>>
>>             _cube = new Cube(matList, 300, 300, 300, 2, 2, 2);
>>             scene.addChild(_cube);
>>
>>             //_hoverCamera = new HoverCamera(stage, scene, viewport,
>> camera);
>>
>>             addEventListener(Event.ENTER_FRAME, loop);
>>         }
>>
>>         private function loop(event : Event) : void
>>         {
>>             _cube.yaw(1);
>>             _cube.pitch(.5);
>>             _light.copyPosition(camera);
>>             //_hoverCamera.updateCamera();
>>             singleRender();
>>         }
>>     }
>> }
>>
>>
>> --
>> http://www.renkster.de/
>>
>
>
>
> --
> http://www.renkster.de/
>



-- 
http://www.renkster.de/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090227/ee9b6d2a/attachment.html>


More information about the Papervision3D mailing list