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

Polygons.addThreeJsMesh: repetitive code when adding mesh to a map #30

Open
meszaros-lajos-gyorgy opened this issue Oct 9, 2024 · 0 comments

Comments

@meszaros-lajos-gyorgy
Copy link
Collaborator

The following code has to be executed in order to have a mesh positioned to the map's origin:

const mesh = createPlaneMesh({ size: 1000, texture: Texture.missingTexture })

applyTransformations(mesh)
mesh.translateX(map.config.offset.x)
mesh.translateY(map.config.offset.y)
mesh.translateZ(map.config.offset.z)
applyTransformations(mesh)

map.polygons.addThreeJsMesh(mesh)

Another way of adding multiple meshes to the map is the following:

const meshes: Mesh[] = []

// ...

meshes
  .forEach((mesh) => {
    applyTransformations(mesh)
    mesh.translateX(map.config.offset.x)
    mesh.translateY(map.config.offset.y)
    mesh.translateZ(map.config.offset.z)
    applyTransformations(mesh)

    map.polygons.addThreeJsMesh(mesh, { tryToQuadify: DONT_QUADIFY, shading: SHADING_SMOOTH })
  })

These should be handled internally similar to ArxMap.add(..., true)

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

1 participant