You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we start application with small browser window at first, then maximize it, stage will be cutted
I've just modified basic/Particles sample Main class, so you can easily reproduce it.
How in can be fixed? Or are there any work arounds?
Just copy this code to basic/Particles/Main.hx and add <haxelib name="starling" /> to project.xml
/*Basic GPU-based particle animation example in Away3dDemonstrates:How to use the ParticleAnimationSet to define static particle behaviour.How to create particle geometry using the ParticleGeometryHelper class.How to apply a particle animation to a particle geometry set using ParticleAnimator.How to create a random spray of particles eminating from a central point.Code by Rob Bateman & Liao Cheng[email protected]http://www.infiniteturtles.co.uk[email protected]This code is distributed under the MIT LicenseCopyright (c) The Away Foundation http://www.theawayfoundation.orgPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the “Software”), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.*/package;
importstarling.display.Quad;
importopenfl.display3D.Context3DRenderMode;
importstarling.core.Starling;
importaway3d.events.Stage3DEvent;
importaway3d.core.managers.Stage3DProxy;
importaway3d.core.managers.Stage3DManager;
importaway3d.animators.*;
importaway3d.animators.data.*;
importaway3d.animators.nodes.*;
importaway3d.containers.*;
importaway3d.controllers.*;
importaway3d.core.base.*;
importaway3d.debug.*;
importaway3d.entities.*;
importaway3d.materials.*;
importaway3d.primitives.*;
importaway3d.tools.helpers.*;
importaway3d.utils.*;
importopenfl.display.*;
importopenfl.events.*;
importopenfl.geom.*;
importopenfl.Vector;
classMainextendsSprite
{
//engine variablesprivatevar_view:View3D;
privatevar_cameraController:HoverController;
//particle variablesprivatevar_particleAnimationSet:ParticleAnimationSet;
privatevar_particleMesh:Mesh;
privatevar_particleAnimator:ParticleAnimator;
//navigation variablesprivatevar_move:Bool=false;
privatevar_lastPanAngle:Float;
privatevar_lastTiltAngle:Float;
privatevar_lastMouseX:Float;
privatevar_lastMouseY:Float;
/** * Constructor*/publicfunctionnew()
{
super();
initProxies();
}
privatefunctiononContextCreated(event:Stage3DEvent):Void
{
initStarling();
initAway3D();
}
var_starling:Starling;
privatefunctioninitStarling():Void
{
_starling=newStarling(AppDisplay, stage, stage3DProxy.viewPort, stage3DProxy.stage3D, Context3DRenderMode.AUTO);
_starling.showStats=true;
stage.addEventListener(openfl.events.Event.ENTER_FRAME, e-> {
stage3DProxy.clear();
_starling.nextFrame();
_view.render();
stage3DProxy.present();
});
_starling.start();
}
privatefunctioninitAway3D():Void
{
stage.scaleMode=StageScaleMode.NO_SCALE;
stage.align=StageAlign.TOP_LEFT;
_view=newView3D();
_view.stage3DProxy=stage3DProxy;
_view.shareContext=true;
addChild(_view);
_cameraController=newHoverController(_view.camera, null, 45, 20, 1000);
// addChild(new AwayStats(_view));//setup the particle geometryvarplane:Geometry=newPlaneGeometry(10, 10, 1, 1, false);
vargeometrySet:Vector<Geometry> =newVector<Geometry>();
for (iin0...20000)
geometrySet.push(plane);
//setup the particle animation set_particleAnimationSet=newParticleAnimationSet(true, true);
_particleAnimationSet.addAnimation(newParticleBillboardNode());
_particleAnimationSet.addAnimation(newParticleVelocityNode(ParticlePropertiesMode.LOCAL_STATIC));
_particleAnimationSet.initParticleFunc=initParticleFunc;
//setup the particle materialvarmaterial:TextureMaterial=newTextureMaterial(Cast.bitmapTexture("assets/blue.png"));
material.blendMode=BlendMode.ADD;
//setup the particle animator and mesh_particleAnimator=newParticleAnimator(_particleAnimationSet);
_particleMesh=newMesh(ParticleGeometryHelper.generateGeometry(geometrySet), material);
_particleMesh.animator=_particleAnimator;
_view.scene.addChild(_particleMesh);
//start the animation// _particleAnimator.start();//add listenersaddEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
stage.addEventListener(Event.RESIZE, onResize);
onResize();
}
privatevarstage3DManager:Stage3DManager;
privatevarstage3DProxy:Stage3DProxy;
privatefunctioninitProxies():Void
{
// Define a new Stage3DManager for the Stage3D objectsstage3DManager=Stage3DManager.getInstance(stage);
// Create a new Stage3D proxy to contain the separate viewsstage3DProxy=stage3DManager.getFreeStage3DProxy(false, "enhanced");
stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATED, onContextCreated);
}
/** * Initialiser function for particle properties*/privatefunctioninitParticleFunc(prop:ParticleProperties):Void
{
prop.startTime=Math.random()*5-5;
prop.duration=5;
vardegree1:Float=Math.random() *Math.PI ;
vardegree2:Float=Math.random() *Math.PI*2;
varr:Float=Math.random() *50+400;
prop.nodes[ParticleVelocityNode.VELOCITY_VECTOR3D] =newVector3D(r*Math.sin(degree1) *Math.cos(degree2), r*Math.cos(degree1) *Math.cos(degree2), r*Math.sin(degree2));
}
/** * Navigation and render loop*/privatefunctiononEnterFrame(event:Event):Void
{
if (_move)
{
_cameraController.panAngle=0.3*(stage.mouseX-_lastMouseX) +_lastPanAngle;
_cameraController.tiltAngle=0.3*(stage.mouseY-_lastMouseY) +_lastTiltAngle;
}
// _view.render();
}
/** * Mouse down listener for navigation*/privatefunctiononMouseDown(event:MouseEvent):Void
{
_lastPanAngle=_cameraController.panAngle;
_lastTiltAngle=_cameraController.tiltAngle;
_lastMouseX=stage.mouseX;
_lastMouseY=stage.mouseY;
_move=true;
stage.addEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
}
/** * Mouse up listener for navigation*/privatefunctiononMouseUp(event:MouseEvent):Void
{
_move=false;
stage.removeEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
}
/** * Mouse stage leave listener for navigation*/privatefunctiononStageMouseLeave(event:Event):Void
{
_move=false;
stage.removeEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
}
/** * stage listener for resize events*/privatefunctiononResize(event:Event=null):Void
{
_view.width=stage.stageWidth;
_view.height=stage.stageHeight;
}
}
classAppDisplayextendsstarling.display.Sprite
{
publicfunctionnew()
{
super();
varq:Quad=newQuad(500, 500, 0xFF0000);
addChild(q);
}
}
The text was updated successfully, but these errors were encountered:
If we start application with small browser window at first, then maximize it, stage will be cutted
I've just modified basic/Particles sample Main class, so you can easily reproduce it.
How in can be fixed? Or are there any work arounds?
Just copy this code to basic/Particles/Main.hx and add
<haxelib name="starling" />
to project.xmlThe text was updated successfully, but these errors were encountered: