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
When creating a 2d sprite, and assigning values before the tiks, they are badly rendered.
In the example below, all sprites should the same SIZE
Current Behavior
When creating a sprite, should apply values without affecting the future behavior of the sprite2d projection
In the example below, all sprites are not the same SIZE
Possible Solution**
To be honest, it exceeds me and it's really complicated.
This suggests a deep understanding of the rendering.
i clean the code to make easy to read.
you can see the big issue inside the scene at start()
// HERARCHI: APP => STAGE => CAMERA => SCENES => GAMEOBJ//APP:class_appextendsPIXI.Application{constructor(){super({width: 800,height: 600,sharedTicker:true,backgroundColor: 0x303030});};run(){try{stage.initialize();}catch(e){throwconsole.error(e.stack)};};};// STAGE: scenesManagerclass_stageextendsPIXI.Stage{constructor(){super();this.sceneList={Scene_1:new_Scene_Base(3400,2600)};//scene cachethis._timer=-1;// fake timer update for change scenethis.debugSceneText={t:newPIXI.Text(''),_id:0,getnext(){this.t.text=`currentScene: ${this._id++}`}};this.addChild(this.debugSceneText.t);this.ticker=PIXI.ticker.shared.add(this.update,this);// game update sharedTicker:true,};initialize(){this.addChild(Camera);Camera.initialize();};update(delta){try{// refresh||change scene cacheif(--this._timer<0){this._timer=200;this.sceneList.Scene_1.end();Camera.initialize();Camera.setupToScene(this.sceneList.Scene_1);this.sceneList.Scene_1.start();this.debugSceneText.next}else{Camera.updateProjection();}}catch(e){throwconsole.error(e.stack)};};};// SCENE: batch create in a loading sceneclass_Scene_BaseextendsPIXI.projection.Container2d{constructor(){super()};// start when we succeed clear last 'scene,events,camera,fadeIn'// scene are constructed and batched in a buffer kit during the loading scene.// start build sprite required for this scene and apply data from jsonstart(){this.setupObjs();setTimeout(()=>this.setupObjs(200),300);setTimeout(()=>this.setupObjs(300),600);};end(){this.removeChildren();};setupObjs(x=100){for(leti=0,l=5;i<l;i++){vars=newPIXI.projection.Sprite2d(newPIXI.Texture.fromImage('required/assets/flowerTop.png'));this.addChild(s);// custom datas.rotation=i/Math.PI;// seem oks.anchor.set(0.5,1);s.position.set(x,85*i);s.scale.set(0.5);};};};//CAMERA: controler scene rendering , projection, view-port and culling.class_cameraextendsPIXI.projection.Container2d{constructor(){super()this._screenW=app.screen.width;this._screenH=app.screen.height;this._sceneW=app.screen.width;// scene widththis._sceneH=app.screen.height;// scene heightthis.far=newPIXI.Sprite(PIXI.Texture.WHITE);this.far.factor=0.5;this.scene=null;};initialize(){this._sceneW=app.screen.width;// scene widththis._sceneH=app.screen.height;// scene heightthis.position.set(this._screenW/2,this._screenH/2);// center camerathis.scene=null;this.removeChildren();this.parent.addChild(this.far);// add to stagethis.far.position.set(this._screenW/2,0);};setupToScene(scene){this.scene=scene;this._sceneW=scene.w;this._sceneH=scene.h;this.addChild(scene);// FIXME: when we creat new sprite it seem no take current setup, we need wait ~next tiks ?Camera.updateProjection();// make one update from current scene.};updateProjection(){constfar=this.far;const_fpX=0,_fpY=0,_fpF=0,_zoom=1;far.x=((this._screenW/2)-(this.pivot._x*_zoom))+_fpX;far.y=(-(this.pivot._y*_zoom))+_fpY;far.factor=_fpF;this.scale.set(_zoom);letpos=this.toLocal(far.position,undefined,undefined,undefined,PIXI.projection.TRANSFORM_STEP.BEFORE_PROJ);pos.y=-pos.y;pos.x=-pos.x;this.proj.setAxisY(pos,-far.factor);this.scene.children.forEach(s=>{s.proj.affine=PIXI.projection.AFFINE.AXIS_X});// update gameObjs affine};};varapp=new_app();document.body.appendChild(app.view);varCamera=new_camera()varstage=new_stage();app.stage=stage;app.run();
Thank in advance for any tips or suggest or fix.
note: It is likely that I misunderstand the problem or that the problem comes from a bad logic.
The text was updated successfully, but these errors were encountered:
Expected Behavior**
When creating a 2d sprite, and assigning values before the tiks, they are badly rendered.
In the example below, all sprites should the same SIZE
Current Behavior
When creating a sprite, should apply values without affecting the future behavior of the sprite2d projection
In the example below, all sprites are not the same SIZE
Possible Solution**
To be honest, it exceeds me and it's really complicated.
This suggests a deep understanding of the rendering.
Environment**
*node: "11.8.0"
*nw: "0.36.0 SDK"
pixi.js
version: 4.8.2 webGL- Running Example:
please to understand, copy and replace this code in this current link example:
https://pixijs.io/examples/#/projection/iso-basic.js
Sorry not available in pixiplayground.
i clean the code to make easy to read.
you can see the big issue inside the scene at start()
Thank in advance for any tips or suggest or fix.
note: It is likely that I misunderstand the problem or that the problem comes from a bad logic.
The text was updated successfully, but these errors were encountered: