Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Class #33

Open
peteshand opened this issue Feb 18, 2015 · 9 comments
Open

Merge Class #33

peteshand opened this issue Feb 18, 2015 · 9 comments

Comments

@peteshand
Copy link

It seems the Merge class isn't working, anyone else experiencing this?

@peteshand
Copy link
Author

For anyone else experiencing the same issue, change the follow to resolve:
line 148 to:
destGeom = new Geometry();

and add the following line to the bottom of the private merge functuion within Merge.hx:
destMesh.geometry.addSubGeometry(destGeom.subGeometries[0]);

@Greg209
Copy link
Member

Greg209 commented Mar 9, 2015

I just tried the Merge class without any changes and it seemed to work for for my example. Simply having a plane & a sphere then using the 'apply' method.

Did you have an example that was failing?

@peteshand
Copy link
Author

Hi Greg

What target are you using? This issue only effects the html5 target

@Greg209
Copy link
Member

Greg209 commented Mar 9, 2015

Ah - I tried mac (cpp). I'll give html a go and see. Thanks

@peteshand
Copy link
Author

I think it has to do with the fact that the geometry is being overridden by a new Geometry object, Due to slightly different interpretation of the syntax. So any references to the Geometry object are getting lost. Instead the subGeometries need to be added to the current Geometry object

@Greg209
Copy link
Member

Greg209 commented Mar 10, 2015

Just a quick update.... All the data from the merge seems to be working e.g. vertices, indices, etc that I've seen, so it seems like there is some invalidation that's not occuring on HTML. It also occurs targetting Neko as well. What's weird and is a bit of a workaround is to simply clone the resulting mesh and that (from my tests anyway) seems to fix it, without the changes.

Still looking for the missing bit though

@jcward
Copy link

jcward commented Sep 30, 2015

FYI, I'm trying to merge a bunch of cubes, and it crashes in neko, but works fine in html5 / linux targets.

var m = new away3d.tools.commands.Merge();
var result:Mesh = cubes.shift();
m.applyToMeshes(result, cubes);
scene.addChild(result);
>lime test neko
Called from ? line 1
Called from ApplicationMain.hx line 138
Called from ApplicationMain.hx line 51
Called from lime/app/Application.hx line 218
Called from lime/_backend/native/NativeApplication.hx line 120
Called from a C function
Called from lime/_backend/native/NativeApplication.hx line 274
Called from lime/app/Event.hx line 141
Called from lime/app/Application.hx line 107
Called from lime/app/Application.hx line 675
Called from openfl/display/Stage.hx line 1105
Called from openfl/_internal/renderer/opengl/GLRenderer.hx line 303
Called from openfl/_internal/renderer/opengl/GLRenderer.hx line 340
Called from openfl/display/DisplayObjectContainer.hx line 1007
Called from openfl/display/OpenGLView.hx line 185
Called from openfl/display3D/Context3D.hx line 668
Called from Basic_Shading.hx line 290
Called from away3d/containers/View3D.hx line 891
Called from away3d/core/render/RendererBase.hx line 237
Called from away3d/core/render/DefaultRenderer.hx line 60
Called from a C function
Called from away3d/core/render/RendererBase.hx line 276
Called from away3d/core/render/DefaultRenderer.hx line 102
Called from away3d/core/render/DefaultRenderer.hx line 164
Called from away3d/materials/MaterialBase.hx line 454
Called from away3d/materials/passes/CompiledPass.hx line 621
Called from away3d/core/base/SubMesh.hx line 234
Called from away3d/core/base/SubGeometryBase.hx line 145
Called from openfl/display3D/IndexBuffer3D.hx line 78
Called from lime/utils/ArrayBufferView.hx line 292
Called from /opt/haxe/std/neko/_std/Std.hx line 39
Uncaught exception - std@math_floor

@Greg209
Copy link
Member

Greg209 commented Sep 30, 2015

Hmm. Just tried the following, based on your code snippet and Neko worked fine for me on OSX.

    var cubes = new Array<Mesh>();
    for (i in 0...100) {
        var s = 25+Std.random(50);
        var m = new Mesh(new away3d.primitives.CubeGeometry(s, s, s), new away3d.materials.ColorMaterial(0x009900));
        m.x = -1000 + Std.random(2000);
        m.y = Std.random(600);
        m.z = -1000 + Std.random(2000);
        cubes.push(m);
    }

    var m = new away3d.tools.commands.Merge();
    var result:Mesh = cubes.shift();
    m.applyToMeshes(result, cubes);
    _view.scene.addChild(result);

Are you doing anything different?

@jcward
Copy link

jcward commented Sep 30, 2015

I'm reusing the same geometry and material instance every cube I generate, but otherwise no. It could be a neko/linux thing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants