[orx-mesh, orx-mesh-generator, orx-obj-loader] Add decal and tangent tools

This commit is contained in:
Edwin Jakobs
2024-09-25 09:51:46 +02:00
parent fb3bb6f7a6
commit e016891b1d
28 changed files with 1072 additions and 82 deletions

View File

@@ -1,7 +1,8 @@
package org.openrndr.extra.mesh
package org.openrndr.extra.objloader
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.VertexBuffer
import org.openrndr.extra.mesh.*
import org.openrndr.math.Vector2
import org.openrndr.math.Vector3
@@ -79,8 +80,8 @@ fun readObjMeshData(lines: Iterable<String>): CompoundMeshData {
IndexedPolygon(
if (hasPosition) indices.map { it[0] - 1 } else listOf(),
if (hasUV) indices.map { it[1] - 1 } else listOf(),
if (hasNormal) indices.map { it[2] - 1 } else listOf(),
if (hasColor) indices.map { it[0] - 1 } else listOf(),
if (hasNormal) indices.map { it[2] - 1 } else listOf(),
if (hasTangents) indices.map { it[2] - 1 } else listOf(),
if (hasBitangents) indices.map { it[2] - 1 } else listOf()
)
@@ -95,7 +96,7 @@ fun readObjMeshData(lines: Iterable<String>): CompoundMeshData {
}
}
val vertexData = VertexData(positions, normals, textureCoords, colors)
val vertexData = VertexData(positions, textureCoords, colors, normals)
return CompoundMeshData(
vertexData,
meshes.mapValues {

View File

@@ -1,4 +1,6 @@
package org.openrndr.extra.mesh
package org.openrndr.extra.objloader
import org.openrndr.extra.mesh.ICompoundMeshData
/**
* Convert mesh data to Wavefront OBJ representation