Put demo assets into /demo-data/ (#104)

This commit is contained in:
Abe Pazos
2020-05-16 19:53:32 +02:00
committed by GitHub
parent b6065b7198
commit 0caedcd34c
22 changed files with 53 additions and 54 deletions

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -10,7 +10,6 @@ import org.openrndr.color.ColorRGBa
import org.openrndr.color.rgb import org.openrndr.color.rgb
import org.openrndr.draw.loadImage import org.openrndr.draw.loadImage
import org.openrndr.extensions.SingleScreenshot import org.openrndr.extensions.SingleScreenshot
import org.openrndr.resourceUrl
import kotlin.math.cos import kotlin.math.cos
import kotlin.math.sin import kotlin.math.sin

View File

@@ -4,7 +4,6 @@ import org.openrndr.draw.*
import org.openrndr.extensions.SingleScreenshot import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.fx.blur.* import org.openrndr.extra.fx.blur.*
import org.openrndr.math.Polar import org.openrndr.math.Polar
import org.openrndr.resourceUrl
import kotlin.math.sin import kotlin.math.sin
fun main() { fun main() {
@@ -39,8 +38,7 @@ fun main() {
// On this buffer we will draw the dry buffer with an effect applied // On this buffer we will draw the dry buffer with an effect applied
val wet = colorBuffer(dry.width, dry.height) val wet = colorBuffer(dry.width, dry.height)
val font = loadFont(resourceUrl("/data/fonts/IBMPlexMono-Regular" + val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 16.0)
".ttf"), 16.0)
extend { extend {
// Draw two moving circles // Draw two moving circles

View File

@@ -3,7 +3,6 @@ package org.openrndr.extra.fx
import org.openrndr.draw.ColorFormat import org.openrndr.draw.ColorFormat
import org.openrndr.draw.ColorType import org.openrndr.draw.ColorType
import org.openrndr.resourceUrl import org.openrndr.resourceUrl
import java.net.URL
internal class FilterTools internal class FilterTools

View File

@@ -1,9 +1,11 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.draw.* import org.openrndr.draw.ColorBuffer
import org.openrndr.draw.isolatedWithTarget
import org.openrndr.draw.loadFont
import org.openrndr.draw.renderTarget
import org.openrndr.extra.runway.* import org.openrndr.extra.runway.*
import org.openrndr.math.smoothstep import org.openrndr.math.smoothstep
import org.openrndr.resourceUrl
/** /**
* This demonstrates an image reinterpretation effect. * This demonstrates an image reinterpretation effect.
@@ -20,7 +22,7 @@ fun main() = application {
val rt = renderTarget(256, 256) { val rt = renderTarget(256, 256) {
colorBuffer() colorBuffer()
} }
val font = loadFont(resourceUrl("/data/fonts/IBMPlexMono-Regular.ttf"), 256.0) val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 256.0)
val alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" val alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
extend { extend {
drawer.isolatedWithTarget(rt) { drawer.isolatedWithTarget(rt) {

View File

@@ -2,7 +2,6 @@ import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.draw.* import org.openrndr.draw.*
import org.openrndr.extra.runway.* import org.openrndr.extra.runway.*
import org.openrndr.resourceUrl
/** /**
* This demonstrates an image feedback effect. It starts from a single image. * This demonstrates an image feedback effect. It starts from a single image.
@@ -20,7 +19,7 @@ fun main() = application {
val rt = renderTarget(256, 256) { val rt = renderTarget(256, 256) {
colorBuffer() colorBuffer()
} }
val startImage = loadImage(resourceUrl("/data/images/portrait.jpg")) val startImage = loadImage("demo-data/images/portrait.jpg")
drawer.isolatedWithTarget(rt) { drawer.isolatedWithTarget(rt) {
drawer.ortho(rt) drawer.ortho(rt)

View File

@@ -2,10 +2,10 @@ import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.draw.ColorBuffer import org.openrndr.draw.ColorBuffer
import org.openrndr.draw.loadFont import org.openrndr.draw.loadFont
import org.openrndr.extra.runway.* import org.openrndr.extra.runway.AttnGANRequest
import org.openrndr.resourceUrl import org.openrndr.extra.runway.AttnGANResult
import org.openrndr.extra.runway.runwayQuery
import java.io.File import java.io.File
import java.net.URL
/** /**
* This demonstrates a text to image network. It generates images from single words. * This demonstrates a text to image network. It generates images from single words.
@@ -20,10 +20,10 @@ fun main() = application {
program { program {
val runwayHost = "http://localhost:8000/query" val runwayHost = "http://localhost:8000/query"
val dictionary = URL("demo-data/dictionary/words.txt").readText().split("\n") val words = File("demo-data/words/words.txt").readText().split("\n")
val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 72.0) val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 72.0)
extend { extend {
val text = dictionary.random() val text = words.random()
val result: AttnGANResult = runwayQuery(runwayHost, AttnGANRequest(text)) val result: AttnGANResult = runwayQuery(runwayHost, AttnGANRequest(text))
val image = ColorBuffer.fromUrl(result.result) val image = ColorBuffer.fromUrl(result.result)
drawer.fontMap = font drawer.fontMap = font

View File

@@ -2,10 +2,10 @@ import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.draw.ColorBuffer import org.openrndr.draw.ColorBuffer
import org.openrndr.draw.loadFont import org.openrndr.draw.loadFont
import org.openrndr.extra.runway.* import org.openrndr.extra.runway.AttnGANRequest
import org.openrndr.resourceUrl import org.openrndr.extra.runway.AttnGANResult
import org.openrndr.extra.runway.runwayQuery
import java.io.File import java.io.File
import java.net.URL
/** /**
* This demonstrates a text to image network. It generates images from simple sentences. * This demonstrates a text to image network. It generates images from simple sentences.
@@ -20,10 +20,10 @@ fun main() = application {
program { program {
val runwayHost = "http://localhost:8000/query" val runwayHost = "http://localhost:8000/query"
val nouns = URL(resourceUrl("/data/dictionary/nouns.txt")).readText().split("\n") val nouns = File("demo-data/words/nouns.txt").readText().split("\n")
val prepositions = URL(resourceUrl("/data/dictionary/prepositions.txt")).readText().split("\n") val prepositions = File("demo-data/words/prepositions.txt").readText().split("\n")
val adjectives = URL(resourceUrl("/data/dictionary/adjectives.txt")).readText().split("\n") val adjectives = File("demo-data/words/adjectives.txt").readText().split("\n")
val font = loadFont(resourceUrl("/data/fonts/IBMPlexMono-Regular.ttf"), 36.0) val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 36.0)
extend { extend {
val text = "a ${adjectives.random()} ${nouns.random()} ${prepositions.random()} a ${adjectives.random()} ${nouns.random()}" val text = "a ${adjectives.random()} ${nouns.random()} ${prepositions.random()} a ${adjectives.random()} ${nouns.random()}"

View File

@@ -1,8 +1,10 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.draw.* import org.openrndr.draw.ColorBuffer
import org.openrndr.draw.isolatedWithTarget
import org.openrndr.draw.loadImage
import org.openrndr.draw.renderTarget
import org.openrndr.extra.runway.* import org.openrndr.extra.runway.*
import org.openrndr.resourceUrl
/** /**
* This demonstrates the body estimation model of DensePose * This demonstrates the body estimation model of DensePose
@@ -18,7 +20,7 @@ fun main() = application {
val rt = renderTarget(512, 512) { val rt = renderTarget(512, 512) {
colorBuffer() colorBuffer()
} }
val startImage = loadImage(resourceUrl("/data/images/peopleCity01.jpg")) val startImage = loadImage("demo-data/images/peopleCity01.jpg")
drawer.isolatedWithTarget(rt) { drawer.isolatedWithTarget(rt) {
drawer.ortho(rt) drawer.ortho(rt)

View File

@@ -5,7 +5,6 @@ import org.openrndr.extra.fx.transform.FlipVertically
import org.openrndr.extra.runway.DeOldifyRequest import org.openrndr.extra.runway.DeOldifyRequest
import org.openrndr.extra.runway.DeOldifyResponse import org.openrndr.extra.runway.DeOldifyResponse
import org.openrndr.extra.runway.runwayQuery import org.openrndr.extra.runway.runwayQuery
import org.openrndr.ffmpeg.ScreenRecorder
import org.openrndr.ffmpeg.VideoPlayerFFMPEG import org.openrndr.ffmpeg.VideoPlayerFFMPEG
/** /**

View File

@@ -22,7 +22,7 @@ fun main() = application {
camera.play() camera.play()
val flip = FlipVertically() val flip = FlipVertically()
val font = loadFont(resourceUrl("/data/fonts/IBMPlexMono-Regular.ttf"), 12.0) val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 12.0)
camera.newFrame.listen { camera.newFrame.listen {
flip.apply(it.frame, image) flip.apply(it.frame, image)
} }

View File

@@ -26,11 +26,11 @@ fun main() = application {
val attnHost = "http://localhost:8001/query" val attnHost = "http://localhost:8001/query"
val im2txtHost = "http://localhost:8000/query" val im2txtHost = "http://localhost:8000/query"
val nouns = URL(resourceUrl("/data/dictionary/nouns.txt")).readText().split("\n") val nouns = File("demo-data/words/nouns.txt").readText().split("\n")
val prepositions = URL(resourceUrl("/data/dictionary/prepositions.txt")).readText().split("\n") val prepositions = File("demo-data/words/prepositions.txt").readText().split("\n")
val adjectives = URL(resourceUrl("/data/dictionary/adjectives.txt")).readText().split("\n") val adjectives = File("demo-data/words/adjectives.txt").readText().split("\n")
val font = loadFont("data/fonts/IBMPlexMono-Regular.ttf", 36.0) val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 36.0)
var text = "a ${adjectives.random()} ${nouns.random()} ${prepositions.random()} a ${adjectives.random()} ${nouns.random()}" var text = "a ${adjectives.random()} ${nouns.random()} ${prepositions.random()} a ${adjectives.random()} ${nouns.random()}"

View File

@@ -27,7 +27,7 @@ fun main() = application {
camera.play() camera.play()
val flip = FlipVertically() val flip = FlipVertically()
val font = loadFont("data/fonts/IBMPlexMono-Regular.ttf", 24.0) val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 24.0)
camera.newFrame.listen { camera.newFrame.listen {
flip.apply(it.frame, image) flip.apply(it.frame, image)
} }

View File

@@ -20,9 +20,9 @@ fun main() = application {
} }
program { program {
val image = loadImage("data/images/pm5544.png") val image = loadImage("demo-data/images/pm5544.png")
val font = loadFont("data/fonts/IBMPlexMono-Regular.ttf", 24.0) val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 24.0)
extend { extend {
drawer.fontMap = font drawer.fontMap = font
val response: Im2txtResult = val response: Im2txtResult =

View File

@@ -30,7 +30,7 @@ fun main() = application {
camera.play() camera.play()
val flip = FlipVertically() val flip = FlipVertically()
val font = loadFont("data/fonts/IBMPlexMono-Regular.ttf", 24.0) val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 24.0)
camera.newFrame.listen { camera.newFrame.listen {
flip.apply(it.frame, image) flip.apply(it.frame, image)
} }

View File

@@ -1,11 +1,12 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.draw.loadFont import org.openrndr.draw.loadFont
import org.openrndr.extra.runway.* import org.openrndr.extra.runway.Gpt2Request
import org.openrndr.ffmpeg.ScreenRecorder import org.openrndr.extra.runway.Gpt2Result
import org.openrndr.resourceUrl import org.openrndr.extra.runway.runwayQuery
import org.openrndr.shape.Rectangle import org.openrndr.shape.Rectangle
import org.openrndr.text.Writer import org.openrndr.text.Writer
import java.io.File
import java.net.URL import java.net.URL
/** /**
@@ -23,13 +24,13 @@ fun main() = application {
val runwayHost = "http://localhost:8000/query" val runwayHost = "http://localhost:8000/query"
val nouns = URL(resourceUrl("/data/dictionary/nouns.txt")).readText().split("\n") val nouns = File("demo-data/words/nouns.txt").readText().split("\n")
val prepositions = URL(resourceUrl("/data/dictionary/prepositions.txt")).readText().split("\n") val prepositions = File("demo-data/words/prepositions.txt").readText().split("\n")
val adjectives = URL(resourceUrl("/data/dictionary/adjectives.txt")).readText().split("\n") val adjectives = File("demo-data/words/adjectives.txt").readText().split("\n")
val font = loadFont(resourceUrl("/data/fonts/IBMPlexMono-Regular.ttf"), 36.0) val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 36.0)
val promptFont = loadFont(resourceUrl("/data/fonts/IBMPlexMono-Regular.ttf"), 24.0) val promptFont = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 24.0)
extend { extend {
val prompt = "a ${adjectives.random()} ${nouns.random()} ${prepositions.random()} a ${adjectives.random()} ${nouns.random()}" val prompt = "a ${adjectives.random()} ${nouns.random()} ${prepositions.random()} a ${adjectives.random()} ${nouns.random()}"