Compare commits
4 Commits
2b221338ae
...
96134404a2
| Author | SHA1 | Date | |
|---|---|---|---|
| 96134404a2 | |||
| 3aac63d255 | |||
| a8d6095204 | |||
| 960095d0d5 |
@ -1,397 +1,397 @@
|
||||
package kha.korehl.graphics4;
|
||||
|
||||
import kha.arrays.Float32Array;
|
||||
import kha.graphics4.ComputeShader;
|
||||
import kha.graphics4.CubeMap;
|
||||
import kha.graphics4.MipMapFilter;
|
||||
import kha.graphics4.PipelineState;
|
||||
import kha.graphics4.ShaderStorageBuffer;
|
||||
import kha.graphics4.TextureAddressing;
|
||||
import kha.graphics4.TextureFilter;
|
||||
import kha.graphics4.Usage;
|
||||
import kha.graphics4.VertexBuffer;
|
||||
import kha.math.FastMatrix3;
|
||||
import kha.math.FastMatrix4;
|
||||
import kha.math.FastVector2;
|
||||
import kha.math.FastVector3;
|
||||
import kha.math.FastVector4;
|
||||
import kha.Canvas;
|
||||
import kha.Image;
|
||||
import kha.Video;
|
||||
import kha.Color;
|
||||
|
||||
class Graphics implements kha.graphics4.Graphics {
|
||||
var target: Canvas;
|
||||
|
||||
public function new(target: Canvas = null) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public function vsynced(): Bool {
|
||||
return kinc_graphics_vsynced();
|
||||
}
|
||||
|
||||
public function refreshRate(): Int {
|
||||
return kinc_graphics_refreshrate();
|
||||
}
|
||||
|
||||
public function clear(?color: Color, ?z: FastFloat, ?stencil: Int): Void {
|
||||
var flags: Int = 0;
|
||||
if (color != null)
|
||||
flags |= 1;
|
||||
if (z != null)
|
||||
flags |= 2;
|
||||
if (stencil != null)
|
||||
flags |= 4;
|
||||
kinc_graphics_clear(flags, color == null ? 0 : color.value, z, stencil);
|
||||
}
|
||||
|
||||
public function viewport(x: Int, y: Int, width: Int, height: Int): Void {
|
||||
kinc_graphics_viewport(x, y, width, height);
|
||||
}
|
||||
|
||||
public function setVertexBuffer(vertexBuffer: kha.graphics4.VertexBuffer): Void {
|
||||
kinc_graphics_set_vertexbuffer(vertexBuffer._buffer);
|
||||
}
|
||||
|
||||
public function setVertexBuffers(vertexBuffers: Array<kha.graphics4.VertexBuffer>): Void {
|
||||
kinc_graphics_set_vertexbuffers(vertexBuffers.length > 0 ? vertexBuffers[0]._buffer : null,
|
||||
vertexBuffers.length > 1 ? vertexBuffers[1]._buffer : null, vertexBuffers.length > 2 ? vertexBuffers[2]._buffer : null,
|
||||
vertexBuffers.length > 3 ? vertexBuffers[3]._buffer : null, vertexBuffers.length);
|
||||
}
|
||||
|
||||
public function setIndexBuffer(indexBuffer: kha.graphics4.IndexBuffer): Void {
|
||||
kinc_graphics_set_indexbuffer(indexBuffer._buffer);
|
||||
}
|
||||
|
||||
public function maxTextureSize(): Int {
|
||||
return 4096;
|
||||
}
|
||||
|
||||
public function supportsNonPow2Textures(): Bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setCubeMap(unit: kha.graphics4.TextureUnit, cubeMap: kha.graphics4.CubeMap): Void {
|
||||
if (cubeMap == null)
|
||||
return;
|
||||
if (cubeMap._texture != null)
|
||||
kinc_graphics_set_cubemap_texture(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, cubeMap._texture);
|
||||
else
|
||||
kinc_graphics_set_cubemap_target(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, cubeMap._renderTarget);
|
||||
}
|
||||
|
||||
public function setCubeMapDepth(unit: kha.graphics4.TextureUnit, cubeMap: kha.graphics4.CubeMap): Void {
|
||||
if (cubeMap == null)
|
||||
return;
|
||||
kinc_graphics_set_cubemap_depth(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, cubeMap._renderTarget);
|
||||
}
|
||||
|
||||
public function scissor(x: Int, y: Int, width: Int, height: Int): Void {
|
||||
kinc_graphics_scissor(x, y, width, height);
|
||||
}
|
||||
|
||||
public function disableScissor(): Void {
|
||||
kinc_graphics_disable_scissor();
|
||||
}
|
||||
|
||||
public function instancedRenderingAvailable(): Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setTextureParameters(unit: kha.graphics4.TextureUnit, uAddressing: TextureAddressing, vAddressing: TextureAddressing,
|
||||
minificationFilter: TextureFilter, magnificationFilter: TextureFilter, mipmapFilter: MipMapFilter): Void {
|
||||
kinc_graphics_set_texture_parameters(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, uAddressing, vAddressing, minificationFilter,
|
||||
magnificationFilter, mipmapFilter);
|
||||
}
|
||||
|
||||
public function setTexture3DParameters(unit: kha.graphics4.TextureUnit, uAddressing: TextureAddressing, vAddressing: TextureAddressing,
|
||||
wAddressing: TextureAddressing, minificationFilter: TextureFilter, magnificationFilter: TextureFilter, mipmapFilter: MipMapFilter): Void {
|
||||
kinc_graphics_set_texture3d_parameters(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, uAddressing, vAddressing, wAddressing, minificationFilter,
|
||||
magnificationFilter, mipmapFilter);
|
||||
}
|
||||
|
||||
public function setTextureCompareMode(unit: kha.graphics4.TextureUnit, enabled: Bool) {
|
||||
kinc_graphics_set_texture_compare_mode(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, enabled);
|
||||
}
|
||||
|
||||
public function setCubeMapCompareMode(unit: kha.graphics4.TextureUnit, enabled: Bool) {
|
||||
kinc_graphics_set_cube_map_compare_mode(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, enabled);
|
||||
}
|
||||
|
||||
public function setTexture(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
if (texture._texture != null)
|
||||
kinc_graphics_set_texture(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, texture._texture);
|
||||
else
|
||||
kinc_graphics_set_render_target(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, texture._renderTarget);
|
||||
}
|
||||
|
||||
public function setTextureArray(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
kinc_graphics_set_texture_array(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, texture._textureArray);
|
||||
}
|
||||
|
||||
public function setTextureDepth(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
kinc_graphics_set_texture_depth(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, texture._renderTarget);
|
||||
}
|
||||
|
||||
public function setVideoTexture(unit: kha.graphics4.TextureUnit, texture: kha.Video): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
kinc_graphics_set_texture(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, Image.fromVideo(texture)._texture);
|
||||
}
|
||||
|
||||
public function setImageTexture(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
kinc_graphics_set_image_texture(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, texture._texture);
|
||||
}
|
||||
|
||||
public function maxBoundTextures(): Int {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public function setPipeline(pipe: PipelineState): Void {
|
||||
pipe.set();
|
||||
}
|
||||
|
||||
public function setStencilReferenceValue(value: Int): Void {}
|
||||
|
||||
public function setBool(location: kha.graphics4.ConstantLocation, value: Bool): Void {
|
||||
kinc_graphics_set_bool(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value);
|
||||
}
|
||||
|
||||
public function setInt(location: kha.graphics4.ConstantLocation, value: Int): Void {
|
||||
kinc_graphics_set_int(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value);
|
||||
}
|
||||
|
||||
public function setInt2(location: kha.graphics4.ConstantLocation, value1: Int, value2: Int): Void {
|
||||
kinc_graphics_set_int2(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2);
|
||||
}
|
||||
|
||||
public function setInt3(location: kha.graphics4.ConstantLocation, value1: Int, value2: Int, value3: Int): Void {
|
||||
kinc_graphics_set_int3(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2, value3);
|
||||
}
|
||||
|
||||
public function setInt4(location: kha.graphics4.ConstantLocation, value1: Int, value2: Int, value3: Int, value4: Int): Void {
|
||||
kinc_graphics_set_int4(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2, value3, value4);
|
||||
}
|
||||
|
||||
public function setInts(location: kha.graphics4.ConstantLocation, values: kha.arrays.Int32Array): Void {
|
||||
kinc_graphics_set_ints(cast(location, kha.korehl.graphics4.ConstantLocation)._location, values.getData(), values.length);
|
||||
}
|
||||
|
||||
public function setFloat(location: kha.graphics4.ConstantLocation, value: FastFloat): Void {
|
||||
kinc_graphics_set_float(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value);
|
||||
}
|
||||
|
||||
public function setFloat2(location: kha.graphics4.ConstantLocation, value1: FastFloat, value2: FastFloat): Void {
|
||||
kinc_graphics_set_float2(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2);
|
||||
}
|
||||
|
||||
public function setFloat3(location: kha.graphics4.ConstantLocation, value1: FastFloat, value2: FastFloat, value3: FastFloat): Void {
|
||||
kinc_graphics_set_float3(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2, value3);
|
||||
}
|
||||
|
||||
public function setFloat4(location: kha.graphics4.ConstantLocation, value1: FastFloat, value2: FastFloat, value3: FastFloat, value4: FastFloat): Void {
|
||||
kinc_graphics_set_float4(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2, value3, value4);
|
||||
}
|
||||
|
||||
public function setVector2(location: kha.graphics4.ConstantLocation, value: FastVector2): Void {
|
||||
kinc_graphics_set_float2(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value.x, value.y);
|
||||
}
|
||||
|
||||
public function setVector3(location: kha.graphics4.ConstantLocation, value: FastVector3): Void {
|
||||
kinc_graphics_set_float3(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value.x, value.y, value.z);
|
||||
}
|
||||
|
||||
public function setVector4(location: kha.graphics4.ConstantLocation, value: FastVector4): Void {
|
||||
kinc_graphics_set_float4(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value.x, value.y, value.z, value.w);
|
||||
}
|
||||
|
||||
public function setFloats(location: kha.graphics4.ConstantLocation, values: Float32Array): Void {
|
||||
kinc_graphics_set_floats(cast(location, kha.korehl.graphics4.ConstantLocation)._location, values.getData(), values.length);
|
||||
}
|
||||
|
||||
public inline function setMatrix(location: kha.graphics4.ConstantLocation, matrix: FastMatrix4): Void {
|
||||
kinc_graphics_set_matrix(cast(location, kha.korehl.graphics4.ConstantLocation)._location, matrix._00, matrix._10, matrix._20, matrix._30, matrix._01,
|
||||
matrix._11, matrix._21, matrix._31, matrix._02, matrix._12, matrix._22, matrix._32, matrix._03, matrix._13, matrix._23, matrix._33);
|
||||
}
|
||||
|
||||
public inline function setMatrix3(location: kha.graphics4.ConstantLocation, matrix: FastMatrix3): Void {
|
||||
kinc_graphics_set_matrix3(cast(location, kha.korehl.graphics4.ConstantLocation)._location, matrix._00, matrix._10, matrix._20, matrix._01, matrix._11,
|
||||
matrix._21, matrix._02, matrix._12, matrix._22);
|
||||
}
|
||||
|
||||
public function drawIndexedVertices(start: Int = 0, count: Int = -1): Void {
|
||||
if (count < 0)
|
||||
kinc_graphics_draw_all_indexed_vertices();
|
||||
else
|
||||
kinc_graphics_draw_indexed_vertices(start, count);
|
||||
}
|
||||
|
||||
public function drawIndexedVerticesInstanced(instanceCount: Int, start: Int = 0, count: Int = -1): Void {
|
||||
if (count < 0)
|
||||
kinc_graphics_draw_all_indexed_vertices_instanced(instanceCount);
|
||||
else
|
||||
kinc_graphics_draw_indexed_vertices_instanced(instanceCount, start, count);
|
||||
}
|
||||
|
||||
function renderToTexture(additionalRenderTargets: Array<Canvas>): Void {
|
||||
if (additionalRenderTargets != null) {
|
||||
var len = additionalRenderTargets.length;
|
||||
var rt0 = cast(target, Image)._renderTarget;
|
||||
var rt1 = len > 0 ? cast(additionalRenderTargets[0], Image)._renderTarget : null;
|
||||
var rt2 = len > 1 ? cast(additionalRenderTargets[1], Image)._renderTarget : null;
|
||||
var rt3 = len > 2 ? cast(additionalRenderTargets[2], Image)._renderTarget : null;
|
||||
var rt4 = len > 3 ? cast(additionalRenderTargets[3], Image)._renderTarget : null;
|
||||
var rt5 = len > 4 ? cast(additionalRenderTargets[4], Image)._renderTarget : null;
|
||||
var rt6 = len > 5 ? cast(additionalRenderTargets[5], Image)._renderTarget : null;
|
||||
var rt7 = len > 6 ? cast(additionalRenderTargets[6], Image)._renderTarget : null;
|
||||
kinc_graphics_render_to_textures(rt0, rt1, rt2, rt3, rt4, rt5, rt6, rt7, len + 1);
|
||||
}
|
||||
else {
|
||||
kinc_graphics_render_to_texture(cast(target, Image)._renderTarget);
|
||||
}
|
||||
}
|
||||
|
||||
public function begin(additionalRenderTargets: Array<Canvas> = null): Void {
|
||||
if (target == null)
|
||||
kinc_graphics_restore_render_target();
|
||||
else
|
||||
renderToTexture(additionalRenderTargets);
|
||||
}
|
||||
|
||||
public function beginFace(face: Int): Void {
|
||||
kinc_graphics_render_to_face(cast(target, CubeMap)._renderTarget, face);
|
||||
}
|
||||
|
||||
public function beginEye(eye: Int): Void {}
|
||||
|
||||
public function end(): Void {}
|
||||
|
||||
public function flush(): Void {
|
||||
kinc_graphics_flush();
|
||||
}
|
||||
|
||||
public function setShaderStorageBuffer(buffer: ShaderStorageBuffer, index: Int) {
|
||||
// Kore::Compute::setBuffer(buffer->buffer, index);
|
||||
}
|
||||
|
||||
public function setComputeShader(shader: ComputeShader) {
|
||||
kinc_g4_set_compute_shader(shader._shader);
|
||||
}
|
||||
|
||||
public function compute(x: Int, y: Int, z: Int) {
|
||||
kinc_g4_compute(x, y, z);
|
||||
}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_clear") static function kinc_graphics_clear(flags: Int, color: Int, z: FastFloat, stencil: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_vsynced") static function kinc_graphics_vsynced(): Bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_refreshrate") static function kinc_graphics_refreshrate(): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_viewport") static function kinc_graphics_viewport(x: Int, y: Int, width: Int, height: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_vertexbuffer") static function kinc_graphics_set_vertexbuffer(buffer: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_vertexbuffers") static function kinc_graphics_set_vertexbuffers(b0: Pointer, b1: Pointer, b2: Pointer, b3: Pointer,
|
||||
count: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_indexbuffer") static function kinc_graphics_set_indexbuffer(buffer: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_scissor") static function kinc_graphics_scissor(x: Int, y: Int, width: Int, height: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_disable_scissor") static function kinc_graphics_disable_scissor(): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture_parameters") static function kinc_graphics_set_texture_parameters(unit: Pointer, uAddressing: Int,
|
||||
vAddressing: Int, minificationFilter: Int, magnificationFilter: Int, mipmapFilter: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture3d_parameters") static function kinc_graphics_set_texture3d_parameters(unit: Pointer, uAddressing: Int,
|
||||
vAddressing: Int, wAddressing: Int, minificationFilter: Int, magnificationFilter: Int, mipmapFilter: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture_compare_mode") static function kinc_graphics_set_texture_compare_mode(unit: Pointer, enabled: Bool): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_cube_map_compare_mode") static function kinc_graphics_set_cube_map_compare_mode(unit: Pointer, enabled: Bool): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture") static function kinc_graphics_set_texture(unit: Pointer, texture: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture_depth") static function kinc_graphics_set_texture_depth(unit: Pointer, renderTarget: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture_array") static function kinc_graphics_set_texture_array(unit: Pointer, textureArray: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_render_target") static function kinc_graphics_set_render_target(unit: Pointer, renderTarget: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_cubemap_texture") static function kinc_graphics_set_cubemap_texture(unit: Pointer, texture: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_cubemap_target") static function kinc_graphics_set_cubemap_target(unit: Pointer, renderTarget: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_cubemap_depth") static function kinc_graphics_set_cubemap_depth(unit: Pointer, renderTarget: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_image_texture") static function kinc_graphics_set_image_texture(unit: Pointer, texture: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_bool") static function kinc_graphics_set_bool(location: Pointer, value: Bool): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_int") static function kinc_graphics_set_int(location: Pointer, value: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_int2") static function kinc_graphics_set_int2(location: Pointer, value1: Int, value2: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_int3") static function kinc_graphics_set_int3(location: Pointer, value1: Int, value2: Int, value3: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_int4") static function kinc_graphics_set_int4(location: Pointer, value1: Int, value2: Int, value3: Int,
|
||||
value4: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_ints") static function kinc_graphics_set_ints(location: Pointer, values: Pointer, count: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_float") static function kinc_graphics_set_float(location: Pointer, value: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_float2") static function kinc_graphics_set_float2(location: Pointer, value1: FastFloat, value2: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_float3") static function kinc_graphics_set_float3(location: Pointer, value1: FastFloat, value2: FastFloat,
|
||||
value3: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_float4") static function kinc_graphics_set_float4(location: Pointer, value1: FastFloat, value2: FastFloat,
|
||||
value3: FastFloat, value4: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_floats") static function kinc_graphics_set_floats(location: Pointer, values: Pointer, count: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_matrix") static function kinc_graphics_set_matrix(location: Pointer, _00: FastFloat, _10: FastFloat, _20: FastFloat,
|
||||
_30: FastFloat, _01: FastFloat, _11: FastFloat, _21: FastFloat, _31: FastFloat, _02: FastFloat, _12: FastFloat, _22: FastFloat, _32: FastFloat,
|
||||
_03: FastFloat, _13: FastFloat, _23: FastFloat, _33: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_matrix3") static function kinc_graphics_set_matrix3(location: Pointer, _00: FastFloat, _10: FastFloat,
|
||||
_20: FastFloat, _01: FastFloat, _11: FastFloat, _21: FastFloat, _02: FastFloat, _12: FastFloat, _22: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_draw_all_indexed_vertices") static function kinc_graphics_draw_all_indexed_vertices(): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_draw_indexed_vertices") static function kinc_graphics_draw_indexed_vertices(start: Int, count: Int): Void {}
|
||||
|
||||
@:hlNative("std",
|
||||
"kinc_graphics_draw_all_indexed_vertices_instanced") static function kinc_graphics_draw_all_indexed_vertices_instanced(instanceCount: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_draw_indexed_vertices_instanced") static function kinc_graphics_draw_indexed_vertices_instanced(instanceCount: Int,
|
||||
start: Int, count: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_restore_render_target") static function kinc_graphics_restore_render_target(): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_render_to_texture") static function kinc_graphics_render_to_texture(renderTarget: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_render_to_textures") static function kinc_graphics_render_to_textures(rt0: Pointer, rt1: Pointer, rt2: Pointer,
|
||||
rt3: Pointer, rt4: Pointer, rt5: Pointer, rt6: Pointer, rt7: Pointer, count: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_render_to_face") static function kinc_graphics_render_to_face(renderTarget: Pointer, face: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_flush") static function kinc_graphics_flush(): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_g4_set_compute_shader") static function kinc_g4_set_compute_shader(shader: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_g4_compute") static function kinc_g4_compute(x: Int, y: Int, z: Int): Void {}
|
||||
}
|
||||
package kha.korehl.graphics4;
|
||||
|
||||
import kha.arrays.Float32Array;
|
||||
import kha.graphics4.ComputeShader;
|
||||
import kha.graphics4.CubeMap;
|
||||
import kha.graphics4.MipMapFilter;
|
||||
import kha.graphics4.PipelineState;
|
||||
import kha.graphics4.ShaderStorageBuffer;
|
||||
import kha.graphics4.TextureAddressing;
|
||||
import kha.graphics4.TextureFilter;
|
||||
import kha.graphics4.Usage;
|
||||
import kha.graphics4.VertexBuffer;
|
||||
import kha.math.FastMatrix3;
|
||||
import kha.math.FastMatrix4;
|
||||
import kha.math.FastVector2;
|
||||
import kha.math.FastVector3;
|
||||
import kha.math.FastVector4;
|
||||
import kha.Canvas;
|
||||
import kha.Image;
|
||||
import kha.Video;
|
||||
import kha.Color;
|
||||
|
||||
class Graphics implements kha.graphics4.Graphics {
|
||||
var target: Canvas;
|
||||
|
||||
public function new(target: Canvas = null) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public function vsynced(): Bool {
|
||||
return kinc_graphics_vsynced();
|
||||
}
|
||||
|
||||
public function refreshRate(): Int {
|
||||
return kinc_graphics_refreshrate();
|
||||
}
|
||||
|
||||
public function clear(?color: Color, ?z: FastFloat, ?stencil: Int): Void {
|
||||
var flags: Int = 0;
|
||||
if (color != null)
|
||||
flags |= 1;
|
||||
if (z != null)
|
||||
flags |= 2;
|
||||
if (stencil != null)
|
||||
flags |= 4;
|
||||
kinc_graphics_clear(flags, color == null ? 0 : color.value, z, stencil);
|
||||
}
|
||||
|
||||
public function viewport(x: Int, y: Int, width: Int, height: Int): Void {
|
||||
kinc_graphics_viewport(x, y, width, height);
|
||||
}
|
||||
|
||||
public function setVertexBuffer(vertexBuffer: kha.graphics4.VertexBuffer): Void {
|
||||
kinc_graphics_set_vertexbuffer(vertexBuffer._buffer);
|
||||
}
|
||||
|
||||
public function setVertexBuffers(vertexBuffers: Array<kha.graphics4.VertexBuffer>): Void {
|
||||
kinc_graphics_set_vertexbuffers(vertexBuffers.length > 0 ? vertexBuffers[0]._buffer : null,
|
||||
vertexBuffers.length > 1 ? vertexBuffers[1]._buffer : null, vertexBuffers.length > 2 ? vertexBuffers[2]._buffer : null,
|
||||
vertexBuffers.length > 3 ? vertexBuffers[3]._buffer : null, vertexBuffers.length);
|
||||
}
|
||||
|
||||
public function setIndexBuffer(indexBuffer: kha.graphics4.IndexBuffer): Void {
|
||||
kinc_graphics_set_indexbuffer(indexBuffer._buffer);
|
||||
}
|
||||
|
||||
public function maxTextureSize(): Int {
|
||||
return 4096;
|
||||
}
|
||||
|
||||
public function supportsNonPow2Textures(): Bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setCubeMap(unit: kha.graphics4.TextureUnit, cubeMap: kha.graphics4.CubeMap): Void {
|
||||
if (cubeMap == null)
|
||||
return;
|
||||
if (cubeMap._texture != null)
|
||||
kinc_graphics_set_cubemap_texture(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, cubeMap._texture);
|
||||
else
|
||||
kinc_graphics_set_cubemap_target(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, cubeMap._renderTarget);
|
||||
}
|
||||
|
||||
public function setCubeMapDepth(unit: kha.graphics4.TextureUnit, cubeMap: kha.graphics4.CubeMap): Void {
|
||||
if (cubeMap == null)
|
||||
return;
|
||||
kinc_graphics_set_cubemap_depth(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, cubeMap._renderTarget);
|
||||
}
|
||||
|
||||
public function scissor(x: Int, y: Int, width: Int, height: Int): Void {
|
||||
kinc_graphics_scissor(x, y, width, height);
|
||||
}
|
||||
|
||||
public function disableScissor(): Void {
|
||||
kinc_graphics_disable_scissor();
|
||||
}
|
||||
|
||||
public function instancedRenderingAvailable(): Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setTextureParameters(unit: kha.graphics4.TextureUnit, uAddressing: TextureAddressing, vAddressing: TextureAddressing,
|
||||
minificationFilter: TextureFilter, magnificationFilter: TextureFilter, mipmapFilter: MipMapFilter): Void {
|
||||
kinc_graphics_set_texture_parameters(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, uAddressing, vAddressing, minificationFilter,
|
||||
magnificationFilter, mipmapFilter);
|
||||
}
|
||||
|
||||
public function setTexture3DParameters(unit: kha.graphics4.TextureUnit, uAddressing: TextureAddressing, vAddressing: TextureAddressing,
|
||||
wAddressing: TextureAddressing, minificationFilter: TextureFilter, magnificationFilter: TextureFilter, mipmapFilter: MipMapFilter): Void {
|
||||
kinc_graphics_set_texture3d_parameters(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, uAddressing, vAddressing, wAddressing, minificationFilter,
|
||||
magnificationFilter, mipmapFilter);
|
||||
}
|
||||
|
||||
public function setTextureCompareMode(unit: kha.graphics4.TextureUnit, enabled: Bool) {
|
||||
kinc_graphics_set_texture_compare_mode(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, enabled);
|
||||
}
|
||||
|
||||
public function setCubeMapCompareMode(unit: kha.graphics4.TextureUnit, enabled: Bool) {
|
||||
kinc_graphics_set_cube_map_compare_mode(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, enabled);
|
||||
}
|
||||
|
||||
public function setTexture(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
if (texture._texture != null)
|
||||
kinc_graphics_set_texture(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, texture._texture);
|
||||
else
|
||||
kinc_graphics_set_render_target(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, texture._renderTarget);
|
||||
}
|
||||
|
||||
public function setTextureArray(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
kinc_graphics_set_texture_array(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, texture._textureArray);
|
||||
}
|
||||
|
||||
public function setTextureDepth(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
kinc_graphics_set_texture_depth(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, texture._renderTarget);
|
||||
}
|
||||
|
||||
public function setVideoTexture(unit: kha.graphics4.TextureUnit, texture: kha.Video): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
kinc_graphics_set_texture(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, Image.fromVideo(texture)._texture);
|
||||
}
|
||||
|
||||
public function setImageTexture(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
kinc_graphics_set_image_texture(cast(unit, kha.korehl.graphics4.TextureUnit)._unit, texture._texture);
|
||||
}
|
||||
|
||||
public function maxBoundTextures(): Int {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public function setPipeline(pipe: PipelineState): Void {
|
||||
pipe.set();
|
||||
}
|
||||
|
||||
public function setStencilReferenceValue(value: Int): Void {}
|
||||
|
||||
public function setBool(location: kha.graphics4.ConstantLocation, value: Bool): Void {
|
||||
kinc_graphics_set_bool(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value);
|
||||
}
|
||||
|
||||
public function setInt(location: kha.graphics4.ConstantLocation, value: Int): Void {
|
||||
kinc_graphics_set_int(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value);
|
||||
}
|
||||
|
||||
public function setInt2(location: kha.graphics4.ConstantLocation, value1: Int, value2: Int): Void {
|
||||
kinc_graphics_set_int2(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2);
|
||||
}
|
||||
|
||||
public function setInt3(location: kha.graphics4.ConstantLocation, value1: Int, value2: Int, value3: Int): Void {
|
||||
kinc_graphics_set_int3(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2, value3);
|
||||
}
|
||||
|
||||
public function setInt4(location: kha.graphics4.ConstantLocation, value1: Int, value2: Int, value3: Int, value4: Int): Void {
|
||||
kinc_graphics_set_int4(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2, value3, value4);
|
||||
}
|
||||
|
||||
public function setInts(location: kha.graphics4.ConstantLocation, values: kha.arrays.Int32Array): Void {
|
||||
kinc_graphics_set_ints(cast(location, kha.korehl.graphics4.ConstantLocation)._location, values.getData(), values.length);
|
||||
}
|
||||
|
||||
public function setFloat(location: kha.graphics4.ConstantLocation, value: FastFloat): Void {
|
||||
kinc_graphics_set_float(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value);
|
||||
}
|
||||
|
||||
public function setFloat2(location: kha.graphics4.ConstantLocation, value1: FastFloat, value2: FastFloat): Void {
|
||||
kinc_graphics_set_float2(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2);
|
||||
}
|
||||
|
||||
public function setFloat3(location: kha.graphics4.ConstantLocation, value1: FastFloat, value2: FastFloat, value3: FastFloat): Void {
|
||||
kinc_graphics_set_float3(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2, value3);
|
||||
}
|
||||
|
||||
public function setFloat4(location: kha.graphics4.ConstantLocation, value1: FastFloat, value2: FastFloat, value3: FastFloat, value4: FastFloat): Void {
|
||||
kinc_graphics_set_float4(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value1, value2, value3, value4);
|
||||
}
|
||||
|
||||
public function setVector2(location: kha.graphics4.ConstantLocation, value: FastVector2): Void {
|
||||
kinc_graphics_set_float2(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value.x, value.y);
|
||||
}
|
||||
|
||||
public function setVector3(location: kha.graphics4.ConstantLocation, value: FastVector3): Void {
|
||||
kinc_graphics_set_float3(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value.x, value.y, value.z);
|
||||
}
|
||||
|
||||
public function setVector4(location: kha.graphics4.ConstantLocation, value: FastVector4): Void {
|
||||
kinc_graphics_set_float4(cast(location, kha.korehl.graphics4.ConstantLocation)._location, value.x, value.y, value.z, value.w);
|
||||
}
|
||||
|
||||
public function setFloats(location: kha.graphics4.ConstantLocation, values: Float32Array): Void {
|
||||
kinc_graphics_set_floats(cast(location, kha.korehl.graphics4.ConstantLocation)._location, values.getData(), values.length);
|
||||
}
|
||||
|
||||
public inline function setMatrix(location: kha.graphics4.ConstantLocation, matrix: FastMatrix4): Void {
|
||||
kinc_graphics_set_matrix(cast(location, kha.korehl.graphics4.ConstantLocation)._location, matrix._00, matrix._10, matrix._20, matrix._30, matrix._01,
|
||||
matrix._11, matrix._21, matrix._31, matrix._02, matrix._12, matrix._22, matrix._32, matrix._03, matrix._13, matrix._23, matrix._33);
|
||||
}
|
||||
|
||||
public inline function setMatrix3(location: kha.graphics4.ConstantLocation, matrix: FastMatrix3): Void {
|
||||
kinc_graphics_set_matrix3(cast(location, kha.korehl.graphics4.ConstantLocation)._location, matrix._00, matrix._10, matrix._20, matrix._01, matrix._11,
|
||||
matrix._21, matrix._02, matrix._12, matrix._22);
|
||||
}
|
||||
|
||||
public function drawIndexedVertices(start: Int = 0, count: Int = -1): Void {
|
||||
if (count < 0)
|
||||
kinc_graphics_draw_all_indexed_vertices();
|
||||
else
|
||||
kinc_graphics_draw_indexed_vertices(start, count);
|
||||
}
|
||||
|
||||
public function drawIndexedVerticesInstanced(instanceCount: Int, start: Int = 0, count: Int = -1): Void {
|
||||
if (count < 0)
|
||||
kinc_graphics_draw_all_indexed_vertices_instanced(instanceCount);
|
||||
else
|
||||
kinc_graphics_draw_indexed_vertices_instanced(instanceCount, start, count);
|
||||
}
|
||||
|
||||
function renderToTexture(additionalRenderTargets: Array<Canvas>): Void {
|
||||
if (additionalRenderTargets != null) {
|
||||
var len = additionalRenderTargets.length;
|
||||
var rt0 = cast(target, Image)._renderTarget;
|
||||
var rt1 = len > 0 ? cast(additionalRenderTargets[0], Image)._renderTarget : null;
|
||||
var rt2 = len > 1 ? cast(additionalRenderTargets[1], Image)._renderTarget : null;
|
||||
var rt3 = len > 2 ? cast(additionalRenderTargets[2], Image)._renderTarget : null;
|
||||
var rt4 = len > 3 ? cast(additionalRenderTargets[3], Image)._renderTarget : null;
|
||||
var rt5 = len > 4 ? cast(additionalRenderTargets[4], Image)._renderTarget : null;
|
||||
var rt6 = len > 5 ? cast(additionalRenderTargets[5], Image)._renderTarget : null;
|
||||
var rt7 = len > 6 ? cast(additionalRenderTargets[6], Image)._renderTarget : null;
|
||||
kinc_graphics_render_to_textures(rt0, rt1, rt2, rt3, rt4, rt5, rt6, rt7, len + 1);
|
||||
}
|
||||
else {
|
||||
kinc_graphics_render_to_texture(cast(target, Image)._renderTarget);
|
||||
}
|
||||
}
|
||||
|
||||
public function begin(additionalRenderTargets: Array<Canvas> = null): Void {
|
||||
if (target == null)
|
||||
kinc_graphics_restore_render_target();
|
||||
else
|
||||
renderToTexture(additionalRenderTargets);
|
||||
}
|
||||
|
||||
public function beginFace(face: Int): Void {
|
||||
kinc_graphics_render_to_face((target is CubeMap) ? cast(target, CubeMap)._renderTarget : cast(target, Image)._renderTarget, face);
|
||||
}
|
||||
|
||||
public function beginEye(eye: Int): Void {}
|
||||
|
||||
public function end(): Void {}
|
||||
|
||||
public function flush(): Void {
|
||||
kinc_graphics_flush();
|
||||
}
|
||||
|
||||
public function setShaderStorageBuffer(buffer: ShaderStorageBuffer, index: Int) {
|
||||
// Kore::Compute::setBuffer(buffer->buffer, index);
|
||||
}
|
||||
|
||||
public function setComputeShader(shader: ComputeShader) {
|
||||
kinc_g4_set_compute_shader(shader._shader);
|
||||
}
|
||||
|
||||
public function compute(x: Int, y: Int, z: Int) {
|
||||
kinc_g4_compute(x, y, z);
|
||||
}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_clear") static function kinc_graphics_clear(flags: Int, color: Int, z: FastFloat, stencil: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_vsynced") static function kinc_graphics_vsynced(): Bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_refreshrate") static function kinc_graphics_refreshrate(): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_viewport") static function kinc_graphics_viewport(x: Int, y: Int, width: Int, height: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_vertexbuffer") static function kinc_graphics_set_vertexbuffer(buffer: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_vertexbuffers") static function kinc_graphics_set_vertexbuffers(b0: Pointer, b1: Pointer, b2: Pointer, b3: Pointer,
|
||||
count: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_indexbuffer") static function kinc_graphics_set_indexbuffer(buffer: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_scissor") static function kinc_graphics_scissor(x: Int, y: Int, width: Int, height: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_disable_scissor") static function kinc_graphics_disable_scissor(): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture_parameters") static function kinc_graphics_set_texture_parameters(unit: Pointer, uAddressing: Int,
|
||||
vAddressing: Int, minificationFilter: Int, magnificationFilter: Int, mipmapFilter: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture3d_parameters") static function kinc_graphics_set_texture3d_parameters(unit: Pointer, uAddressing: Int,
|
||||
vAddressing: Int, wAddressing: Int, minificationFilter: Int, magnificationFilter: Int, mipmapFilter: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture_compare_mode") static function kinc_graphics_set_texture_compare_mode(unit: Pointer, enabled: Bool): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_cube_map_compare_mode") static function kinc_graphics_set_cube_map_compare_mode(unit: Pointer, enabled: Bool): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture") static function kinc_graphics_set_texture(unit: Pointer, texture: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture_depth") static function kinc_graphics_set_texture_depth(unit: Pointer, renderTarget: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_texture_array") static function kinc_graphics_set_texture_array(unit: Pointer, textureArray: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_render_target") static function kinc_graphics_set_render_target(unit: Pointer, renderTarget: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_cubemap_texture") static function kinc_graphics_set_cubemap_texture(unit: Pointer, texture: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_cubemap_target") static function kinc_graphics_set_cubemap_target(unit: Pointer, renderTarget: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_cubemap_depth") static function kinc_graphics_set_cubemap_depth(unit: Pointer, renderTarget: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_image_texture") static function kinc_graphics_set_image_texture(unit: Pointer, texture: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_bool") static function kinc_graphics_set_bool(location: Pointer, value: Bool): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_int") static function kinc_graphics_set_int(location: Pointer, value: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_int2") static function kinc_graphics_set_int2(location: Pointer, value1: Int, value2: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_int3") static function kinc_graphics_set_int3(location: Pointer, value1: Int, value2: Int, value3: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_int4") static function kinc_graphics_set_int4(location: Pointer, value1: Int, value2: Int, value3: Int,
|
||||
value4: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_ints") static function kinc_graphics_set_ints(location: Pointer, values: Pointer, count: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_float") static function kinc_graphics_set_float(location: Pointer, value: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_float2") static function kinc_graphics_set_float2(location: Pointer, value1: FastFloat, value2: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_float3") static function kinc_graphics_set_float3(location: Pointer, value1: FastFloat, value2: FastFloat,
|
||||
value3: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_float4") static function kinc_graphics_set_float4(location: Pointer, value1: FastFloat, value2: FastFloat,
|
||||
value3: FastFloat, value4: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_floats") static function kinc_graphics_set_floats(location: Pointer, values: Pointer, count: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_matrix") static function kinc_graphics_set_matrix(location: Pointer, _00: FastFloat, _10: FastFloat, _20: FastFloat,
|
||||
_30: FastFloat, _01: FastFloat, _11: FastFloat, _21: FastFloat, _31: FastFloat, _02: FastFloat, _12: FastFloat, _22: FastFloat, _32: FastFloat,
|
||||
_03: FastFloat, _13: FastFloat, _23: FastFloat, _33: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_set_matrix3") static function kinc_graphics_set_matrix3(location: Pointer, _00: FastFloat, _10: FastFloat,
|
||||
_20: FastFloat, _01: FastFloat, _11: FastFloat, _21: FastFloat, _02: FastFloat, _12: FastFloat, _22: FastFloat): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_draw_all_indexed_vertices") static function kinc_graphics_draw_all_indexed_vertices(): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_draw_indexed_vertices") static function kinc_graphics_draw_indexed_vertices(start: Int, count: Int): Void {}
|
||||
|
||||
@:hlNative("std",
|
||||
"kinc_graphics_draw_all_indexed_vertices_instanced") static function kinc_graphics_draw_all_indexed_vertices_instanced(instanceCount: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_draw_indexed_vertices_instanced") static function kinc_graphics_draw_indexed_vertices_instanced(instanceCount: Int,
|
||||
start: Int, count: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_restore_render_target") static function kinc_graphics_restore_render_target(): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_render_to_texture") static function kinc_graphics_render_to_texture(renderTarget: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_render_to_textures") static function kinc_graphics_render_to_textures(rt0: Pointer, rt1: Pointer, rt2: Pointer,
|
||||
rt3: Pointer, rt4: Pointer, rt5: Pointer, rt6: Pointer, rt7: Pointer, count: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_render_to_face") static function kinc_graphics_render_to_face(renderTarget: Pointer, face: Int): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_graphics_flush") static function kinc_graphics_flush(): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_g4_set_compute_shader") static function kinc_g4_set_compute_shader(shader: Pointer): Void {}
|
||||
|
||||
@:hlNative("std", "kinc_g4_compute") static function kinc_g4_compute(x: Int, y: Int, z: Int): Void {}
|
||||
}
|
||||
|
||||
@ -1,22 +1,25 @@
|
||||
package kha.graphics4;
|
||||
|
||||
import haxe.io.Bytes;
|
||||
import kha.Blob;
|
||||
|
||||
class ComputeShader {
|
||||
public function new(sources: Array<Blob>, files: Array<String>) {
|
||||
|
||||
}
|
||||
|
||||
public function delete(): Void {
|
||||
|
||||
}
|
||||
|
||||
public function getConstantLocation(name: String): ConstantLocation {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getTextureUnit(name: String): TextureUnit {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package kha.graphics4;
|
||||
|
||||
import haxe.io.Bytes;
|
||||
import kha.Blob;
|
||||
|
||||
class ComputeShader {
|
||||
public var shader_: Dynamic;
|
||||
|
||||
public function new(sources: Array<Blob>, files: Array<String>) {
|
||||
shader_ = Krom.createShaderCompute(sources[0].toBytes().getData());
|
||||
}
|
||||
|
||||
public function delete(): Void {
|
||||
Krom.deleteShaderCompute(shader_);
|
||||
shader_ = null;
|
||||
}
|
||||
|
||||
public function getConstantLocation(name: String): ConstantLocation {
|
||||
return Krom.getConstantLocationCompute(shader_, name);
|
||||
}
|
||||
|
||||
public function getTextureUnit(name: String): TextureUnit {
|
||||
return Krom.getTextureUnitCompute(shader_, name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,10 +261,10 @@ class Graphics implements kha.graphics4.Graphics {
|
||||
}
|
||||
|
||||
public function setComputeShader(shader: ComputeShader) {
|
||||
|
||||
Krom.setShaderCompute(shader.shader_);
|
||||
}
|
||||
|
||||
public function compute(x: Int, y: Int, z: Int) {
|
||||
|
||||
Krom.compute(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 417 KiB After Width: | Height: | Size: 281 KiB |
|
Before Width: | Height: | Size: 417 KiB After Width: | Height: | Size: 281 KiB |
|
Before Width: | Height: | Size: 417 KiB After Width: | Height: | Size: 281 KiB |
|
Before Width: | Height: | Size: 417 KiB After Width: | Height: | Size: 281 KiB |
|
Before Width: | Height: | Size: 417 KiB After Width: | Height: | Size: 281 KiB |
|
Before Width: | Height: | Size: 417 KiB After Width: | Height: | Size: 281 KiB |
|
Before Width: | Height: | Size: 417 KiB After Width: | Height: | Size: 281 KiB |
BIN
Krom/Krom.exe
@ -672,7 +672,7 @@ class RenderPath {
|
||||
}
|
||||
|
||||
#if (rp_voxels != "Off")
|
||||
public function getComputeShader(handle: String): kha.compute.Shader {
|
||||
public function getComputeShader(handle: String): kha.graphics4.ComputeShader {
|
||||
return Reflect.field(kha.Shaders, handle + "_comp");
|
||||
}
|
||||
#end
|
||||
|
||||
@ -22,99 +22,99 @@ class Inc {
|
||||
#end
|
||||
|
||||
#if (rp_voxels != "Off")
|
||||
static var voxel_sh0:kha.compute.Shader = null;
|
||||
static var voxel_sh1:kha.compute.Shader = null;
|
||||
static var voxel_ta0:kha.compute.TextureUnit;
|
||||
static var voxel_tb0:kha.compute.TextureUnit;
|
||||
static var voxel_ca0:kha.compute.ConstantLocation;
|
||||
static var voxel_cb0:kha.compute.ConstantLocation;
|
||||
static var voxel_ta1:kha.compute.TextureUnit;
|
||||
static var voxel_tb1:kha.compute.TextureUnit;
|
||||
static var voxel_tc1:kha.compute.TextureUnit;
|
||||
static var voxel_sh0:kha.graphics4.ComputeShader = null;
|
||||
static var voxel_sh1:kha.graphics4.ComputeShader = null;
|
||||
static var voxel_ta0:kha.graphics4.TextureUnit;
|
||||
static var voxel_tb0:kha.graphics4.TextureUnit;
|
||||
static var voxel_ca0:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cb0:kha.graphics4.ConstantLocation;
|
||||
static var voxel_ta1:kha.graphics4.TextureUnit;
|
||||
static var voxel_tb1:kha.graphics4.TextureUnit;
|
||||
static var voxel_tc1:kha.graphics4.TextureUnit;
|
||||
static var m = iron.math.Mat4.identity();
|
||||
static var voxel_ca1:kha.compute.ConstantLocation;
|
||||
static var voxel_cb1:kha.compute.ConstantLocation;
|
||||
static var voxel_ca1:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cb1:kha.graphics4.ConstantLocation;
|
||||
#if (rp_voxels == "Voxel GI")
|
||||
static var voxel_td1:kha.compute.TextureUnit;
|
||||
static var voxel_te1:kha.compute.TextureUnit;
|
||||
static var voxel_tf1:kha.compute.TextureUnit;
|
||||
static var voxel_cc1:kha.compute.ConstantLocation;
|
||||
static var voxel_td1:kha.graphics4.TextureUnit;
|
||||
static var voxel_te1:kha.graphics4.TextureUnit;
|
||||
static var voxel_tf1:kha.graphics4.TextureUnit;
|
||||
static var voxel_cc1:kha.graphics4.ConstantLocation;
|
||||
#else
|
||||
#if lnx_voxelgi_shadows
|
||||
static var voxel_te1:kha.compute.TextureUnit;
|
||||
static var voxel_te1:kha.graphics4.TextureUnit;
|
||||
#end
|
||||
#end
|
||||
#if (lnx_voxelgi_shadows || rp_voxels == "Voxel GI")
|
||||
static var voxel_sh2:kha.compute.Shader = null;
|
||||
static var voxel_ta2:kha.compute.TextureUnit;
|
||||
static var voxel_tb2:kha.compute.TextureUnit;
|
||||
static var voxel_ca2:kha.compute.ConstantLocation;
|
||||
static var voxel_cb2:kha.compute.ConstantLocation;
|
||||
static var voxel_cc2:kha.compute.ConstantLocation;
|
||||
static var voxel_sh2:kha.graphics4.ComputeShader = null;
|
||||
static var voxel_ta2:kha.graphics4.TextureUnit;
|
||||
static var voxel_tb2:kha.graphics4.TextureUnit;
|
||||
static var voxel_ca2:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cb2:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cc2:kha.graphics4.ConstantLocation;
|
||||
#end
|
||||
static var voxel_sh3:kha.compute.Shader = null;
|
||||
static var voxel_ta3:kha.compute.TextureUnit;
|
||||
static var voxel_tb3:kha.compute.TextureUnit;
|
||||
static var voxel_tc3:kha.compute.TextureUnit;
|
||||
static var voxel_td3:kha.compute.TextureUnit;
|
||||
static var voxel_te3:kha.compute.TextureUnit;
|
||||
static var voxel_tf3:kha.compute.TextureUnit;
|
||||
static var voxel_sh3:kha.graphics4.ComputeShader = null;
|
||||
static var voxel_ta3:kha.graphics4.TextureUnit;
|
||||
static var voxel_tb3:kha.graphics4.TextureUnit;
|
||||
static var voxel_tc3:kha.graphics4.TextureUnit;
|
||||
static var voxel_td3:kha.graphics4.TextureUnit;
|
||||
static var voxel_te3:kha.graphics4.TextureUnit;
|
||||
static var voxel_tf3:kha.graphics4.TextureUnit;
|
||||
#if lnx_brdf
|
||||
static var voxel_tg3:kha.compute.TextureUnit;
|
||||
static var voxel_tg3:kha.graphics4.TextureUnit;
|
||||
#end
|
||||
#if lnx_radiance
|
||||
static var voxel_th3:kha.compute.TextureUnit;
|
||||
static var voxel_th3:kha.graphics4.TextureUnit;
|
||||
#end
|
||||
static var voxel_ca3:kha.compute.ConstantLocation;
|
||||
static var voxel_cb3:kha.compute.ConstantLocation;
|
||||
static var voxel_cc3:kha.compute.ConstantLocation;
|
||||
static var voxel_cd3:kha.compute.ConstantLocation;
|
||||
static var voxel_ce3:kha.compute.ConstantLocation;
|
||||
static var voxel_ca3:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cb3:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cc3:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cd3:kha.graphics4.ConstantLocation;
|
||||
static var voxel_ce3:kha.graphics4.ConstantLocation;
|
||||
#if lnx_irradiance
|
||||
static var voxel_cf3:kha.compute.ConstantLocation;
|
||||
static var voxel_cf3:kha.graphics4.ConstantLocation;
|
||||
#end
|
||||
#if lnx_radiance
|
||||
static var voxel_cg3:kha.compute.ConstantLocation;
|
||||
static var voxel_cg3:kha.graphics4.ConstantLocation;
|
||||
#end
|
||||
#if lnx_envcol
|
||||
static var voxel_ch3:kha.compute.ConstantLocation;
|
||||
static var voxel_ch3:kha.graphics4.ConstantLocation;
|
||||
#end
|
||||
#if (rp_voxels == "Voxel GI")
|
||||
static var voxel_sh4:kha.compute.Shader = null;
|
||||
static var voxel_ta4:kha.compute.TextureUnit;
|
||||
static var voxel_tb4:kha.compute.TextureUnit;
|
||||
static var voxel_tc4:kha.compute.TextureUnit;
|
||||
static var voxel_td4:kha.compute.TextureUnit;
|
||||
static var voxel_te4:kha.compute.TextureUnit;
|
||||
static var voxel_tf4:kha.compute.TextureUnit;
|
||||
static var voxel_ca4:kha.compute.ConstantLocation;
|
||||
static var voxel_cb4:kha.compute.ConstantLocation;
|
||||
static var voxel_cc4:kha.compute.ConstantLocation;
|
||||
static var voxel_cd4:kha.compute.ConstantLocation;
|
||||
static var voxel_sh4:kha.graphics4.ComputeShader = null;
|
||||
static var voxel_ta4:kha.graphics4.TextureUnit;
|
||||
static var voxel_tb4:kha.graphics4.TextureUnit;
|
||||
static var voxel_tc4:kha.graphics4.TextureUnit;
|
||||
static var voxel_td4:kha.graphics4.TextureUnit;
|
||||
static var voxel_te4:kha.graphics4.TextureUnit;
|
||||
static var voxel_tf4:kha.graphics4.TextureUnit;
|
||||
static var voxel_ca4:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cb4:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cc4:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cd4:kha.graphics4.ConstantLocation;
|
||||
|
||||
static var voxel_sh5:kha.compute.Shader = null;
|
||||
static var voxel_ta5:kha.compute.TextureUnit;
|
||||
static var voxel_te5:kha.compute.TextureUnit;
|
||||
static var voxel_tf5:kha.compute.TextureUnit;
|
||||
static var voxel_tg5:kha.compute.TextureUnit;
|
||||
static var voxel_ca5:kha.compute.ConstantLocation;
|
||||
static var voxel_cb5:kha.compute.ConstantLocation;
|
||||
static var voxel_cc5:kha.compute.ConstantLocation;
|
||||
static var voxel_cd5:kha.compute.ConstantLocation;
|
||||
static var voxel_ce5:kha.compute.ConstantLocation;
|
||||
static var voxel_cf5:kha.compute.ConstantLocation;
|
||||
static var voxel_cg5:kha.compute.ConstantLocation;
|
||||
static var voxel_sh5:kha.graphics4.ComputeShader = null;
|
||||
static var voxel_ta5:kha.graphics4.TextureUnit;
|
||||
static var voxel_te5:kha.graphics4.TextureUnit;
|
||||
static var voxel_tf5:kha.graphics4.TextureUnit;
|
||||
static var voxel_tg5:kha.graphics4.TextureUnit;
|
||||
static var voxel_ca5:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cb5:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cc5:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cd5:kha.graphics4.ConstantLocation;
|
||||
static var voxel_ce5:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cf5:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cg5:kha.graphics4.ConstantLocation;
|
||||
#if rp_shadowmap
|
||||
static var voxel_tb5:kha.compute.TextureUnit;
|
||||
static var voxel_tc5:kha.compute.TextureUnit;
|
||||
static var voxel_td5:kha.compute.TextureUnit;
|
||||
static var voxel_ch5:kha.compute.ConstantLocation;
|
||||
static var voxel_ci5:kha.compute.ConstantLocation;
|
||||
static var voxel_cj5:kha.compute.ConstantLocation;
|
||||
static var voxel_ck5:kha.compute.ConstantLocation;
|
||||
static var voxel_tb5:kha.graphics4.TextureUnit;
|
||||
static var voxel_tc5:kha.graphics4.TextureUnit;
|
||||
static var voxel_td5:kha.graphics4.TextureUnit;
|
||||
static var voxel_ch5:kha.graphics4.ConstantLocation;
|
||||
static var voxel_ci5:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cj5:kha.graphics4.ConstantLocation;
|
||||
static var voxel_ck5:kha.graphics4.ConstantLocation;
|
||||
#if lnx_shadowmap_atlas
|
||||
static var voxel_cl5:kha.compute.ConstantLocation;
|
||||
static var voxel_cm5:kha.compute.ConstantLocation;
|
||||
static var voxel_cl5:kha.graphics4.ConstantLocation;
|
||||
static var voxel_cm5:kha.graphics4.ConstantLocation;
|
||||
#end
|
||||
#end
|
||||
#end //rp_voxels == "Voxel GI"
|
||||
@ -852,7 +852,8 @@ class Inc {
|
||||
#end
|
||||
|
||||
#if (rp_voxels != "Off")
|
||||
public static function computeVoxelsBegin() {
|
||||
// TODO: set global graphic
|
||||
public static function computeVoxelsBegin(g: kha.graphics4.Graphics) {
|
||||
if (voxel_sh0 == null)
|
||||
{
|
||||
voxel_sh0 = path.getComputeShader("voxel_offsetprev");
|
||||
@ -984,16 +985,16 @@ class Inc {
|
||||
#end
|
||||
}
|
||||
|
||||
public static function computeVoxelsOffsetPrev() {
|
||||
public static function computeVoxelsOffsetPrev(g: kha.graphics4.Graphics) {
|
||||
var rts = path.renderTargets;
|
||||
var res = iron.RenderPath.getVoxelRes();
|
||||
var clipmaps = iron.RenderPath.clipmaps;
|
||||
var clipmap = clipmaps[iron.RenderPath.clipmapLevel];
|
||||
|
||||
kha.compute.Compute.setShader(voxel_sh0);
|
||||
g.setComputeShader(voxel_sh0);
|
||||
|
||||
kha.compute.Compute.setTexture(voxel_ta0, rts.get("voxelsOut").image, kha.compute.Access.Read);
|
||||
kha.compute.Compute.setTexture(voxel_tb0, rts.get("voxelsOutB").image, kha.compute.Access.Write);
|
||||
g.setImageTexture(voxel_ta0, rts.get("voxelsOut").image);
|
||||
g.setImageTexture(voxel_tb0, rts.get("voxelsOutB").image);
|
||||
|
||||
var fa:Float32Array = new Float32Array(Main.voxelgiClipmapCount * 10);
|
||||
for (i in 0...Main.voxelgiClipmapCount) {
|
||||
@ -1009,14 +1010,14 @@ class Inc {
|
||||
fa[i * 10 + 9] = clipmaps[i].offset_prev.z;
|
||||
}
|
||||
|
||||
kha.compute.Compute.setFloats(voxel_ca0, fa);
|
||||
g.setFloats(voxel_ca0, fa);
|
||||
|
||||
kha.compute.Compute.setInt(voxel_cb0, iron.RenderPath.clipmapLevel);
|
||||
g.setInt(voxel_cb0, iron.RenderPath.clipmapLevel);
|
||||
|
||||
kha.compute.Compute.compute(Std.int(res / 8), Std.int(res / 8), Std.int(res / 8));
|
||||
g.compute(Std.int(res / 8), Std.int(res / 8), Std.int(res / 8));
|
||||
}
|
||||
|
||||
public static function computeVoxelsTemporal() {
|
||||
public static function computeVoxelsTemporal(g: kha.graphics4.Graphics) {
|
||||
var rts = path.renderTargets;
|
||||
var res = iron.RenderPath.getVoxelRes();
|
||||
var camera = iron.Scene.active.camera;
|
||||
@ -1037,19 +1038,19 @@ class Inc {
|
||||
// Check again after init
|
||||
if (rts.get("voxels") == null || rts.get("voxelsOutB") == null || rts.get("voxelsOut") == null) return;
|
||||
|
||||
kha.compute.Compute.setShader(voxel_sh1);
|
||||
g.setComputeShader(voxel_sh1);
|
||||
|
||||
kha.compute.Compute.setTexture(voxel_ta1, rts.get("voxels").image, kha.compute.Access.Read);
|
||||
kha.compute.Compute.setTexture(voxel_tb1, rts.get("voxelsOutB").image, kha.compute.Access.Read);
|
||||
kha.compute.Compute.setTexture(voxel_tc1, rts.get("voxelsOut").image, kha.compute.Access.Write);
|
||||
g.setImageTexture(voxel_ta1, rts.get("voxels").image);
|
||||
g.setImageTexture(voxel_tb1, rts.get("voxelsOutB").image);
|
||||
g.setImageTexture(voxel_tc1, rts.get("voxelsOut").image);
|
||||
#if (rp_voxels == "Voxel GI")
|
||||
kha.compute.Compute.setSampledTexture(voxel_td1, rts.get("voxelsOutB").image);
|
||||
kha.compute.Compute.setTexture(voxel_te1, rts.get("voxelsLight").image, kha.compute.Access.Read);
|
||||
kha.compute.Compute.setTexture(voxel_tf1, rts.get("voxelsSDF").image, kha.compute.Access.Write);
|
||||
kha.compute.Compute.setFloat(voxel_cc1, iron.Scene.active.world == null ? 0.0 : iron.Scene.active.world.probe.raw.strength);
|
||||
g.setTexture(voxel_td1, rts.get("voxelsOutB").image);
|
||||
g.setImageTexture(voxel_te1, rts.get("voxelsLight").image);
|
||||
g.setImageTexture(voxel_tf1, rts.get("voxelsSDF").image);
|
||||
g.setFloat(voxel_cc1, iron.Scene.active.world == null ? 0.0 : iron.Scene.active.world.probe.raw.strength);
|
||||
#else
|
||||
#if lnx_voxelgi_shadows
|
||||
kha.compute.Compute.setTexture(voxel_te1, rts.get("voxelsSDF").image, kha.compute.Access.Write);
|
||||
g.setImageTexture(voxel_te1, rts.get("voxelsSDF").image);
|
||||
#end
|
||||
#end
|
||||
|
||||
@ -1067,17 +1068,17 @@ class Inc {
|
||||
fa[i * 10 + 9] = clipmaps[i].offset_prev.z;
|
||||
}
|
||||
|
||||
kha.compute.Compute.setFloats(voxel_ca1, fa);
|
||||
g.setFloats(voxel_ca1, fa);
|
||||
|
||||
kha.compute.Compute.setInt(voxel_cb1, iron.RenderPath.clipmapLevel);
|
||||
g.setInt(voxel_cb1, iron.RenderPath.clipmapLevel);
|
||||
|
||||
kha.compute.Compute.setFloat(voxel_cc1, iron.Scene.active.world == null ? 0.0 : iron.Scene.active.world.probe.raw.strength);
|
||||
g.setFloat(voxel_cc1, iron.Scene.active.world == null ? 0.0 : iron.Scene.active.world.probe.raw.strength);
|
||||
|
||||
kha.compute.Compute.compute(Std.int(res / 8), Std.int(res / 8), Std.int(res / 8));
|
||||
g.compute(Std.int(res / 8), Std.int(res / 8), Std.int(res / 8));
|
||||
}
|
||||
|
||||
#if (lnx_voxelgi_shadows || (rp_voxels == "Voxel GI"))
|
||||
public static function computeVoxelsSDF() {
|
||||
public static function computeVoxelsSDF(g: kha.graphics4.Graphics) {
|
||||
var rts = path.renderTargets;
|
||||
var res = iron.RenderPath.getVoxelRes();
|
||||
var clipmaps = iron.RenderPath.clipmaps;
|
||||
@ -1089,10 +1090,10 @@ class Inc {
|
||||
var passcount = Std.int(Math.ceil(Math.log(res) / Math.log(2.0)));
|
||||
|
||||
for (i in 0...passcount) {
|
||||
kha.compute.Compute.setShader(voxel_sh2);
|
||||
g.setComputeShader(voxel_sh2);
|
||||
|
||||
kha.compute.Compute.setTexture(voxel_ta2, rts.get(read_sdf).image, kha.compute.Access.Read);
|
||||
kha.compute.Compute.setTexture(voxel_tb2, rts.get(write_sdf).image, kha.compute.Access.Write);
|
||||
g.setImageTexture(voxel_ta2, rts.get(read_sdf).image);
|
||||
g.setImageTexture(voxel_tb2, rts.get(write_sdf).image);
|
||||
|
||||
var fa:Float32Array = new Float32Array(Main.voxelgiClipmapCount * 10);
|
||||
for (i in 0...Main.voxelgiClipmapCount) {
|
||||
@ -1108,14 +1109,14 @@ class Inc {
|
||||
fa[i * 10 + 9] = clipmaps[i].offset_prev.z;
|
||||
}
|
||||
|
||||
kha.compute.Compute.setFloats(voxel_ca2, fa);
|
||||
g.setFloats(voxel_ca2, fa);
|
||||
|
||||
kha.compute.Compute.setInt(voxel_cb2, iron.RenderPath.clipmapLevel);
|
||||
g.setInt(voxel_cb2, iron.RenderPath.clipmapLevel);
|
||||
|
||||
var jump_size = Math.pow(2.0, passcount - i - 1);
|
||||
kha.compute.Compute.setFloat(voxel_cc2, jump_size);
|
||||
g.setFloat(voxel_cc2, jump_size);
|
||||
|
||||
kha.compute.Compute.compute(Std.int(res / 8), Std.int(res / 8), Std.int(res / 8));
|
||||
g.compute(Std.int(res / 8), Std.int(res / 8), Std.int(res / 8));
|
||||
|
||||
if (i < passcount - 1)
|
||||
{
|
||||
@ -1127,29 +1128,29 @@ class Inc {
|
||||
#end
|
||||
|
||||
#if (rp_voxels == "Voxel AO")
|
||||
public static function resolveAO() {
|
||||
public static function resolveAO(g: kha.graphics4.Graphics) {
|
||||
var rts = path.renderTargets;
|
||||
var res = iron.RenderPath.getVoxelRes();
|
||||
var camera = iron.Scene.active.camera;
|
||||
var clipmaps = iron.RenderPath.clipmaps;
|
||||
var clipmap = clipmaps[iron.RenderPath.clipmapLevel];
|
||||
|
||||
kha.compute.Compute.setShader(voxel_sh3);
|
||||
g.setComputeShader(voxel_sh3);
|
||||
|
||||
kha.compute.Compute.setSampledTexture(voxel_ta3, rts.get("voxelsOut").image);
|
||||
kha.compute.Compute.setSampledTexture(voxel_tb3, rts.get("half").image);
|
||||
kha.compute.Compute.setSampledTexture(voxel_tc3, rts.get("gbuffer0").image);
|
||||
kha.compute.Compute.setTexture(voxel_td3, rts.get("voxels_ao").image, kha.compute.Access.Write);
|
||||
g.setTexture(voxel_ta3, rts.get("voxelsOut").image);
|
||||
g.setTexture(voxel_tb3, rts.get("half").image);
|
||||
g.setTexture(voxel_tc3, rts.get("gbuffer0").image);
|
||||
g.setImageTexture(voxel_td3, rts.get("voxels_ao").image);
|
||||
|
||||
kha.compute.Compute.setSampledTexture(voxel_te3, rts.get("gbuffer1").image);
|
||||
g.setTexture(voxel_te3, rts.get("gbuffer1").image);
|
||||
#if rp_gbuffer2
|
||||
kha.compute.Compute.setSampledTexture(voxel_tf3, rts.get("gbuffer2").image);
|
||||
g.setTexture(voxel_tf3, rts.get("gbuffer2").image);
|
||||
#end
|
||||
#if lnx_brdf
|
||||
kha.compute.Compute.setSampledTexture(voxel_tg3, iron.Scene.active.embedded.get("brdf.png"));
|
||||
g.setTexture(voxel_tg3, iron.Scene.active.embedded.get("brdf.png"));
|
||||
#end
|
||||
#if lnx_radiance
|
||||
kha.compute.Compute.setSampledTexture(voxel_th3, iron.Scene.active.world.probe.radiance);
|
||||
g.setTexture(voxel_th3, iron.Scene.active.world.probe.radiance);
|
||||
#end
|
||||
|
||||
var fa:Float32Array = new Float32Array(Main.voxelgiClipmapCount * 10);
|
||||
@ -1166,7 +1167,7 @@ class Inc {
|
||||
fa[i * 10 + 9] = clipmaps[i].offset_prev.z;
|
||||
}
|
||||
|
||||
kha.compute.Compute.setFloats(voxel_ca3, fa);
|
||||
g.setFloats(voxel_ca3, fa);
|
||||
|
||||
#if lnx_centerworld
|
||||
m.setFrom(vmat(camera.V));
|
||||
@ -1176,9 +1177,9 @@ class Inc {
|
||||
m.multmat(camera.P);
|
||||
m.getInverse(m);
|
||||
|
||||
kha.compute.Compute.setMatrix(voxel_cb3, m.self);
|
||||
g.setMatrix(voxel_cb3, m.self);
|
||||
|
||||
kha.compute.Compute.setFloat3(voxel_cc3, camera.transform.worldx(), camera.transform.worldy(), camera.transform.worldz());
|
||||
g.setFloat3(voxel_cc3, camera.transform.worldx(), camera.transform.worldy(), camera.transform.worldz());
|
||||
|
||||
var width = iron.App.w();
|
||||
var height = iron.App.h();
|
||||
@ -1193,17 +1194,17 @@ class Inc {
|
||||
width = Std.int(dp * Inc.getSuperSampling());
|
||||
}
|
||||
}
|
||||
kha.compute.Compute.setFloat2(voxel_cd3, width, height);
|
||||
g.setFloat2(voxel_cd3, width, height);
|
||||
|
||||
kha.compute.Compute.setFloat(voxel_ce3, iron.Scene.active.world == null ? 0.0 : iron.Scene.active.world.probe.raw.strength);
|
||||
g.setFloat(voxel_ce3, iron.Scene.active.world == null ? 0.0 : iron.Scene.active.world.probe.raw.strength);
|
||||
#if lnx_irradiance
|
||||
var irradiance = iron.Scene.active.world == null ?
|
||||
iron.data.WorldData.getEmptyIrradiance() :
|
||||
iron.Scene.active.world.probe.irradiance;
|
||||
kha.compute.Compute.setFloats(voxel_cf3, irradiance);
|
||||
g.setFloats(voxel_cf3, irradiance);
|
||||
#end
|
||||
#if lnx_radiance
|
||||
kha.compute.Compute.setFloat(voxel_cg3, iron.Scene.active.world != null ? iron.Scene.active.world.probe.raw.radiance_mipmaps + 1 - 2 : 1);
|
||||
g.setFloat(voxel_cg3, iron.Scene.active.world != null ? iron.Scene.active.world.probe.raw.radiance_mipmaps + 1 - 2 : 1);
|
||||
#end
|
||||
|
||||
#if lnx_envcol
|
||||
@ -1217,34 +1218,34 @@ class Inc {
|
||||
z = camera.data.raw.clear_color[2];
|
||||
}
|
||||
|
||||
kha.compute.Compute.setFloat3(voxel_ch3, x, y, z);
|
||||
g.setFloat3(voxel_ch3, x, y, z);
|
||||
#end
|
||||
|
||||
kha.compute.Compute.compute(Std.int((width + 7) / 8), Std.int((height + 7) / 8), 1);
|
||||
g.compute(Std.int((width + 7) / 8), Std.int((height + 7) / 8), 1);
|
||||
}
|
||||
#else
|
||||
public static function resolveDiffuse() {
|
||||
public static function resolveDiffuse(g: kha.graphics4.Graphics) {
|
||||
var rts = path.renderTargets;
|
||||
var res = iron.RenderPath.getVoxelRes();
|
||||
var camera = iron.Scene.active.camera;
|
||||
var clipmaps = iron.RenderPath.clipmaps;
|
||||
var clipmap = clipmaps[iron.RenderPath.clipmapLevel];
|
||||
|
||||
kha.compute.Compute.setShader(voxel_sh3);
|
||||
g.setComputeShader(voxel_sh3);
|
||||
|
||||
kha.compute.Compute.setSampledTexture(voxel_ta3, rts.get("voxelsOut").image);
|
||||
kha.compute.Compute.setSampledTexture(voxel_tb3, rts.get("half").image);
|
||||
kha.compute.Compute.setSampledTexture(voxel_tc3, rts.get("gbuffer0").image);
|
||||
kha.compute.Compute.setTexture(voxel_td3, rts.get("voxels_diffuse").image, kha.compute.Access.Write);
|
||||
kha.compute.Compute.setSampledTexture(voxel_te3, rts.get("gbuffer1").image);
|
||||
g.setTexture(voxel_ta3, rts.get("voxelsOut").image);
|
||||
g.setTexture(voxel_tb3, rts.get("half").image);
|
||||
g.setTexture(voxel_tc3, rts.get("gbuffer0").image);
|
||||
g.setImageTexture(voxel_td3, rts.get("voxels_diffuse").image);
|
||||
g.setTexture(voxel_te3, rts.get("gbuffer1").image);
|
||||
#if rp_gbuffer2
|
||||
kha.compute.Compute.setSampledTexture(voxel_tf3, rts.get("gbuffer2").image);
|
||||
g.setTexture(voxel_tf3, rts.get("gbuffer2").image);
|
||||
#end
|
||||
#if lnx_brdf
|
||||
kha.compute.Compute.setSampledTexture(voxel_tg3, iron.Scene.active.embedded.get("brdf.png"));
|
||||
g.setTexture(voxel_tg3, iron.Scene.active.embedded.get("brdf.png"));
|
||||
#end
|
||||
#if lnx_radiance
|
||||
kha.compute.Compute.setSampledTexture(voxel_th3, iron.Scene.active.world.probe.radiance);
|
||||
g.setTexture(voxel_th3, iron.Scene.active.world.probe.radiance);
|
||||
#end
|
||||
|
||||
var fa:Float32Array = new Float32Array(Main.voxelgiClipmapCount * 10);
|
||||
@ -1261,7 +1262,7 @@ class Inc {
|
||||
fa[i * 10 + 9] = clipmaps[i].offset_prev.z;
|
||||
}
|
||||
|
||||
kha.compute.Compute.setFloats(voxel_ca3, fa);
|
||||
g.setFloats(voxel_ca3, fa);
|
||||
|
||||
#if lnx_centerworld
|
||||
m.setFrom(vmat(camera.V));
|
||||
@ -1271,9 +1272,9 @@ class Inc {
|
||||
m.multmat(camera.P);
|
||||
m.getInverse(m);
|
||||
|
||||
kha.compute.Compute.setMatrix(voxel_cb3, m.self);
|
||||
g.setMatrix(voxel_cb3, m.self);
|
||||
|
||||
kha.compute.Compute.setFloat3(voxel_cc3, camera.transform.worldx(), camera.transform.worldy(), camera.transform.worldz());
|
||||
g.setFloat3(voxel_cc3, camera.transform.worldx(), camera.transform.worldy(), camera.transform.worldz());
|
||||
|
||||
var width = iron.App.w();
|
||||
var height = iron.App.h();
|
||||
@ -1288,17 +1289,17 @@ class Inc {
|
||||
width = Std.int(dp * Inc.getSuperSampling());
|
||||
}
|
||||
}
|
||||
kha.compute.Compute.setFloat2(voxel_cd3, width, height);
|
||||
g.setFloat2(voxel_cd3, width, height);
|
||||
|
||||
kha.compute.Compute.setFloat(voxel_ce3, iron.Scene.active.world == null ? 0.0 : iron.Scene.active.world.probe.raw.strength);
|
||||
g.setFloat(voxel_ce3, iron.Scene.active.world == null ? 0.0 : iron.Scene.active.world.probe.raw.strength);
|
||||
#if lnx_irradiance
|
||||
var irradiance = iron.Scene.active.world == null ?
|
||||
iron.data.WorldData.getEmptyIrradiance() :
|
||||
iron.Scene.active.world.probe.irradiance;
|
||||
kha.compute.Compute.setFloats(voxel_cf3, irradiance);
|
||||
g.setFloats(voxel_cf3, irradiance);
|
||||
#end
|
||||
#if lnx_radiance
|
||||
kha.compute.Compute.setFloat(voxel_cg3, iron.Scene.active.world != null ? iron.Scene.active.world.probe.raw.radiance_mipmaps + 1 - 2 : 1);
|
||||
g.setFloat(voxel_cg3, iron.Scene.active.world != null ? iron.Scene.active.world.probe.raw.radiance_mipmaps + 1 - 2 : 1);
|
||||
#end
|
||||
|
||||
#if lnx_envcol
|
||||
@ -1312,29 +1313,29 @@ class Inc {
|
||||
z = camera.data.raw.clear_color[2];
|
||||
}
|
||||
|
||||
kha.compute.Compute.setFloat3(voxel_ch3, x, y, z);
|
||||
g.setFloat3(voxel_ch3, x, y, z);
|
||||
#end
|
||||
|
||||
kha.compute.Compute.compute(Std.int((width + 7) / 8), Std.int((height + 7) / 8), 1);
|
||||
g.compute(Std.int((width + 7) / 8), Std.int((height + 7) / 8), 1);
|
||||
}
|
||||
#end
|
||||
|
||||
public static function resolveSpecular() {
|
||||
public static function resolveSpecular(g: kha.graphics4.Graphics) {
|
||||
var rts = path.renderTargets;
|
||||
var res = iron.RenderPath.getVoxelRes();
|
||||
var camera = iron.Scene.active.camera;
|
||||
var clipmaps = iron.RenderPath.clipmaps;
|
||||
var clipmap = clipmaps[iron.RenderPath.clipmapLevel];
|
||||
|
||||
kha.compute.Compute.setShader(voxel_sh4);
|
||||
g.setComputeShader(voxel_sh4);
|
||||
|
||||
kha.compute.Compute.setSampledTexture(voxel_ta4, rts.get("voxelsOut").image);
|
||||
kha.compute.Compute.setSampledTexture(voxel_tb4, rts.get("half").image);
|
||||
kha.compute.Compute.setSampledTexture(voxel_tc4, rts.get("gbuffer0").image);
|
||||
kha.compute.Compute.setSampledTexture(voxel_td4, rts.get("voxelsSDF").image);
|
||||
kha.compute.Compute.setTexture(voxel_te4, rts.get("voxels_specular").image, kha.compute.Access.Write);
|
||||
g.setTexture(voxel_ta4, rts.get("voxelsOut").image);
|
||||
g.setTexture(voxel_tb4, rts.get("half").image);
|
||||
g.setTexture(voxel_tc4, rts.get("gbuffer0").image);
|
||||
g.setTexture(voxel_td4, rts.get("voxelsSDF").image);
|
||||
g.setImageTexture(voxel_te4, rts.get("voxels_specular").image);
|
||||
#if rp_gbuffer2
|
||||
kha.compute.Compute.setSampledTexture(voxel_tf4, rts.get("gbuffer2").image);
|
||||
g.setTexture(voxel_tf4, rts.get("gbuffer2").image);
|
||||
#end
|
||||
|
||||
var fa:Float32Array = new Float32Array(Main.voxelgiClipmapCount * 10);
|
||||
@ -1351,7 +1352,7 @@ class Inc {
|
||||
fa[i * 10 + 9] = clipmaps[i].offset_prev.z;
|
||||
}
|
||||
|
||||
kha.compute.Compute.setFloats(voxel_ca4, fa);
|
||||
g.setFloats(voxel_ca4, fa);
|
||||
|
||||
#if lnx_centerworld
|
||||
m.setFrom(vmat(camera.V));
|
||||
@ -1361,9 +1362,9 @@ class Inc {
|
||||
m.multmat(camera.P);
|
||||
m.getInverse(m);
|
||||
|
||||
kha.compute.Compute.setMatrix(voxel_cb4, m.self);
|
||||
g.setMatrix(voxel_cb4, m.self);
|
||||
|
||||
kha.compute.Compute.setFloat3(voxel_cc4, camera.transform.worldx(), camera.transform.worldy(), camera.transform.worldz());
|
||||
g.setFloat3(voxel_cc4, camera.transform.worldx(), camera.transform.worldy(), camera.transform.worldz());
|
||||
|
||||
var width = iron.App.w();
|
||||
var height = iron.App.h();
|
||||
@ -1378,13 +1379,13 @@ class Inc {
|
||||
width = Std.int(dp * Inc.getSuperSampling());
|
||||
}
|
||||
}
|
||||
kha.compute.Compute.setFloat2(voxel_cd4, width, height);
|
||||
g.setFloat2(voxel_cd4, width, height);
|
||||
|
||||
kha.compute.Compute.compute(Std.int((width + 7) / 8), Std.int((height + 7) / 8), 1);
|
||||
g.compute(Std.int((width + 7) / 8), Std.int((height + 7) / 8), 1);
|
||||
}
|
||||
|
||||
#if (rp_voxels == "Voxel GI")
|
||||
public static function computeVoxelsLight() {
|
||||
public static function computeVoxelsLight(g: kha.graphics4.Graphics) {
|
||||
var rts = path.renderTargets;
|
||||
var res = iron.RenderPath.getVoxelRes();
|
||||
var camera = iron.Scene.active.camera;
|
||||
@ -1398,12 +1399,12 @@ class Inc {
|
||||
if (!l.visible) continue;
|
||||
path.light = l;
|
||||
|
||||
kha.compute.Compute.setShader(voxel_sh5);
|
||||
g.setComputeShader(voxel_sh5);
|
||||
|
||||
kha.compute.Compute.setTexture(voxel_ta5, rts.get("voxelsLight").image, kha.compute.Access.Write);
|
||||
kha.compute.Compute.setTexture(voxel_te5, rts.get("voxels").image, kha.compute.Access.Read);
|
||||
kha.compute.Compute.setSampledTexture(voxel_tf5, rts.get("voxelsOut").image);
|
||||
kha.compute.Compute.setSampledTexture(voxel_tg5, rts.get("voxelsSDF").image);
|
||||
g.setImageTexture(voxel_ta5, rts.get("voxelsLight").image);
|
||||
g.setImageTexture(voxel_te5, rts.get("voxels").image);
|
||||
g.setTexture(voxel_tf5, rts.get("voxelsOut").image);
|
||||
g.setTexture(voxel_tg5, rts.get("voxelsSDF").image);
|
||||
|
||||
var fa:Float32Array = new Float32Array(Main.voxelgiClipmapCount * 10);
|
||||
for (i in 0...Main.voxelgiClipmapCount) {
|
||||
@ -1419,48 +1420,48 @@ class Inc {
|
||||
fa[i * 10 + 9] = clipmaps[i].offset_prev.z;
|
||||
}
|
||||
|
||||
kha.compute.Compute.setFloats(voxel_ca5, fa);
|
||||
g.setFloats(voxel_ca5, fa);
|
||||
|
||||
kha.compute.Compute.setInt(voxel_cb5, iron.RenderPath.clipmapLevel);
|
||||
g.setInt(voxel_cb5, iron.RenderPath.clipmapLevel);
|
||||
|
||||
#if rp_shadowmap
|
||||
if (l.data.raw.type == "sun") {
|
||||
#if lnx_shadowmap_atlas
|
||||
#if lnx_shadowmap_atlas_single_map
|
||||
kha.compute.Compute.setSampledTexture(voxel_tb5, rts.get("shadowMapAtlas").image);
|
||||
g.setTexture(voxel_tb5, rts.get("shadowMapAtlas").image);
|
||||
#else
|
||||
kha.compute.Compute.setSampledTexture(voxel_tb5, rts.get("shadowMapAtlasSun").image);
|
||||
g.setTexture(voxel_tb5, rts.get("shadowMapAtlasSun").image);
|
||||
#end
|
||||
#else
|
||||
kha.compute.Compute.setSampledTexture(voxel_tb5, rts.get("shadowMap").image);
|
||||
g.setTexture(voxel_tb5, rts.get("shadowMap").image);
|
||||
#end
|
||||
kha.compute.Compute.setInt(voxel_ch5, 1); // lightShadow
|
||||
g.setInt(voxel_ch5, 1); // lightShadow
|
||||
}
|
||||
else if (l.data.raw.type == "spot" || l.data.raw.type == "area") {
|
||||
#if lnx_shadowmap_atlas
|
||||
#if lnx_shadowmap_atlas_single_map
|
||||
kha.compute.Compute.setSampledTexture(voxel_tc5, rts.get("shadowMapAtlas").image);
|
||||
g.setTexture(voxel_tc5, rts.get("shadowMapAtlas").image);
|
||||
#else
|
||||
kha.compute.Compute.setSampledTexture(voxel_tc5, rts.get("shadowMapAtlasSpot").image);
|
||||
g.setTexture(voxel_tc5, rts.get("shadowMapAtlasSpot").image);
|
||||
#end
|
||||
#else
|
||||
kha.compute.Compute.setSampledTexture(voxel_tc5, rts.get("shadowMapSpot[" + lightIndex + "]").image);
|
||||
g.setTexture(voxel_tc5, rts.get("shadowMapSpot[" + lightIndex + "]").image);
|
||||
#end
|
||||
kha.compute.Compute.setInt(voxel_ch5, 2);
|
||||
g.setInt(voxel_ch5, 2);
|
||||
}
|
||||
else {
|
||||
#if lnx_shadowmap_atlas
|
||||
#if lnx_shadowmap_atlas_single_map
|
||||
kha.compute.Compute.setSampledTexture(voxel_td5, rts.get("shadowMapAtlas").image);
|
||||
g.setTexture(voxel_td5, rts.get("shadowMapAtlas").image);
|
||||
#else
|
||||
kha.compute.Compute.setSampledTexture(voxel_td5, rts.get("shadowMapAtlasPoint").image);
|
||||
kha.compute.Compute.setInt(voxel_cl5, i);
|
||||
kha.compute.Compute.setFloats(voxel_cm5, iron.object.LightObject.pointLightsData);
|
||||
g.setTexture(voxel_td5, rts.get("shadowMapAtlasPoint").image);
|
||||
g.setInt(voxel_cl5, i);
|
||||
g.setFloats(voxel_cm5, iron.object.LightObject.pointLightsData);
|
||||
#end
|
||||
#else
|
||||
kha.compute.Compute.setSampledCubeMap(voxel_td5, rts.get("shadowMapPoint[" + lightIndex + "]").cubeMap);
|
||||
g.setCubeMap(voxel_td5, rts.get("shadowMapPoint[" + lightIndex + "]").cubeMap);
|
||||
#end
|
||||
kha.compute.Compute.setInt(voxel_ch5, 3);
|
||||
g.setInt(voxel_ch5, 3);
|
||||
}
|
||||
|
||||
// lightProj
|
||||
@ -1472,7 +1473,7 @@ class Inc {
|
||||
var c:kha.FastFloat = f2 * far * near;
|
||||
var vx:kha.FastFloat = a / b;
|
||||
var vy:kha.FastFloat = c / b;
|
||||
kha.compute.Compute.setFloat2(voxel_ci5, vx, vy);
|
||||
g.setFloat2(voxel_ci5, vx, vy);
|
||||
// LVP
|
||||
m.setFrom(l.VP);
|
||||
m.multmat(iron.object.Uniforms.biasMat);
|
||||
@ -1496,29 +1497,29 @@ class Inc {
|
||||
#end
|
||||
}
|
||||
#end
|
||||
kha.compute.Compute.setMatrix(voxel_cj5, m.self);
|
||||
g.setMatrix(voxel_cj5, m.self);
|
||||
// shadowsBias
|
||||
kha.compute.Compute.setFloat(voxel_ck5, l.data.raw.shadows_bias);
|
||||
g.setFloat(voxel_ck5, l.data.raw.shadows_bias);
|
||||
#end // rp_shadowmap
|
||||
|
||||
// lightPos
|
||||
kha.compute.Compute.setFloat3(voxel_cc5, l.transform.worldx(), l.transform.worldy(), l.transform.worldz());
|
||||
g.setFloat3(voxel_cc5, l.transform.worldx(), l.transform.worldy(), l.transform.worldz());
|
||||
// lightCol
|
||||
var f = l.data.raw.strength;
|
||||
kha.compute.Compute.setFloat3(voxel_cd5, l.data.raw.color[0] * f, l.data.raw.color[1] * f, l.data.raw.color[2] * f);
|
||||
g.setFloat3(voxel_cd5, l.data.raw.color[0] * f, l.data.raw.color[1] * f, l.data.raw.color[2] * f);
|
||||
// lightType
|
||||
kha.compute.Compute.setInt(voxel_ce5, iron.data.LightData.typeToInt(l.data.raw.type));
|
||||
g.setInt(voxel_ce5, iron.data.LightData.typeToInt(l.data.raw.type));
|
||||
// lightDir
|
||||
var v = l.look();
|
||||
kha.compute.Compute.setFloat3(voxel_cf5, v.x, v.y, v.z);
|
||||
g.setFloat3(voxel_cf5, v.x, v.y, v.z);
|
||||
// spotData
|
||||
if (l.data.raw.type == "spot") {
|
||||
var vx = l.data.raw.spot_size;
|
||||
var vy = vx - l.data.raw.spot_blend;
|
||||
kha.compute.Compute.setFloat2(voxel_cg5, vx, vy);
|
||||
g.setFloat2(voxel_cg5, vx, vy);
|
||||
}
|
||||
|
||||
kha.compute.Compute.compute(Std.int(res / 8), Std.int(res / 8), Std.int(res / 8));
|
||||
g.compute(Std.int(res / 8), Std.int(res / 8), Std.int(res / 8));
|
||||
|
||||
if (!iron.object.LightObject.discardLightCulled(l)) {
|
||||
lightIndex++;
|
||||
|
||||
@ -676,8 +676,10 @@ class RenderPathDeferred {
|
||||
if (leenkx.data.Config.raw.rp_gi != false)
|
||||
{
|
||||
var path = RenderPath.active;
|
||||
// TODO: investigate currentTarget
|
||||
var g = path.frameG;
|
||||
|
||||
Inc.computeVoxelsBegin();
|
||||
Inc.computeVoxelsBegin(g);
|
||||
|
||||
if (iron.RenderPath.pre_clear == true)
|
||||
{
|
||||
@ -693,7 +695,7 @@ class RenderPathDeferred {
|
||||
else
|
||||
{
|
||||
path.clearImage("voxels", 0x00000000);
|
||||
Inc.computeVoxelsOffsetPrev();
|
||||
Inc.computeVoxelsOffsetPrev(g);
|
||||
}
|
||||
|
||||
path.setTarget("");
|
||||
@ -713,11 +715,11 @@ class RenderPathDeferred {
|
||||
|
||||
path.drawMeshes("voxel");
|
||||
|
||||
Inc.computeVoxelsTemporal();
|
||||
Inc.computeVoxelsTemporal(g);
|
||||
|
||||
#if (rp_voxels == "Voxel GI")
|
||||
Inc.computeVoxelsLight();
|
||||
Inc.computeVoxelsSDF();
|
||||
Inc.computeVoxelsLight(g);
|
||||
Inc.computeVoxelsSDF(g);
|
||||
#end
|
||||
|
||||
if (iron.RenderPath.res_pre_clear == true) {
|
||||
@ -777,15 +779,16 @@ class RenderPathDeferred {
|
||||
#if (rp_voxels != "Off")
|
||||
if (leenkx.data.Config.raw.rp_gi != false)
|
||||
{
|
||||
var g = path.frameG;
|
||||
#if (lnx_config && (rp_voxels == "Voxel AO"))
|
||||
voxelao_pass = true;
|
||||
#end
|
||||
#if (rp_voxels == "Voxel AO")
|
||||
Inc.resolveAO();
|
||||
Inc.resolveAO(g);
|
||||
path.bindTarget("voxels_ao", "voxels_ao");
|
||||
#else
|
||||
Inc.resolveDiffuse();
|
||||
Inc.resolveSpecular();
|
||||
Inc.resolveDiffuse(g);
|
||||
Inc.resolveSpecular(g);
|
||||
path.bindTarget("voxels_diffuse", "voxels_diffuse");
|
||||
path.bindTarget("voxels_specular", "voxels_specular");
|
||||
#end
|
||||
|
||||