|
apalabrados, Newbie
Posted: 27 September 2013 11:42 PM Total Posts: 13
Hi,
I have a Viewer that display a Mesh filled by Facets.
Firstly I loaded the mesh with lightweight geometries and worked like a charm and the last object I loaded have 66868 facets (not too much by my point of view). The fact is that using the mouseevents for rotating the scene, the result is extremely slow.
The code for mouseEvents is:
private function onEnterFrame(e:Event):void {
var cameraSpeed:Number = 0.3;
if (move) {
camera.panAngle = cameraSpeed*(stage.mouseX - lastMouseX) + lastPanAngle;
camera.tiltAngle = cameraSpeed*(stage.mouseY - lastMouseY) + lastTiltAngle;
}
camera.hover();
View.render();
}
What technique should I use to accelerate the movement?
Thanks.
|
koblongata, Newbie
Posted: 30 September 2013 08:54 PM Total Posts: 28
[ # 1 ]
try merge command
var merge:Merge = new Merge(); var mergedMesh:Mesh = new Mesh(new Geometry()); merge.apply(mergedMesh, yourMeshHere);
then try to rotate the merged mesh, see how it goes.
|
SharpEdge, Member
Posted: 01 October 2013 11:49 AM Total Posts: 94
[ # 2 ]
You should keep low the draw calls having fewer Meshes possible.
The number of polygons is not a big problem compared to the number of your meshes, because for each mesh there is a draw call.
|
apalabrados, Newbie
Posted: 02 October 2013 08:02 PM Total Posts: 13
[ # 3 ]
Hi,
@koblongata, I have done what you said but results are the same. What a pity!
@SharpEdge, I have only one Mesh where I put all vertices from my shape.
There must be a solution due to I have put the same object in other program and run perfectly with no delay. I do not know how to accomplish that.
|
koblongata, Newbie
Posted: 02 October 2013 08:12 PM Total Posts: 28
[ # 4 ]
is it running in release mode in a release flash player
|
apalabrados, Newbie
Posted: 02 October 2013 08:27 PM Total Posts: 13
[ # 5 ]
Hi @koblongata, I’m using Flex Builder 4.6 and run it on a web browser.
|
koblongata, Newbie
Posted: 02 October 2013 08:41 PM Total Posts: 28
[ # 6 ]
hmm… post the code and asset
|
apalabrados, Newbie
Posted: 02 October 2013 08:46 PM Total Posts: 13
[ # 7 ]
Here is where i load vertices and create the Mesh:
private function loadObject(evt:Event):void {
readVertices = new Reader;
readVertices.parse( _file.data );
for (var index:int=0; index < readVertices.data.solid.length; index++) {
myMesh.addFace( new Face(
new Vertex( readVertices.data.solid[index][0]._x, readVertices.data.solid[index][0]._y, readVertices.data.solid[index][0]._z ),
new Vertex( readVertices.data.solid[index][1]._x, readVertices.data.solid[index][1]._y, readVertices.data.solido[index][1]._z ),
new Vertex( readVertices.data.solid[index][2]._x, readVertices.data.solid[index][2]._y, readVertices.data.solid[index][2]._z )
) );
}
addEventListener(Event.ENTER_FRAME, onEnterFrame);
this.stage.addEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
this.stage.addEventListener(MouseEvent.MOUSE_UP, MouseUp);
this.stage.addEventListener(MouseEvent.MOUSE_WHEEL, MouseWheel);
var merge:Merge = new Merge;
var mergedMesh:Mesh = new Mesh(new Geometry);
merge.apply(mergedMesh, myMesh);
initScene();
}
|
koblongata, Newbie
Posted: 02 October 2013 09:05 PM Total Posts: 28
[ # 8 ]
what does this addFace method do?
better post a runnable code that reproduce the problem so it’s easier to help
|
apalabrados, Newbie
Posted: 02 October 2013 09:15 PM Total Posts: 13
[ # 9 ]
how can i put a runnable code?
|
koblongata, Newbie
Posted: 02 October 2013 11:37 PM Total Posts: 28
[ # 10 ]
some code others can put in their IDE and compile I meant, a document class would be nice, and link to the asset file on dropbox etc..
|