Add descriptions to demos

This commit is contained in:
Abe Pazos
2025-11-22 19:08:30 +01:00
parent 72368deb85
commit 522627ca51
45 changed files with 608 additions and 89 deletions

View File

@@ -10,6 +10,15 @@ import org.openrndr.extra.objloader.loadOBJMeshData
import org.openrndr.math.Vector3
import java.io.File
/**
* Tangent and bitangent vectors are used in shader programs for tangent space normal mapping / lighting
* and certain forms of displacement mapping.
*
* This demo shows:
* - how to create a triangulated `MeshData`.
* - how to estimate the tangents of this MeshData.
* - How to use the tangent and bitangent attributes in GLSL code.
*/
fun main() = application {
configure {
width = 720
@@ -29,12 +38,11 @@ fun main() = application {
fragmentTransform = """
vec3 viewTangent = (u_viewNormalMatrix * u_modelNormalMatrix * vec4(va_tangent, 0.0)).xyz;
vec3 viewBitangent = (u_viewNormalMatrix * u_modelNormalMatrix * vec4(va_bitangent, 0.0)).xyz;
float c = cos(100.0*dot(v_worldPosition, va_normal)) * 0.5 + 0.5;
float c = cos(100.0 * dot(v_worldPosition, va_normal)) * 0.5 + 0.5;
//x_fill.rgb = normalize(viewTangent)*0.5+0.5;
x_fill.rgb = vec3(c);
""".trimIndent()
//x_fill.rgb = normalize(viewTangent) * 0.5 + 0.5;
x_fill.rgb = vec3(c);
""".trimIndent()
}
drawer.vertexBuffer(objVB, DrawPrimitive.TRIANGLES)