kottore / away3d

Automatically exported from code.google.com/p/away3d
0 stars 0 forks source link

Setting MovieMaterial.lockH twice before first render() causes old value to be used #93

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a MovieMaterial and set lockH to a value
2. "theMovieMaterial.lockH = someOtherValue"
3. Render

What is the expected output? What do you see instead?
Expected: render() uses the new lockH value.
Actual:   render() uses the old lockH value, until it is set yet again at
some later point.

What version of the product are you using? On what operating system?
See issues 91, 92.

Please provide any additional information below.

Sample reproduce case follows. Note that lockH is set to 128 before
render() is called. On key down, it is again set to 128. Observe, the text
is stretched when hitting a key. The expected result would be stretched
text all the time, and no visual change when hitting a key (since lockH
already is, or should be, 128).

package {
    import away3d.cameras.HoverCamera3D;
    import away3d.containers.View3D;
    import away3d.materials.MovieMaterial;
    import away3d.primitives.Cube;
    import away3d.primitives.data.CubeMaterialsData;

    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.KeyboardEvent;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    import flash.utils.getTimer;

    public class test_lockhtwice extends Sprite
    {
        protected var _view3D:View3D;
        protected var _cam:HoverCamera3D;
        protected var _material:MovieMaterial;

        public function test_lockhtwice()
        {
            stage.scaleMode = StageScaleMode.NO_SCALE; stage.align =
StageAlign.TOP_LEFT; stage.frameRate = 30;
            _cam = new HoverCamera3D();
            _view3D = new View3D({camera:_cam});
            addChild(_view3D);
            var texture:Sprite = new Sprite(); var tf:TextField = new
TextField(); tf.defaultTextFormat = new TextFormat(null, 128, 0xFF0000);
tf.autoSize = TextFieldAutoSize.LEFT; tf.text = 'Hello world';
texture.addChild(tf);
            _material = new MovieMaterial(texture, {autoUpdate: true,
transparent:false, lockH: 256, lockW: 256});
            var cube:Cube = new Cube({cubeMaterials:new
CubeMaterialsData({top:_material,left:_material,front:_material})});
            _view3D.scene.addChild(cube);
            _material.lockH = 128;
            stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
            stage.addEventListener(KeyboardEvent.KEY_DOWN,
function(e:Event):void{ _material.lockH = 128; });
        }

        protected function onEnterFrame(e:Event):void
        {
            _view3D.x = stage.stageWidth/2; _view3D.y = stage.stageHeight/2;
            _cam.targetpanangle = mouseX/stage.stageWidth * 180 - 90;
            _cam.targettiltangle = mouseY/stage.stageHeight * 180 - 90;
            _cam.hover();
            _view3D.render();
        }
    }
}

Original issue reported on code.google.com by postmes...@gmail.com on 3 Feb 2010 at 3:14