joonsrenderer 1.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +53 -0
- data/.mvn/extensions.xml +8 -0
- data/CHANGELOG.md +2 -0
- data/Gemfile +6 -0
- data/LICENSE +674 -0
- data/README.md +2 -0
- data/Rakefile +43 -0
- data/docs/.gitignore +6 -0
- data/docs/_config.yml +20 -0
- data/docs/_includes/footer.html +38 -0
- data/docs/_includes/head.html +15 -0
- data/docs/_includes/header.html +27 -0
- data/docs/_includes/icon-github.html +1 -0
- data/docs/_includes/icon-github.svg +1 -0
- data/docs/_includes/icon-twitter.html +1 -0
- data/docs/_includes/icon-twitter.svg +1 -0
- data/docs/_layouts/default.html +20 -0
- data/docs/_layouts/page.html +14 -0
- data/docs/_layouts/post.html +15 -0
- data/docs/_posts/2017-01-08-animated_ray_tracing.md +72 -0
- data/docs/_posts/2017-01-08-welcome.md +78 -0
- data/docs/_sass/_base.scss +206 -0
- data/docs/_sass/_layout.scss +242 -0
- data/docs/_sass/_syntax-highlighting.scss +71 -0
- data/docs/about.md +12 -0
- data/docs/assets/Animation.ogv +0 -0
- data/docs/assets/Animation.png +0 -0
- data/docs/assets/basic.png +0 -0
- data/docs/assets/basic_traced.png +0 -0
- data/docs/css/main.scss +38 -0
- data/docs/favicon.ico +0 -0
- data/docs/feed.xml +30 -0
- data/docs/index.html +38 -0
- data/joonsrenderer.gemspec +23 -0
- data/lib/joonsrenderer.rb +12 -0
- data/lib/joonsrenderer/version.rb +3 -0
- data/pom.rb +75 -0
- data/pom.xml +163 -0
- data/src/main/java/SunflowGUI.java +1354 -0
- data/src/main/java/joons/JRFiller.java +79 -0
- data/src/main/java/joons/JRImagePanel.java +141 -0
- data/src/main/java/joons/JRRecorder.java +183 -0
- data/src/main/java/joons/JRStatics.java +199 -0
- data/src/main/java/joons/JoonsRenderer.java +837 -0
- data/src/main/java/org/sunflow/AsciiFileSunflowAPI.java +98 -0
- data/src/main/java/org/sunflow/Benchmark.java +313 -0
- data/src/main/java/org/sunflow/BinaryFileSunflowAPI.java +228 -0
- data/src/main/java/org/sunflow/FileSunflowAPI.java +354 -0
- data/src/main/java/org/sunflow/PluginRegistry.java +322 -0
- data/src/main/java/org/sunflow/RealtimeBenchmark.java +125 -0
- data/src/main/java/org/sunflow/RenderObjectMap.java +344 -0
- data/src/main/java/org/sunflow/SunflowAPI.java +762 -0
- data/src/main/java/org/sunflow/SunflowAPIInterface.java +277 -0
- data/src/main/java/org/sunflow/core/AccelerationStructure.java +20 -0
- data/src/main/java/org/sunflow/core/AccelerationStructureFactory.java +36 -0
- data/src/main/java/org/sunflow/core/BucketOrder.java +21 -0
- data/src/main/java/org/sunflow/core/Camera.java +125 -0
- data/src/main/java/org/sunflow/core/CameraLens.java +29 -0
- data/src/main/java/org/sunflow/core/CausticPhotonMapInterface.java +15 -0
- data/src/main/java/org/sunflow/core/Display.java +78 -0
- data/src/main/java/org/sunflow/core/Filter.java +27 -0
- data/src/main/java/org/sunflow/core/GIEngine.java +42 -0
- data/src/main/java/org/sunflow/core/Geometry.java +157 -0
- data/src/main/java/org/sunflow/core/GlobalPhotonMapInterface.java +21 -0
- data/src/main/java/org/sunflow/core/ImageSampler.java +26 -0
- data/src/main/java/org/sunflow/core/Instance.java +224 -0
- data/src/main/java/org/sunflow/core/InstanceList.java +83 -0
- data/src/main/java/org/sunflow/core/IntersectionState.java +120 -0
- data/src/main/java/org/sunflow/core/LightSample.java +104 -0
- data/src/main/java/org/sunflow/core/LightServer.java +382 -0
- data/src/main/java/org/sunflow/core/LightSource.java +67 -0
- data/src/main/java/org/sunflow/core/Modifier.java +16 -0
- data/src/main/java/org/sunflow/core/Options.java +20 -0
- data/src/main/java/org/sunflow/core/ParameterList.java +758 -0
- data/src/main/java/org/sunflow/core/PhotonStore.java +62 -0
- data/src/main/java/org/sunflow/core/PrimitiveList.java +70 -0
- data/src/main/java/org/sunflow/core/Ray.java +219 -0
- data/src/main/java/org/sunflow/core/RenderObject.java +25 -0
- data/src/main/java/org/sunflow/core/Scene.java +377 -0
- data/src/main/java/org/sunflow/core/SceneParser.java +58 -0
- data/src/main/java/org/sunflow/core/Shader.java +30 -0
- data/src/main/java/org/sunflow/core/ShadingCache.java +84 -0
- data/src/main/java/org/sunflow/core/ShadingState.java +939 -0
- data/src/main/java/org/sunflow/core/Statistics.java +85 -0
- data/src/main/java/org/sunflow/core/Tesselatable.java +36 -0
- data/src/main/java/org/sunflow/core/Texture.java +128 -0
- data/src/main/java/org/sunflow/core/TextureCache.java +48 -0
- data/src/main/java/org/sunflow/core/accel/BoundingIntervalHierarchy.java +652 -0
- data/src/main/java/org/sunflow/core/accel/KDTree.java +833 -0
- data/src/main/java/org/sunflow/core/accel/NullAccelerator.java +30 -0
- data/src/main/java/org/sunflow/core/accel/UniformGrid.java +329 -0
- data/src/main/java/org/sunflow/core/bucket/BucketOrderFactory.java +26 -0
- data/src/main/java/org/sunflow/core/bucket/ColumnBucketOrder.java +21 -0
- data/src/main/java/org/sunflow/core/bucket/DiagonalBucketOrder.java +28 -0
- data/src/main/java/org/sunflow/core/bucket/HilbertBucketOrder.java +65 -0
- data/src/main/java/org/sunflow/core/bucket/InvertedBucketOrder.java +28 -0
- data/src/main/java/org/sunflow/core/bucket/RandomBucketOrder.java +49 -0
- data/src/main/java/org/sunflow/core/bucket/RowBucketOrder.java +21 -0
- data/src/main/java/org/sunflow/core/bucket/SpiralBucketOrder.java +43 -0
- data/src/main/java/org/sunflow/core/camera/FisheyeLens.java +25 -0
- data/src/main/java/org/sunflow/core/camera/PinholeLens.java +43 -0
- data/src/main/java/org/sunflow/core/camera/SphericalLens.java +22 -0
- data/src/main/java/org/sunflow/core/camera/ThinLens.java +107 -0
- data/src/main/java/org/sunflow/core/display/FastDisplay.java +119 -0
- data/src/main/java/org/sunflow/core/display/FileDisplay.java +83 -0
- data/src/main/java/org/sunflow/core/display/FrameDisplay.java +97 -0
- data/src/main/java/org/sunflow/core/display/ImgPipeDisplay.java +109 -0
- data/src/main/java/org/sunflow/core/filter/BlackmanHarrisFilter.java +28 -0
- data/src/main/java/org/sunflow/core/filter/BoxFilter.java +16 -0
- data/src/main/java/org/sunflow/core/filter/CatmullRomFilter.java +29 -0
- data/src/main/java/org/sunflow/core/filter/CubicBSpline.java +32 -0
- data/src/main/java/org/sunflow/core/filter/GaussianFilter.java +24 -0
- data/src/main/java/org/sunflow/core/filter/LanczosFilter.java +30 -0
- data/src/main/java/org/sunflow/core/filter/MitchellFilter.java +28 -0
- data/src/main/java/org/sunflow/core/filter/SincFilter.java +25 -0
- data/src/main/java/org/sunflow/core/filter/TriangleFilter.java +16 -0
- data/src/main/java/org/sunflow/core/gi/AmbientOcclusionGIEngine.java +57 -0
- data/src/main/java/org/sunflow/core/gi/FakeGIEngine.java +48 -0
- data/src/main/java/org/sunflow/core/gi/InstantGI.java +194 -0
- data/src/main/java/org/sunflow/core/gi/IrradianceCacheGIEngine.java +268 -0
- data/src/main/java/org/sunflow/core/gi/PathTracingGIEngine.java +65 -0
- data/src/main/java/org/sunflow/core/light/DirectionalSpotlight.java +103 -0
- data/src/main/java/org/sunflow/core/light/ImageBasedLight.java +303 -0
- data/src/main/java/org/sunflow/core/light/PointLight.java +72 -0
- data/src/main/java/org/sunflow/core/light/SphereLight.java +166 -0
- data/src/main/java/org/sunflow/core/light/SunSkyLight.java +362 -0
- data/src/main/java/org/sunflow/core/light/TriangleMeshLight.java +296 -0
- data/src/main/java/org/sunflow/core/modifiers/BumpMappingModifier.java +37 -0
- data/src/main/java/org/sunflow/core/modifiers/NormalMapModifier.java +34 -0
- data/src/main/java/org/sunflow/core/modifiers/PerlinModifier.java +80 -0
- data/src/main/java/org/sunflow/core/parser/Keyword.java +39 -0
- data/src/main/java/org/sunflow/core/parser/RA2Parser.java +107 -0
- data/src/main/java/org/sunflow/core/parser/RA3Parser.java +68 -0
- data/src/main/java/org/sunflow/core/parser/SCAbstractParser.java +299 -0
- data/src/main/java/org/sunflow/core/parser/SCAsciiParser.java +251 -0
- data/src/main/java/org/sunflow/core/parser/SCBinaryParser.java +156 -0
- data/src/main/java/org/sunflow/core/parser/SCParser.java +1403 -0
- data/src/main/java/org/sunflow/core/parser/ShaveRibParser.java +174 -0
- data/src/main/java/org/sunflow/core/parser/TriParser.java +79 -0
- data/src/main/java/org/sunflow/core/photonmap/CausticPhotonMap.java +429 -0
- data/src/main/java/org/sunflow/core/photonmap/GlobalPhotonMap.java +530 -0
- data/src/main/java/org/sunflow/core/photonmap/GridPhotonMap.java +308 -0
- data/src/main/java/org/sunflow/core/primitive/Background.java +55 -0
- data/src/main/java/org/sunflow/core/primitive/BanchoffSurface.java +100 -0
- data/src/main/java/org/sunflow/core/primitive/Box.java +210 -0
- data/src/main/java/org/sunflow/core/primitive/CornellBox.java +476 -0
- data/src/main/java/org/sunflow/core/primitive/CubeGrid.java +318 -0
- data/src/main/java/org/sunflow/core/primitive/Cylinder.java +104 -0
- data/src/main/java/org/sunflow/core/primitive/Hair.java +275 -0
- data/src/main/java/org/sunflow/core/primitive/JuliaFractal.java +266 -0
- data/src/main/java/org/sunflow/core/primitive/ParticleSurface.java +114 -0
- data/src/main/java/org/sunflow/core/primitive/Plane.java +163 -0
- data/src/main/java/org/sunflow/core/primitive/QuadMesh.java +413 -0
- data/src/main/java/org/sunflow/core/primitive/Sphere.java +101 -0
- data/src/main/java/org/sunflow/core/primitive/SphereFlake.java +234 -0
- data/src/main/java/org/sunflow/core/primitive/Torus.java +145 -0
- data/src/main/java/org/sunflow/core/primitive/TriangleMesh.java +849 -0
- data/src/main/java/org/sunflow/core/renderer/BucketRenderer.java +491 -0
- data/src/main/java/org/sunflow/core/renderer/MultipassRenderer.java +237 -0
- data/src/main/java/org/sunflow/core/renderer/ProgressiveRenderer.java +171 -0
- data/src/main/java/org/sunflow/core/renderer/SimpleRenderer.java +106 -0
- data/src/main/java/org/sunflow/core/shader/AmbientOcclusionShader.java +53 -0
- data/src/main/java/org/sunflow/core/shader/AnisotropicWardShader.java +216 -0
- data/src/main/java/org/sunflow/core/shader/ConstantShader.java +31 -0
- data/src/main/java/org/sunflow/core/shader/DiffuseShader.java +65 -0
- data/src/main/java/org/sunflow/core/shader/GlassShader.java +147 -0
- data/src/main/java/org/sunflow/core/shader/IDShader.java +27 -0
- data/src/main/java/org/sunflow/core/shader/MirrorShader.java +68 -0
- data/src/main/java/org/sunflow/core/shader/NormalShader.java +32 -0
- data/src/main/java/org/sunflow/core/shader/PhongShader.java +89 -0
- data/src/main/java/org/sunflow/core/shader/PrimIDShader.java +30 -0
- data/src/main/java/org/sunflow/core/shader/QuickGrayShader.java +63 -0
- data/src/main/java/org/sunflow/core/shader/ShinyDiffuseShader.java +98 -0
- data/src/main/java/org/sunflow/core/shader/SimpleShader.java +24 -0
- data/src/main/java/org/sunflow/core/shader/TexturedAmbientOcclusionShader.java +31 -0
- data/src/main/java/org/sunflow/core/shader/TexturedDiffuseShader.java +31 -0
- data/src/main/java/org/sunflow/core/shader/TexturedPhongShader.java +31 -0
- data/src/main/java/org/sunflow/core/shader/TexturedShinyDiffuseShader.java +31 -0
- data/src/main/java/org/sunflow/core/shader/TexturedWardShader.java +31 -0
- data/src/main/java/org/sunflow/core/shader/UVShader.java +27 -0
- data/src/main/java/org/sunflow/core/shader/UberShader.java +149 -0
- data/src/main/java/org/sunflow/core/shader/ViewCausticsShader.java +33 -0
- data/src/main/java/org/sunflow/core/shader/ViewGlobalPhotonsShader.java +25 -0
- data/src/main/java/org/sunflow/core/shader/ViewIrradianceShader.java +25 -0
- data/src/main/java/org/sunflow/core/shader/WireframeShader.java +83 -0
- data/src/main/java/org/sunflow/core/tesselatable/BezierMesh.java +254 -0
- data/src/main/java/org/sunflow/core/tesselatable/FileMesh.java +251 -0
- data/src/main/java/org/sunflow/core/tesselatable/Gumbo.java +1147 -0
- data/src/main/java/org/sunflow/core/tesselatable/Teapot.java +237 -0
- data/src/main/java/org/sunflow/image/Bitmap.java +15 -0
- data/src/main/java/org/sunflow/image/BitmapReader.java +39 -0
- data/src/main/java/org/sunflow/image/BitmapWriter.java +79 -0
- data/src/main/java/org/sunflow/image/BlackbodySpectrum.java +16 -0
- data/src/main/java/org/sunflow/image/ChromaticitySpectrum.java +55 -0
- data/src/main/java/org/sunflow/image/Color.java +374 -0
- data/src/main/java/org/sunflow/image/ColorEncoder.java +94 -0
- data/src/main/java/org/sunflow/image/ColorFactory.java +122 -0
- data/src/main/java/org/sunflow/image/ConstantSpectralCurve.java +21 -0
- data/src/main/java/org/sunflow/image/IrregularSpectralCurve.java +57 -0
- data/src/main/java/org/sunflow/image/RGBSpace.java +207 -0
- data/src/main/java/org/sunflow/image/RegularSpectralCurve.java +30 -0
- data/src/main/java/org/sunflow/image/SpectralCurve.java +118 -0
- data/src/main/java/org/sunflow/image/XYZColor.java +50 -0
- data/src/main/java/org/sunflow/image/formats/BitmapBlack.java +27 -0
- data/src/main/java/org/sunflow/image/formats/BitmapG8.java +36 -0
- data/src/main/java/org/sunflow/image/formats/BitmapGA8.java +30 -0
- data/src/main/java/org/sunflow/image/formats/BitmapRGB8.java +40 -0
- data/src/main/java/org/sunflow/image/formats/BitmapRGBA8.java +40 -0
- data/src/main/java/org/sunflow/image/formats/BitmapRGBE.java +60 -0
- data/src/main/java/org/sunflow/image/formats/BitmapXYZ.java +38 -0
- data/src/main/java/org/sunflow/image/formats/GenericBitmap.java +73 -0
- data/src/main/java/org/sunflow/image/readers/BMPBitmapReader.java +39 -0
- data/src/main/java/org/sunflow/image/readers/HDRBitmapReader.java +155 -0
- data/src/main/java/org/sunflow/image/readers/IGIBitmapReader.java +104 -0
- data/src/main/java/org/sunflow/image/readers/JPGBitmapReader.java +39 -0
- data/src/main/java/org/sunflow/image/readers/PNGBitmapReader.java +40 -0
- data/src/main/java/org/sunflow/image/readers/TGABitmapReader.java +141 -0
- data/src/main/java/org/sunflow/image/writers/EXRBitmapWriter.java +395 -0
- data/src/main/java/org/sunflow/image/writers/HDRBitmapWriter.java +54 -0
- data/src/main/java/org/sunflow/image/writers/IGIBitmapWriter.java +75 -0
- data/src/main/java/org/sunflow/image/writers/PNGBitmapWriter.java +39 -0
- data/src/main/java/org/sunflow/image/writers/TGABitmapWriter.java +63 -0
- data/src/main/java/org/sunflow/math/BoundingBox.java +340 -0
- data/src/main/java/org/sunflow/math/MathUtils.java +159 -0
- data/src/main/java/org/sunflow/math/Matrix4.java +573 -0
- data/src/main/java/org/sunflow/math/MovingMatrix4.java +119 -0
- data/src/main/java/org/sunflow/math/OrthoNormalBasis.java +110 -0
- data/src/main/java/org/sunflow/math/PerlinScalar.java +331 -0
- data/src/main/java/org/sunflow/math/PerlinVector.java +132 -0
- data/src/main/java/org/sunflow/math/Point2.java +36 -0
- data/src/main/java/org/sunflow/math/Point3.java +133 -0
- data/src/main/java/org/sunflow/math/QMC.java +209 -0
- data/src/main/java/org/sunflow/math/Solvers.java +142 -0
- data/src/main/java/org/sunflow/math/Vector3.java +197 -0
- data/src/main/java/org/sunflow/system/BenchmarkFramework.java +73 -0
- data/src/main/java/org/sunflow/system/BenchmarkTest.java +17 -0
- data/src/main/java/org/sunflow/system/ByteUtil.java +119 -0
- data/src/main/java/org/sunflow/system/FileUtils.java +27 -0
- data/src/main/java/org/sunflow/system/ImagePanel.java +282 -0
- data/src/main/java/org/sunflow/system/Memory.java +18 -0
- data/src/main/java/org/sunflow/system/Parser.java +162 -0
- data/src/main/java/org/sunflow/system/Plugins.java +142 -0
- data/src/main/java/org/sunflow/system/RenderGlobalsPanel.java +209 -0
- data/src/main/java/org/sunflow/system/SearchPath.java +67 -0
- data/src/main/java/org/sunflow/system/Timer.java +53 -0
- data/src/main/java/org/sunflow/system/UI.java +112 -0
- data/src/main/java/org/sunflow/system/UserInterface.java +46 -0
- data/src/main/java/org/sunflow/system/ui/ConsoleInterface.java +48 -0
- data/src/main/java/org/sunflow/system/ui/SilentInterface.java +28 -0
- data/src/main/java/org/sunflow/util/FastHashMap.java +220 -0
- data/src/main/java/org/sunflow/util/FloatArray.java +77 -0
- data/src/main/java/org/sunflow/util/IntArray.java +77 -0
- data/src/test/java/a_maintest.java +129 -0
- metadata +300 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
package org.sunflow;
|
|
2
|
+
|
|
3
|
+
import org.sunflow.core.Display;
|
|
4
|
+
import org.sunflow.core.PrimitiveList;
|
|
5
|
+
import org.sunflow.core.RenderObject;
|
|
6
|
+
import org.sunflow.core.Tesselatable;
|
|
7
|
+
import org.sunflow.core.ParameterList.InterpolationType;
|
|
8
|
+
import org.sunflow.math.Matrix4;
|
|
9
|
+
import org.sunflow.math.Point2;
|
|
10
|
+
import org.sunflow.math.Point3;
|
|
11
|
+
import org.sunflow.math.Vector3;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This interface represents the entry point for rendering scenes using Sunflow.
|
|
15
|
+
* Classes which implement this interface are able to receive input from any of
|
|
16
|
+
* the Sunflow parsers.
|
|
17
|
+
*/
|
|
18
|
+
public interface SunflowAPIInterface {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Reset the state of the API completely. The object table is cleared, and
|
|
22
|
+
* all search paths are set back to their default values.
|
|
23
|
+
*/
|
|
24
|
+
public void reset();
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Declare a plugin of the specified type with the given name from a java
|
|
28
|
+
* code string. The code will be compiled with Janino and registered as a
|
|
29
|
+
* new plugin type upon success.
|
|
30
|
+
*
|
|
31
|
+
* @param type
|
|
32
|
+
* @param name
|
|
33
|
+
* @param code
|
|
34
|
+
*/
|
|
35
|
+
public void plugin(String type, String name, String code);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Declare a parameter with the specified name and value. This parameter
|
|
39
|
+
* will be added to the currently active parameter list.
|
|
40
|
+
*
|
|
41
|
+
* @param name parameter name
|
|
42
|
+
* @param value parameter value
|
|
43
|
+
*/
|
|
44
|
+
public void parameter(String name, String value);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Declare a parameter with the specified name and value. This parameter
|
|
48
|
+
* will be added to the currently active parameter list.
|
|
49
|
+
*
|
|
50
|
+
* @param name parameter name
|
|
51
|
+
* @param value parameter value
|
|
52
|
+
*/
|
|
53
|
+
public void parameter(String name, boolean value);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Declare a parameter with the specified name and value. This parameter
|
|
57
|
+
* will be added to the currently active parameter list.
|
|
58
|
+
*
|
|
59
|
+
* @param name parameter name
|
|
60
|
+
* @param value parameter value
|
|
61
|
+
*/
|
|
62
|
+
public void parameter(String name, int value);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Declare a parameter with the specified name and value. This parameter
|
|
66
|
+
* will be added to the currently active parameter list.
|
|
67
|
+
*
|
|
68
|
+
* @param name parameter name
|
|
69
|
+
* @param value parameter value
|
|
70
|
+
*/
|
|
71
|
+
public void parameter(String name, float value);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Declare a color parameter in the given colorspace using the specified
|
|
75
|
+
* name and value. This parameter will be added to the currently active
|
|
76
|
+
* parameter list.
|
|
77
|
+
*
|
|
78
|
+
* @param name parameter name
|
|
79
|
+
* @param colorspace color space or <code>null</code> to assume internal
|
|
80
|
+
* color space
|
|
81
|
+
* @param data floating point color data
|
|
82
|
+
*/
|
|
83
|
+
public void parameter(String name, String colorspace, float... data);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Declare a parameter with the specified name and value. This parameter
|
|
87
|
+
* will be added to the currently active parameter list.
|
|
88
|
+
*
|
|
89
|
+
* @param name parameter name
|
|
90
|
+
* @param value parameter value
|
|
91
|
+
*/
|
|
92
|
+
public void parameter(String name, Point3 value);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Declare a parameter with the specified name and value. This parameter
|
|
96
|
+
* will be added to the currently active parameter list.
|
|
97
|
+
*
|
|
98
|
+
* @param name parameter name
|
|
99
|
+
* @param value parameter value
|
|
100
|
+
*/
|
|
101
|
+
public void parameter(String name, Vector3 value);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Declare a parameter with the specified name and value. This parameter
|
|
105
|
+
* will be added to the currently active parameter list.
|
|
106
|
+
*
|
|
107
|
+
* @param name parameter name
|
|
108
|
+
* @param value parameter value
|
|
109
|
+
*/
|
|
110
|
+
public void parameter(String name, Point2 value);
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Declare a parameter with the specified name and value. This parameter
|
|
114
|
+
* will be added to the currently active parameter list.
|
|
115
|
+
*
|
|
116
|
+
* @param name parameter name
|
|
117
|
+
* @param value parameter value
|
|
118
|
+
*/
|
|
119
|
+
public void parameter(String name, Matrix4 value);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Declare a parameter with the specified name and value. This parameter
|
|
123
|
+
* will be added to the currently active parameter list.
|
|
124
|
+
*
|
|
125
|
+
* @param name parameter name
|
|
126
|
+
* @param value parameter value
|
|
127
|
+
*/
|
|
128
|
+
public void parameter(String name, int[] value);
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Declare a parameter with the specified name and value. This parameter
|
|
132
|
+
* will be added to the currently active parameter list.
|
|
133
|
+
*
|
|
134
|
+
* @param name parameter name
|
|
135
|
+
* @param value parameter value
|
|
136
|
+
*/
|
|
137
|
+
public void parameter(String name, String[] value);
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Declare a parameter with the specified name. The type may be one of the
|
|
141
|
+
* follow: "float", "point", "vector", "texcoord", "matrix". The
|
|
142
|
+
* interpolation determines how the parameter is to be interpreted over
|
|
143
|
+
* surface (see {@link InterpolationType}). The data is specified in a
|
|
144
|
+
* flattened float array.
|
|
145
|
+
*
|
|
146
|
+
* @param name parameter name
|
|
147
|
+
* @param type parameter data type
|
|
148
|
+
* @param interpolation parameter interpolation mode
|
|
149
|
+
* @param data raw floating point data
|
|
150
|
+
*/
|
|
151
|
+
public void parameter(String name, String type, String interpolation, float[] data);
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Remove the specified render object. Note that this may cause the removal
|
|
155
|
+
* of other objects which depended on it.
|
|
156
|
+
*
|
|
157
|
+
* @param name name of the object to remove
|
|
158
|
+
*/
|
|
159
|
+
public void remove(String name);
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Add the specified path to the list of directories which are searched
|
|
163
|
+
* automatically to resolve scene filenames or textures. Currently the
|
|
164
|
+
* supported searchpath types are: "include" and "texture". All other types
|
|
165
|
+
* will be ignored.
|
|
166
|
+
*
|
|
167
|
+
* @param type
|
|
168
|
+
* @param path
|
|
169
|
+
*/
|
|
170
|
+
public void searchpath(String type, String path);
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Defines a shader with a given name. If the shader type name is left
|
|
174
|
+
* <code>null</code>, the shader with the given name will be updated (if it
|
|
175
|
+
* exists).
|
|
176
|
+
*
|
|
177
|
+
* @param name a unique name given to the shader
|
|
178
|
+
* @param shaderType a shader plugin type
|
|
179
|
+
*/
|
|
180
|
+
public void shader(String name, String shaderType);
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Defines a modifier with a given name. If the modifier type name is left
|
|
184
|
+
* <code>null</code>, the modifier with the given name will be updated (if
|
|
185
|
+
* it exists).
|
|
186
|
+
*
|
|
187
|
+
* @param name a unique name given to the modifier
|
|
188
|
+
* @param modifierType a modifier plugin type name
|
|
189
|
+
*/
|
|
190
|
+
public void modifier(String name, String modifierType);
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Defines a geometry with a given name. The geometry is built from the
|
|
194
|
+
* specified type. Note that geometries may be created from
|
|
195
|
+
* {@link Tesselatable} objects or {@link PrimitiveList} objects. This means
|
|
196
|
+
* that two seperate plugin lists will be searched for the geometry type.
|
|
197
|
+
* {@link Tesselatable} objects are search first. If the type name is left
|
|
198
|
+
* <code>null</code>, the geometry with the given name will be updated (if
|
|
199
|
+
* it exists).
|
|
200
|
+
*
|
|
201
|
+
* @param name a unique name given to the geometry
|
|
202
|
+
* @param typeName a tesselatable or primitive plugin type name
|
|
203
|
+
*/
|
|
204
|
+
public void geometry(String name, String typeName);
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Instance the specified geometry into the scene. If geoname is
|
|
208
|
+
* <code>null</code>, the specified instance object will be updated (if it
|
|
209
|
+
* exists). In order to change the instancing relationship of an existing
|
|
210
|
+
* instance, you should use the "geometry" string attribute.
|
|
211
|
+
*
|
|
212
|
+
* @param name instance name
|
|
213
|
+
* @param geoname name of the geometry to instance
|
|
214
|
+
*/
|
|
215
|
+
public void instance(String name, String geoname);
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Defines a light source with a given name. If the light type name is left
|
|
219
|
+
* <code>null</code>, the light source with the given name will be updated
|
|
220
|
+
* (if it exists).
|
|
221
|
+
*
|
|
222
|
+
* @param name a unique name given to the light source
|
|
223
|
+
* @param lightType a light source plugin type name
|
|
224
|
+
*/
|
|
225
|
+
public void light(String name, String lightType);
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Defines a camera with a given name. The camera is built from the
|
|
229
|
+
* specified camera lens type plugin. If the lens type name is left
|
|
230
|
+
* <code>null</code>, the camera with the given name will be updated (if it
|
|
231
|
+
* exists). It is not currently possible to change the lens of a camera
|
|
232
|
+
* after it has been created.
|
|
233
|
+
*
|
|
234
|
+
* @param name camera name
|
|
235
|
+
* @param lensType a camera lens plugin type name
|
|
236
|
+
*/
|
|
237
|
+
public void camera(String name, String lensType);
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Defines an option object to hold the current parameters. If the object
|
|
241
|
+
* already exists, the values will simply override previous ones.
|
|
242
|
+
*
|
|
243
|
+
* @param name
|
|
244
|
+
*/
|
|
245
|
+
public void options(String name);
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Render using the specified options and the specified display. If the
|
|
249
|
+
* specified options do not exist - defaults will be used.
|
|
250
|
+
*
|
|
251
|
+
* @param optionsName name of the {@link RenderObject} which contains the
|
|
252
|
+
* options
|
|
253
|
+
* @param display display object
|
|
254
|
+
*/
|
|
255
|
+
public void render(String optionsName, Display display);
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Parse the specified filename. The include paths are searched first. The
|
|
259
|
+
* contents of the file are simply added to the active scene. This allows to
|
|
260
|
+
* break up a scene into parts, even across file formats. The appropriate
|
|
261
|
+
* parser is chosen based on file extension.
|
|
262
|
+
*
|
|
263
|
+
* @param filename filename to load
|
|
264
|
+
* @return <code>true</code> upon sucess, <code>false</code> if an error
|
|
265
|
+
* occured.
|
|
266
|
+
*/
|
|
267
|
+
public boolean include(String filename);
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Set the value of the current frame. This value is intended only for
|
|
271
|
+
* procedural animation creation. It is not used by the Sunflow core in
|
|
272
|
+
* anyway. The default value is 1.
|
|
273
|
+
*
|
|
274
|
+
* @param currentFrame current frame number
|
|
275
|
+
*/
|
|
276
|
+
public void currentFrame(int currentFrame);
|
|
277
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package org.sunflow.core;
|
|
2
|
+
|
|
3
|
+
public interface AccelerationStructure {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Construct an acceleration structure for the specified primitive list.
|
|
7
|
+
*
|
|
8
|
+
* @param primitives
|
|
9
|
+
*/
|
|
10
|
+
public void build(PrimitiveList primitives);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Intersect the specified ray with the geometry in local space. The ray
|
|
14
|
+
* will be provided in local space.
|
|
15
|
+
*
|
|
16
|
+
* @param r ray in local space
|
|
17
|
+
* @param istate state to store the intersection into
|
|
18
|
+
*/
|
|
19
|
+
public void intersect(Ray r, IntersectionState istate);
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
package org.sunflow.core;
|
|
2
|
+
|
|
3
|
+
import org.sunflow.PluginRegistry;
|
|
4
|
+
import org.sunflow.system.UI;
|
|
5
|
+
import org.sunflow.system.UI.Module;
|
|
6
|
+
|
|
7
|
+
class AccelerationStructureFactory {
|
|
8
|
+
|
|
9
|
+
static AccelerationStructure create(String name, int n, boolean primitives) {
|
|
10
|
+
if (name == null || name.equals("auto")) {
|
|
11
|
+
if (primitives) {
|
|
12
|
+
if (n > 20000000) {
|
|
13
|
+
name = "uniformgrid";
|
|
14
|
+
} else if (n > 2000000) {
|
|
15
|
+
name = "bih";
|
|
16
|
+
} else if (n > 2) {
|
|
17
|
+
name = "kdtree";
|
|
18
|
+
} else {
|
|
19
|
+
name = "null";
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
if (n > 2) {
|
|
23
|
+
name = "bih";
|
|
24
|
+
} else {
|
|
25
|
+
name = "null";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
AccelerationStructure accel = PluginRegistry.ACCEL_PLUGINS.createObject(name);
|
|
30
|
+
if (accel == null) {
|
|
31
|
+
UI.printWarning(Module.ACCEL, "Unrecognized intersection accelerator \"%s\" - using auto", name);
|
|
32
|
+
return create(null, n, primitives);
|
|
33
|
+
}
|
|
34
|
+
return accel;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
package org.sunflow.core;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates an array of coordinates that iterate over the tiled screen. Classes
|
|
5
|
+
* which implement this interface are responsible for guarenteeing the entire
|
|
6
|
+
* screen is tiled. No attempt is made to check for duplicates or incomplete
|
|
7
|
+
* coverage.
|
|
8
|
+
*/
|
|
9
|
+
public interface BucketOrder {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Computes the order in which each coordinate on the screen should be
|
|
13
|
+
* visited.
|
|
14
|
+
*
|
|
15
|
+
* @param nbw number of buckets in the X direction
|
|
16
|
+
* @param nbh number of buckets in the Y direction
|
|
17
|
+
* @return array of coordinates with interleaved X, Y of the positions of
|
|
18
|
+
* buckets to be rendered.
|
|
19
|
+
*/
|
|
20
|
+
int[] getBucketSequence(int nbw, int nbh);
|
|
21
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
package org.sunflow.core;
|
|
2
|
+
|
|
3
|
+
import org.sunflow.SunflowAPI;
|
|
4
|
+
import org.sunflow.math.Matrix4;
|
|
5
|
+
import org.sunflow.math.MovingMatrix4;
|
|
6
|
+
import org.sunflow.math.Point3;
|
|
7
|
+
import org.sunflow.system.UI;
|
|
8
|
+
import org.sunflow.system.UI.Module;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This class represents a camera to the renderer. It handles the mapping of
|
|
12
|
+
* camera space to world space, as well as the mounting of {@link CameraLens}
|
|
13
|
+
* objects which compute the actual projection.
|
|
14
|
+
*/
|
|
15
|
+
public class Camera implements RenderObject {
|
|
16
|
+
|
|
17
|
+
private final CameraLens lens;
|
|
18
|
+
private float shutterOpen;
|
|
19
|
+
private float shutterClose;
|
|
20
|
+
private MovingMatrix4 c2w;
|
|
21
|
+
private MovingMatrix4 w2c;
|
|
22
|
+
|
|
23
|
+
public Camera(CameraLens lens) {
|
|
24
|
+
this.lens = lens;
|
|
25
|
+
c2w = new MovingMatrix4(null);
|
|
26
|
+
w2c = new MovingMatrix4(null);
|
|
27
|
+
shutterOpen = shutterClose = 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public boolean update(ParameterList pl, SunflowAPI api) {
|
|
32
|
+
shutterOpen = pl.getFloat("shutter.open", shutterOpen);
|
|
33
|
+
shutterClose = pl.getFloat("shutter.close", shutterClose);
|
|
34
|
+
c2w = pl.getMovingMatrix("transform", c2w);
|
|
35
|
+
w2c = c2w.inverse();
|
|
36
|
+
if (w2c == null) {
|
|
37
|
+
UI.printWarning(Module.CAM, "Unable to compute camera's inverse transform");
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return lens.update(pl, api);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Computes actual time from a time sample in the interval [0,1). This
|
|
45
|
+
* random number is mapped somewhere between the shutterOpen and
|
|
46
|
+
* shutterClose times.
|
|
47
|
+
*
|
|
48
|
+
* @param time
|
|
49
|
+
* @return
|
|
50
|
+
*/
|
|
51
|
+
public float getTime(float time) {
|
|
52
|
+
if (shutterOpen >= shutterClose) {
|
|
53
|
+
return shutterOpen;
|
|
54
|
+
}
|
|
55
|
+
// warp the time sample by a tent filter - this helps simulates the
|
|
56
|
+
// behaviour of a standard shutter as explained here:
|
|
57
|
+
// "Shutter Efficiency and Temporal Sampling" by "Ian Stephenson"
|
|
58
|
+
// http://www.dctsystems.co.uk/Text/shutter.pdf
|
|
59
|
+
if (time < 0.5) {
|
|
60
|
+
time = -1 + (float) Math.sqrt(2 * time);
|
|
61
|
+
} else {
|
|
62
|
+
time = 1 - (float) Math.sqrt(2 - 2 * time);
|
|
63
|
+
}
|
|
64
|
+
time = 0.5f * (time + 1);
|
|
65
|
+
return (1 - time) * shutterOpen + time * shutterClose;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Generate a ray passing though the specified point on the image plane.
|
|
70
|
+
* Additional random variables are provided for the lens to optionally
|
|
71
|
+
* compute depth-of-field or motion blur effects. Note that the camera may
|
|
72
|
+
* return
|
|
73
|
+
* <code>null</code> for invalid arguments or for pixels which don't project
|
|
74
|
+
* to anything.
|
|
75
|
+
*
|
|
76
|
+
* @param x x pixel coordinate
|
|
77
|
+
* @param y y pixel coordinate
|
|
78
|
+
* @param imageWidth width of the image in pixels
|
|
79
|
+
* @param imageHeight height of the image in pixels
|
|
80
|
+
* @param lensX a random variable in [0,1) to be used for DOF sampling
|
|
81
|
+
* @param lensY a random variable in [0,1) to be used for DOF sampling
|
|
82
|
+
* @param time a random variable in [0,1) to be used for motion blur
|
|
83
|
+
* sampling
|
|
84
|
+
* @return a ray passing through the specified pixel, or <code>null</code>
|
|
85
|
+
*/
|
|
86
|
+
public Ray getRay(float x, float y, int imageWidth, int imageHeight, double lensX, double lensY, float time) {
|
|
87
|
+
Ray r = lens.getRay(x, y, imageWidth, imageHeight, lensX, lensY, time);
|
|
88
|
+
if (r != null) {
|
|
89
|
+
// transform from camera space to world space
|
|
90
|
+
r = r.transform(c2w.sample(time));
|
|
91
|
+
// renormalize to account for scale factors embeded in the transform
|
|
92
|
+
r.normalize();
|
|
93
|
+
}
|
|
94
|
+
return r;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Generate a ray from the origin of camera space toward the specified
|
|
99
|
+
* point.
|
|
100
|
+
*
|
|
101
|
+
* @param p point in world space
|
|
102
|
+
* @return ray from the origin of camera space to the specified point
|
|
103
|
+
*/
|
|
104
|
+
Ray getRay(Point3 p, float time) {
|
|
105
|
+
return new Ray(c2w == null ? new Point3(0, 0, 0) : c2w.sample(time).transformP(new Point3(0, 0, 0)), p);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Returns a transformation matrix mapping camera space to world space.
|
|
110
|
+
*
|
|
111
|
+
* @return a transformation matrix
|
|
112
|
+
*/
|
|
113
|
+
Matrix4 getCameraToWorld(float time) {
|
|
114
|
+
return c2w == null ? Matrix4.IDENTITY : c2w.sample(time);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Returns a transformation matrix mapping world space to camera space.
|
|
119
|
+
*
|
|
120
|
+
* @return a transformation matrix
|
|
121
|
+
*/
|
|
122
|
+
Matrix4 getWorldToCamera(float time) {
|
|
123
|
+
return w2c == null ? Matrix4.IDENTITY : w2c.sample(time);
|
|
124
|
+
}
|
|
125
|
+
}
|