# HG changeset patch # User sam # Date 1716202381 -25200 # Node ID 5a8713d0afd529068b5cea39fedaa5385285cfb2 # Parent 0edb6e38dcd57a7aee50c491bf3380e46d1f36d2 did: fix bad naming diff -r 0edb6e38dcd5 -r 5a8713d0afd5 semicongine/mesh.nim --- a/semicongine/mesh.nim Mon May 20 17:34:04 2024 +0700 +++ b/semicongine/mesh.nim Mon May 20 17:53:01 2024 +0700 @@ -382,6 +382,8 @@ proc clearDirtyAttributes*(mesh: var MeshObject) = mesh.dirtyAttributes.reset +# MESH-TOOLS + proc transform*[T: GPUType](mesh: var MeshObject, attribute: string, transform: Mat4) = if mesh.vertexData.contains(attribute): for i in 0 ..< mesh.vertexData[attribute].len: @@ -393,17 +395,12 @@ raise newException(Exception, &"Attribute {attribute} is not defined for mesh {mesh}") mesh.dirtyAttributes.add attribute -proc applyTransformToVertices*(mesh: var MeshObject, positionAttribute = DEFAULT_POSITION_ATTRIBUTE) = - for i in 0 ..< mesh.vertexData[positionAttribute].len: - mesh.vertexData[positionAttribute][i] = mesh.transform * mesh.vertexData[positionAttribute][i, Vec3f] - mesh.transform = Unit4 - -func getCollisionPoints*(mesh: MeshObject, positionAttribute = DEFAULT_POSITION_ATTRIBUTE): seq[Vec3f] = +func getMeshPoints*(mesh: MeshObject, positionAttribute = DEFAULT_POSITION_ATTRIBUTE): seq[Vec3f] = for p in mesh[positionAttribute, Vec3f][]: result.add mesh.transform * p func getCollider*(mesh: MeshObject, positionAttribute = DEFAULT_POSITION_ATTRIBUTE): Collider = - return mesh.getCollisionPoints(positionAttribute).calculateCollider(Points) + return mesh.getMeshPoints(positionAttribute).calculateCollider(Points) proc asNonIndexedMesh*(mesh: MeshObject): MeshObject = if mesh.indexType == None: