public final class RendererKernel extends AbstractKernel
AbstractKernel class that performs Path Tracing, Ray Casting and Ray Marching.com.amd.aparapi.Kernel.Constant, com.amd.aparapi.Kernel.Entry, com.amd.aparapi.Kernel.EXECUTION_MODE, com.amd.aparapi.Kernel.KernelState, com.amd.aparapi.Kernel.Local, com.amd.aparapi.Kernel.NoCL, com.amd.aparapi.Kernel.OpenCLDelegate, com.amd.aparapi.Kernel.OpenCLMapping, com.amd.aparapi.Kernel.PrivateMemorySpaceamplitude, cosTable, EPSILON, frequency, gain, INFINITY, lacunarity, octaves, permutations, permutationsModulo12, PI, PI_DIVIDED_BY_180, PI_DIVIDED_BY_360, PI_MULTIPLIED_BY_TWO, PI_MULTIPLIED_BY_TWO_RECIPROCAL, PI_RECIPROCAL, seeds, simplexGradient3, simplexGradient4, sinTable| Constructor and Description |
|---|
RendererKernel(int width,
int height,
SceneLoader sceneLoader)
Constructs a new
RendererKernel instance. |
| Modifier and Type | Method and Description |
|---|---|
RendererKernel |
compile(byte[] pixels,
int width,
int height)
Compiles this
RendererKernel instance. |
Camera |
getCamera()
Returns the
Camera instance assigned to this RendererKernel instance. |
CompiledScene |
getCompiledScene()
Returns the
CompiledScene. |
int |
getHeight()
Returns the height.
|
byte[] |
getPixels()
Returns the
byte array with the pixels. |
int[] |
getPrimitiveOffsetsForPrimaryRay()
Returns the primitive offsets for all primary rays.
|
float |
getRendererAOMaximumDistance()
Returns the maximum distance for Ambient Occlusion.
|
int |
getRendererPTRayDepthMaximum()
Returns the maximum ray depth for Path Tracing.
|
int |
getRendererPTRayDepthRussianRoulette()
Returns the ray depth to begin Russian Roulette path termination for Path Tracing.
|
Scene |
getScene()
Returns the
Scene instance assigned to this RendererKernel instance. |
int |
getSelectedPrimitiveOffset()
Returns the selected primitive offset.
|
float |
getToneMapperExposure()
Returns the exposure for the Tone Mappers.
|
int |
getWidth()
Returns the width.
|
boolean |
isAmbientOcclusion()
Returns
true if, and only if, Ambient Occlusion is enabled, false otherwise. |
boolean |
isEffectGrayScale()
Returns
true if, and only if, the Grayscale effect is enabled, false otherwise. |
boolean |
isEffectSepiaTone()
Returns
true if, and only if, the Sepia Tone effect is enabled, false otherwise. |
boolean |
isNormalMapping()
Returns
true if, and only if, Normal Mapping is activaded, false otherwise. |
boolean |
isPathTracing()
Returns
true if, and only if, Path Tracing is enabled, false otherwise. |
boolean |
isRayCasting()
Returns
true if, and only if, Ray Casting is enabled, false otherwise. |
boolean |
isRayMarching()
Returns
true if, and only if, Ray Marching is enabled, false otherwise. |
boolean |
isRayTracing()
Returns
true if, and only if, Ray Tracing is enabled, false otherwise. |
boolean |
isRenderingWireframes()
Returns
true if, and only if, wireframe rendering is enabled, false otherwise. |
boolean |
isResetRequired()
Returns
true if, and only if, reset is required, false otherwise. |
boolean |
isShadingFlat()
Returns
true if, and only if, Flat Shading is used, false otherwise. |
boolean |
isShadingGouraud()
Returns
true if, and only if, Gouraud Shading is used, false otherwise. |
boolean |
isShowingClouds()
Returns
true if, and only if, the sky is showing clouds, false otherwise. |
void |
noCL()
Called when this
RendererKernel is run in JTP mode. |
RendererKernel |
reset()
Resets this
RendererKernel instance. |
void |
run()
Performs the Path Tracing.
|
void |
setAmbientOcclusion(boolean isAmbientOcclusion)
Sets whether Ambient Occlusion should be enabled or disabled.
|
void |
setEffectGrayScale(boolean isEffectGrayScale)
Enables or disables the Grayscale effect.
|
void |
setEffectSepiaTone(boolean isEffectSepiaTone)
Enables or disables the Sepia Tone effect.
|
void |
setNormalMapping(boolean isNormalMapping)
Sets the Normal Mapping state.
|
void |
setPathTracing(boolean isPathTracing)
Sets whether Path Tracing should be enabled or disabled.
|
void |
setRayCasting(boolean isRayCasting)
Sets whether Ray Casting should be enabled or disabled.
|
void |
setRayMarching(boolean isRayMarching)
Sets whether Ray Marching should be enabled or disabled.
|
void |
setRayTracing(boolean isRayTracing)
Sets whether Ray Tracing should be enabled or disabled.
|
void |
setRendererAOMaximumDistance(float rendererAOMaximumDistance)
Sets the maximum distance for Ambient Occlusion.
|
void |
setRendererPTRayDepthMaximum(int rendererPTRayDepthMaximum)
Sets the maximum ray depth for Path Tracing.
|
void |
setRendererPTRayDepthRussianRoulette(int rendererPTRayDepthRussianRoulette)
Sets the ray depth to begin Russian Roulette path termination for Path Tracing.
|
void |
setRenderingWireframes(boolean isRenderingWireframes)
Sets whether wireframe rendering should be enabled or disabled.
|
void |
setSelectedPrimitiveOffset(int selectedPrimitiveOffset)
Sets the selected primitive offset.
|
void |
setShadingFlat()
Sets Flat Shading.
|
void |
setShadingGouraud()
Sets Gouraud Shading.
|
void |
setShowingClouds(boolean isShowingClouds)
Sets whether the sky is showing clouds or not.
|
void |
setToneMapperExposure(float toneMapperExposure)
Sets the exposure for the Tone Mappers.
|
void |
setToneMappingAndGammaCorrectionFilmicCurve1()
Sets the Tone Mapping and Gamma Correction to Filmic Curve version 1.
|
void |
setToneMappingAndGammaCorrectionFilmicCurve2()
Sets the Tone Mapping and Gamma Correction to Filmic Curve version 2.
|
void |
setToneMappingAndGammaCorrectionLinear()
Sets the Tone Mapping and Gamma Correction to Linear.
|
void |
setToneMappingAndGammaCorrectionReinhard1()
Sets the Tone Mapping and Gamma Correction to Reinhard version 1.
|
void |
setToneMappingAndGammaCorrectionReinhard2()
Sets the Tone Mapping and Gamma Correction to Reinhard version 2.
|
void |
toggleClouds()
Toggles the visibility for the clouds in the sky.
|
void |
toggleMaterial()
Toggles the material for the selected shape.
|
void |
toggleRenderer()
Toggles to the next renderer.
|
void |
toggleShading()
Toggles to the next shading.
|
void |
toggleSunAndSky()
Toggles the sun and sky.
|
RendererKernel |
updateLocalVariables(int localSize)
Updates the local variables.
|
void |
updateResetStatus()
Updates the reset status.
|
RendererKernel |
updateSky()
Updates the variables related to the
Sky. |
bytesToFloat, cosDegrees, cosRadians, getAmplitude, getFrequency, getGain, getLacunarity, getOctaves, modulo, nextFloat, perlinNoiseXYZ, remainder, saturate, setAmplitude, setFrequency, setGain, setLacunarity, setOctaves, simplexFractalXY, simplexFractalXYZ, simplexFractalXYZW, simplexFractionalBrownianMotionXY, simplexFractionalBrownianMotionXYZ, simplexFractionalBrownianMotionXYZW, simplexNoiseXY, simplexNoiseXYZ, simplexNoiseXYZW, sinDegrees, sinRadians, updateabs, abs, abs, abs, acos, acos, acospi, acospi, addExecutionModes, asin, asin, asinpi, asinpi, atan, atan, atan2, atan2, atan2pi, atan2pi, atanpi, atanpi, atomicAdd, cancelMultiPass, cbrt, cbrt, ceil, ceil, cleanUpArrays, clone, cos, cos, cosh, cosh, cospi, cospi, createRange, dispose, execute, execute, execute, execute, execute, execute, executeFallbackAlgorithm, exp, exp, exp10, exp10, exp2, exp2, expm1, expm1, floor, floor, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getAccumulatedExecutionTime, getCancelState, getConversionTime, getCurrentPass, getExecutionMode, getExecutionTime, getGlobalId, getGlobalId, getGlobalSize, getGlobalSize, getGroupId, getGroupId, getKernelState, getLocalId, getLocalId, getLocalSize, getLocalSize, getMappedMethodName, getNumGroups, getNumGroups, getPassId, getProfileInfo, getTargetDevice, globalBarrier, hasFallbackAlgorithm, hasNextExecutionMode, hypot, hypot, IEEEremainder, IEEEremainder, invalidateCaches, isAllowDevice, isAutoCleanUpArrays, isExecuting, isExplicit, isMappedMethod, isOpenCLDelegateMethod, isRunningCL, localBarrier, log, log, log10, log10, log1p, log1p, log2, log2, mad, mad, max, max, max, max, min, min, min, min, nextAfter, nextAfter, pow, pow, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, rint, rint, round, round, rsqrt, rsqrt, setAutoCleanUpArrays, setExecutionMode, setExplicit, setFallbackExecutionMode, sin, sin, sinh, sinh, sinpi, sinpi, sqrt, sqrt, tan, tan, tanh, tanh, tanpi, tanpi, toDegrees, toDegrees, toRadians, toRadians, toString, tryNextExecutionMode, usesAtomic32, usesAtomic64public RendererKernel(int width,
int height,
SceneLoader sceneLoader)
RendererKernel instance.
If sceneLoader is null, a NullPointerException will be thrown.
width - the width to useheight - the height to usesceneLoader - the SceneLoader to usejava.lang.NullPointerException - thrown if, and only if, sceneLoader is nullpublic Camera getCamera()
Camera instance assigned to this RendererKernel instance.Camera instance assigned to this RendererKernel instancepublic CompiledScene getCompiledScene()
CompiledScene.CompiledScenepublic RendererKernel compile(byte[] pixels, int width, int height)
RendererKernel instance.
Returns itself for method chaining.
If pixels is null, a NullPointerException will be thrown.
pixels - a byte array with the pixelswidth - the width to useheight - the height to usejava.lang.NullPointerException - thrown if, and only if, pixels is nullpublic RendererKernel reset()
RendererKernel instance.
Returns itself for method chaining.
public RendererKernel updateLocalVariables(int localSize)
Returns itself for method chaining.
localSize - the local sizepublic RendererKernel updateSky()
Sky.
Returns itself for method chaining.
public Scene getScene()
Scene instance assigned to this RendererKernel instance.Scene instance assigned to this RendererKernel instancepublic boolean isAmbientOcclusion()
true if, and only if, Ambient Occlusion is enabled, false otherwise.true if, and only if, Ambient Occlusion is enabled, false otherwisepublic boolean isEffectGrayScale()
true if, and only if, the Grayscale effect is enabled, false otherwise.true if, and only if, the Grayscale effect is enabled, false otherwisepublic boolean isEffectSepiaTone()
true if, and only if, the Sepia Tone effect is enabled, false otherwise.true if, and only if, the Sepia Tone effect is enabled, false otherwisepublic boolean isNormalMapping()
true if, and only if, Normal Mapping is activaded, false otherwise.true if, and only if, Normal Mapping is activaded, false otherwisepublic boolean isPathTracing()
true if, and only if, Path Tracing is enabled, false otherwise.true if, and only if, Path Tracing is enabled, false otherwisepublic boolean isRayCasting()
true if, and only if, Ray Casting is enabled, false otherwise.true if, and only if, Ray Casting is enabled, false otherwisepublic boolean isRayMarching()
true if, and only if, Ray Marching is enabled, false otherwise.true if, and only if, Ray Marching is enabled, false otherwisepublic boolean isRayTracing()
true if, and only if, Ray Tracing is enabled, false otherwise.true if, and only if, Ray Tracing is enabled, false otherwisepublic boolean isRenderingWireframes()
true if, and only if, wireframe rendering is enabled, false otherwise.true if, and only if, wireframe rendering is enabled, false otherwisepublic boolean isResetRequired()
true if, and only if, reset is required, false otherwise.true if, and only if, reset is required, false otherwisepublic boolean isShadingFlat()
true if, and only if, Flat Shading is used, false otherwise.true if, and only if, Flat Shading is used, false otherwisepublic boolean isShadingGouraud()
true if, and only if, Gouraud Shading is used, false otherwise.true if, and only if, Gouraud Shading is used, false otherwisepublic boolean isShowingClouds()
true if, and only if, the sky is showing clouds, false otherwise.true if, and only if, the sky is showing clouds, false otherwisepublic byte[] getPixels()
byte array with the pixels.byte array with the pixelspublic float getRendererAOMaximumDistance()
public float getToneMapperExposure()
public int getHeight()
public int getRendererPTRayDepthMaximum()
public int getRendererPTRayDepthRussianRoulette()
public int getSelectedPrimitiveOffset()
public int getWidth()
public int[] getPrimitiveOffsetsForPrimaryRay()
public void noCL()
RendererKernel is run in JTP mode.public void run()
run in class com.amd.aparapi.Kernelpublic void setAmbientOcclusion(boolean isAmbientOcclusion)
If isAmbientOcclusion is false, the renderer will be a Path Tracer.
isAmbientOcclusion - the Ambient Occlusion state to setpublic void setEffectGrayScale(boolean isEffectGrayScale)
isEffectGrayScale - true if the Grayscale effect is enabled, false otherwisepublic void setEffectSepiaTone(boolean isEffectSepiaTone)
isEffectSepiaTone - true if the Sepia Tone effect is enabled, false otherwisepublic void setNormalMapping(boolean isNormalMapping)
isNormalMapping - true if, and only if, Normal Mapping is activated, false otherwisepublic void setPathTracing(boolean isPathTracing)
If isPathTracing is false, the renderer will be a Ray Caster.
isPathTracing - the Path Tracing state to setpublic void setRayCasting(boolean isRayCasting)
If isRayCasting is false, the renderer will be a Ray Marcher.
isRayCasting - the Ray Casting state to setpublic void setRayMarching(boolean isRayMarching)
If isRayMarching is false, the renderer will be a Ray Tracer.
isRayMarching - the Ray Marching state to setpublic void setRayTracing(boolean isRayTracing)
If isRayTracing is false, the renderer will be Ambient Occlusion.
isRayTracing - the Ray Tracing state to setpublic void setRendererAOMaximumDistance(float rendererAOMaximumDistance)
rendererAOMaximumDistance - the maximum distance for Ambient Occlusionpublic void setRendererPTRayDepthMaximum(int rendererPTRayDepthMaximum)
rendererPTRayDepthMaximum - the maximum ray depth for Path Tracingpublic void setRendererPTRayDepthRussianRoulette(int rendererPTRayDepthRussianRoulette)
rendererPTRayDepthRussianRoulette - the ray depth to begin Russian Roulette path termination for Path Tracingpublic void setRenderingWireframes(boolean isRenderingWireframes)
isRenderingWireframes - the wireframe rendering state to setpublic void setSelectedPrimitiveOffset(int selectedPrimitiveOffset)
selectedPrimitiveOffset - the selected primitive offsetpublic void setShadingFlat()
public void setShadingGouraud()
public void setShowingClouds(boolean isShowingClouds)
isShowingClouds - true if, and only if, the sky is showing clouds, false otherwisepublic void setToneMapperExposure(float toneMapperExposure)
toneMapperExposure - the new exposurepublic void setToneMappingAndGammaCorrectionFilmicCurve1()
public void setToneMappingAndGammaCorrectionFilmicCurve2()
public void setToneMappingAndGammaCorrectionLinear()
public void setToneMappingAndGammaCorrectionReinhard1()
public void setToneMappingAndGammaCorrectionReinhard2()
public void toggleClouds()
public void toggleMaterial()
public void toggleRenderer()
public void toggleShading()
public void toggleSunAndSky()
public void updateResetStatus()
This essentially means that isResetRequired() will return false immediately after this method has been called.