Fix problem in UV coord generation of plane meshes
This commit is contained in:
18
build.gradle
18
build.gradle
@@ -20,16 +20,26 @@ project.ext {
|
||||
spekVersion = "2.0.10"
|
||||
libfreenectVersion = "0.5.7-1.5.2"
|
||||
gsonVersion = "2.8.6"
|
||||
}
|
||||
|
||||
}
|
||||
switch (org.gradle.internal.os.OperatingSystem.current()) {
|
||||
case org.gradle.internal.os.OperatingSystem.WINDOWS:
|
||||
project.ext.openrndrOS = "windows"
|
||||
break
|
||||
case org.gradle.internal.os.OperatingSystem.LINUX:
|
||||
project.ext.openrndrOS = "linux-x64"
|
||||
break
|
||||
case org.gradle.internal.os.OperatingSystem.MAC_OS:
|
||||
project.ext.openrndrOS = "macos"
|
||||
break
|
||||
}
|
||||
dokka {
|
||||
moduleName = "$rootProject.name"
|
||||
outputDirectory = "$buildDir/docs"
|
||||
outputFormat = "html"
|
||||
includes = ['Module.md']
|
||||
sourceDirs = files(subprojects.collect { p -> new File(p.projectDir, "/src/main/kotlin") })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: 'idea'
|
||||
@@ -72,13 +82,11 @@ allprojects {
|
||||
runtimeOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
|
||||
}
|
||||
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
|
||||
javadoc {
|
||||
options.addBooleanOption 'Xdoclint:none', true
|
||||
}
|
||||
|
||||
18
orx-mesh-generators/build.gradle
Normal file
18
orx-mesh-generators/build.gradle
Normal file
@@ -0,0 +1,18 @@
|
||||
sourceSets {
|
||||
demo {
|
||||
java {
|
||||
srcDirs = ["src/demo/kotlin"]
|
||||
compileClasspath += main.getCompileClasspath()
|
||||
runtimeClasspath += main.getRuntimeClasspath()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
demoImplementation(project(":orx-camera"))
|
||||
demoImplementation("org.openrndr:openrndr-core:$openrndrVersion")
|
||||
demoRuntimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion")
|
||||
demoRuntimeOnly("org.openrndr:openrndr-gl3-natives-$openrndrOS:$openrndrVersion")
|
||||
|
||||
demoImplementation(sourceSets.getByName("main").output)
|
||||
}
|
||||
35
orx-mesh-generators/src/demo/kotlin/DemoBox.kt
Normal file
35
orx-mesh-generators/src/demo/kotlin/DemoBox.kt
Normal file
@@ -0,0 +1,35 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.DrawPrimitive
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.draw.shadeStyle
|
||||
import org.openrndr.extras.camera.Orbital
|
||||
import org.openrndr.extras.meshgenerators.boxMesh
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
program {
|
||||
val box = boxMesh(1.0, 1.0, 1.0)
|
||||
val texture = colorBuffer(256, 256)
|
||||
val s = texture.shadow
|
||||
for (y in 0 until 256) {
|
||||
for (x in 0 until 256) {
|
||||
s[x, y] = ColorRGBa(x/256.0, y/256.0, 0.0, 1.0)
|
||||
}
|
||||
}
|
||||
s.upload()
|
||||
|
||||
extend(Orbital())
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
drawer.shadeStyle = shadeStyle {
|
||||
fragmentTransform = """
|
||||
x_fill = texture(p_texture, va_texCoord0.xy);
|
||||
""".trimIndent()
|
||||
parameter("texture", texture)
|
||||
}
|
||||
drawer.vertexBuffer(box, DrawPrimitive.TRIANGLES)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ fun generatePlane(center: Vector3,
|
||||
|
||||
val corner = center - forward.normalized * (height*0.5) - right.normalized * (width * 0.5)
|
||||
|
||||
val step = Vector2(1.0 / width, 1.0 / height)
|
||||
val step = Vector2(1.0 / widthSegments, 1.0 / heightSegments)
|
||||
|
||||
for (v in 0 until heightSegments) {
|
||||
for (u in 0 until widthSegments) {
|
||||
|
||||
Reference in New Issue
Block a user