|
Post by sbehnke on Jul 10, 2019 1:19:44 GMT
I'm trying to get my Yaml parsing working and most things seem to work fine. I have a very curious problem with stripes though. Rending the following code with my Yaml parser results in: - add: camera width: 480 height: 320 field-of-view: 1.047197551196598 from: [-5, 2, -4] to: [0, 2, 0] up: [0, 1, 0]
- add: light at: [-3, 6, -8] intensity: [1.2, 1.2, 1.2]
# sphere - add: sphere material: pattern: type: stripes colors: - [1, 0.5, 0] - [1, 0.3, 0] transform: - [ rotate-z, 1.570796326794897 ] ambient: 0.15 transform: - [ scale, 2.0, 2.0, 2.0 ] - [ translate, 1.5, 1.5, 0 ]
Writing the same Sphere by hand and then removing the object from the same world and adding it renders what appears to be the correct stripe pattern. let sphere = Sphere() sphere.material.pattern = StripePattern(a: Color.init(r: 1, g: 0.5, b: 0), b: Color(r: 1, g: 0.3, b: 0)) sphere.transform = Matrix4x4.translated(x: 1.5, y: 1.5, z: 0) * Matrix4x4.scaled(x: 2.0, y: 2.0, z: 2.0) let radians = Double.pi / 2 sphere.material.pattern?.transform = Matrix4x4.rotatedZ(radians) I've looked over my matrices, my inverse matrices, the implementation for the patternAt() function for stripe and I cannot for the life of me figure out how the normal stripe pattern starts to look like it repeats on more than one axis. Any ideas what I should poke at to try to figure this one out?
|
|
|
Post by sbehnke on Jul 10, 2019 1:22:30 GMT
Why is it that whenever I go through the effort of explaining something, I find the problem immediately? Thanks for being my rubber duck. I was creating the CheckerPattern where the type is Stripe. Now I feel dumb.
|
|