forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
17
Kha/Backends/Kinc-hxcpp/kha/kore/Keyboard.hx
Normal file
17
Kha/Backends/Kinc-hxcpp/kha/kore/Keyboard.hx
Normal file
@ -0,0 +1,17 @@
|
||||
package kha.kore;
|
||||
|
||||
@:headerCode("
|
||||
#include <kinc/input/keyboard.h>
|
||||
")
|
||||
@:allow(kha.SystemImpl)
|
||||
class Keyboard extends kha.input.Keyboard {
|
||||
function new() {
|
||||
super();
|
||||
}
|
||||
|
||||
@:functionCode("kinc_keyboard_show();")
|
||||
override public function show(): Void {}
|
||||
|
||||
@:functionCode("kinc_keyboard_hide();")
|
||||
override public function hide(): Void {}
|
||||
}
|
62
Kha/Backends/Kinc-hxcpp/kha/kore/Video.hx
Normal file
62
Kha/Backends/Kinc-hxcpp/kha/kore/Video.hx
Normal file
@ -0,0 +1,62 @@
|
||||
package kha.kore;
|
||||
|
||||
@:headerCode("
|
||||
#include <kinc/video.h>
|
||||
")
|
||||
@:headerClassCode("kinc_video_t video;")
|
||||
class Video extends kha.Video {
|
||||
public function new(filename: String) {
|
||||
super();
|
||||
init(filename);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_video_init(&video, filename.c_str());")
|
||||
function init(filename: String) {}
|
||||
|
||||
@:functionCode("kinc_video_play(&video, loop);")
|
||||
override public function play(loop: Bool = false): Void {}
|
||||
|
||||
@:functionCode("kinc_video_pause(&video);")
|
||||
override public function pause(): Void {}
|
||||
|
||||
@:functionCode("kinc_video_stop(&video);")
|
||||
override public function stop(): Void {}
|
||||
|
||||
override function update(time: Float) {
|
||||
untyped __cpp__('kinc_video_update(&video, time)');
|
||||
}
|
||||
|
||||
// @:functionCode("return static_cast<int>(video->duration * 1000.0);")
|
||||
override public function getLength(): Int { // Miliseconds
|
||||
return 0;
|
||||
}
|
||||
|
||||
// @:functionCode("return static_cast<int>(video->position * 1000.0);")
|
||||
override public function getCurrentPos(): Int { // Miliseconds
|
||||
return 0;
|
||||
}
|
||||
|
||||
override function get_position(): Int {
|
||||
return getCurrentPos();
|
||||
}
|
||||
|
||||
// @:functionCode("video->update(value / 1000.0); return value;")
|
||||
override function set_position(value: Int): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
override public function isFinished(): Bool {
|
||||
return untyped __cpp__("kinc_video_finished(&video)");
|
||||
}
|
||||
|
||||
override public function width(): Int {
|
||||
return untyped __cpp__("kinc_video_width(&video)");
|
||||
}
|
||||
|
||||
override public function height(): Int {
|
||||
return untyped __cpp__("kinc_video_height(&video)");
|
||||
}
|
||||
|
||||
@:functionCode("kinc_video_destroy(&video);")
|
||||
override public function unload(): Void {}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package kha.kore.graphics4;
|
||||
|
||||
@:headerCode("
|
||||
#include <kinc/graphics4/constantlocation.h>
|
||||
")
|
||||
@:headerClassCode("kinc_g4_constant_location_t location;")
|
||||
class ConstantLocation implements kha.graphics4.ConstantLocation {
|
||||
public function new() {}
|
||||
}
|
503
Kha/Backends/Kinc-hxcpp/kha/kore/graphics4/Graphics.hx
Normal file
503
Kha/Backends/Kinc-hxcpp/kha/kore/graphics4/Graphics.hx
Normal file
@ -0,0 +1,503 @@
|
||||
package kha.kore.graphics4;
|
||||
|
||||
import kha.arrays.Float32Array;
|
||||
import kha.Blob;
|
||||
import kha.Canvas;
|
||||
import kha.Color;
|
||||
import kha.graphics4.CubeMap;
|
||||
import kha.graphics4.CullMode;
|
||||
import kha.graphics4.FragmentShader;
|
||||
import kha.graphics4.BlendingFactor;
|
||||
import kha.graphics4.BlendingOperation;
|
||||
import kha.graphics4.CompareMode;
|
||||
import kha.graphics4.MipMapFilter;
|
||||
import kha.graphics4.PipelineState;
|
||||
import kha.graphics4.StencilAction;
|
||||
import kha.graphics4.TexDir;
|
||||
import kha.graphics4.TextureAddressing;
|
||||
import kha.graphics4.TextureFilter;
|
||||
import kha.graphics4.TextureFormat;
|
||||
import kha.graphics4.Usage;
|
||||
import kha.graphics4.VertexBuffer;
|
||||
import kha.graphics4.VertexShader;
|
||||
import kha.graphics4.VertexStructure;
|
||||
import kha.Image;
|
||||
import kha.math.FastMatrix3;
|
||||
import kha.math.FastMatrix4;
|
||||
import kha.math.FastVector2;
|
||||
import kha.math.FastVector3;
|
||||
import kha.math.FastVector4;
|
||||
import kha.math.Matrix4;
|
||||
import kha.math.Vector2;
|
||||
import kha.math.Vector3;
|
||||
import kha.math.Vector4;
|
||||
import kha.Video;
|
||||
|
||||
@:headerCode("
|
||||
#include <kinc/display.h>
|
||||
#include <kinc/graphics4/graphics.h>
|
||||
#include <kinc/graphics4/rendertarget.h>
|
||||
#include <kinc/window.h>
|
||||
")
|
||||
@:headerClassCode("kinc_g4_render_target_t *renderTarget = nullptr;")
|
||||
class Graphics implements kha.graphics4.Graphics {
|
||||
var target: Canvas;
|
||||
|
||||
public var window: Null<Int>;
|
||||
|
||||
public static var lastWindow: Int = -1;
|
||||
static var current: Graphics = null;
|
||||
|
||||
public function new(target: Canvas = null) {
|
||||
this.target = target;
|
||||
init();
|
||||
}
|
||||
|
||||
function init() {
|
||||
if (target == null)
|
||||
return;
|
||||
if (Std.isOfType(target, CubeMap)) {
|
||||
var cubeMap = cast(target, CubeMap);
|
||||
untyped __cpp__("renderTarget = &{0}->renderTarget", cubeMap);
|
||||
}
|
||||
else {
|
||||
var image = cast(target, Image);
|
||||
untyped __cpp__("renderTarget = &{0}->renderTarget", image);
|
||||
}
|
||||
}
|
||||
|
||||
@:functionCode("return kinc_window_vsynced(0);")
|
||||
public function vsynced(): Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
@:functionCode("return kinc_display_current_mode(kinc_primary_display()).frequency;")
|
||||
public function refreshRate(): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function clear(?color: Color, ?z: Float, ?stencil: Int): Void {
|
||||
var flags: Int = 0;
|
||||
if (color != null)
|
||||
flags |= 1;
|
||||
if (z != null)
|
||||
flags |= 2;
|
||||
if (stencil != null)
|
||||
flags |= 4;
|
||||
clear2(flags, color == null ? 0 : color.value, z, stencil);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_viewport(x, y, width, height);")
|
||||
public function viewport(x: Int, y: Int, width: Int, height: Int): Void {}
|
||||
|
||||
@:functionCode("kinc_g4_clear(flags, color, z, stencil);")
|
||||
function clear2(flags: Int, color: Int, z: Float, stencil: Int): Void {}
|
||||
|
||||
// public function createVertexBuffer(vertexCount: Int, structure: VertexStructure, usage: Usage, canRead: Bool = false): kha.graphics4.VertexBuffer {
|
||||
// return new VertexBuffer(vertexCount, structure);
|
||||
// }
|
||||
|
||||
@:functionCode("kinc_g4_set_vertex_buffer(&vertexBuffer->buffer);")
|
||||
public function setVertexBuffer(vertexBuffer: kha.graphics4.VertexBuffer): Void {}
|
||||
|
||||
@:functionCode("
|
||||
kinc_g4_vertex_buffer_t* vertexBuffers[4] = {
|
||||
vb0 == null() ? nullptr : &vb0->buffer,
|
||||
vb1 == null() ? nullptr : &vb1->buffer,
|
||||
vb2 == null() ? nullptr : &vb2->buffer,
|
||||
vb3 == null() ? nullptr : &vb3->buffer
|
||||
};
|
||||
kinc_g4_set_vertex_buffers(vertexBuffers, count);
|
||||
")
|
||||
function setVertexBuffersInternal(vb0: VertexBuffer, vb1: VertexBuffer, vb2: VertexBuffer, vb3: VertexBuffer, count: Int): Void {}
|
||||
|
||||
public function setVertexBuffers(vertexBuffers: Array<kha.graphics4.VertexBuffer>): Void {
|
||||
setVertexBuffersInternal(vertexBuffers.length > 0 ? vertexBuffers[0] : null, vertexBuffers.length > 1 ? vertexBuffers[1] : null,
|
||||
vertexBuffers.length > 2 ? vertexBuffers[2] : null, vertexBuffers.length > 3 ? vertexBuffers[3] : null, vertexBuffers.length);
|
||||
}
|
||||
|
||||
// public function createIndexBuffer(indexCount: Int, usage: Usage, canRead: Bool = false): kha.graphics.IndexBuffer {
|
||||
// return new IndexBuffer(indexCount);
|
||||
// }
|
||||
|
||||
@:functionCode("kinc_g4_set_index_buffer(&indexBuffer->buffer);")
|
||||
public function setIndexBuffer(indexBuffer: kha.graphics4.IndexBuffer): Void {}
|
||||
|
||||
// public function createTexture(width: Int, height: Int, format: TextureFormat, usage: Usage, canRead: Bool = false, levels: Int = 1): Texture {
|
||||
// return Image.create(width, height, format, canRead, false, false);
|
||||
// }
|
||||
// public function createRenderTargetTexture(width: Int, height: Int, format: TextureFormat, depthStencil: Bool, antiAliasingSamples: Int = 1): Texture {
|
||||
// return Image.create(width, height, format, false, true, depthStencil);
|
||||
// }
|
||||
|
||||
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;
|
||||
var koreUnit = cast(unit, kha.kore.graphics4.TextureUnit);
|
||||
untyped __cpp__("kinc_g4_render_target_use_color_as_texture(&cubeMap->renderTarget, {0}->unit)", koreUnit);
|
||||
}
|
||||
|
||||
public function setCubeMapDepth(unit: kha.graphics4.TextureUnit, cubeMap: kha.graphics4.CubeMap): Void {
|
||||
if (cubeMap == null)
|
||||
return;
|
||||
var koreUnit = cast(unit, kha.kore.graphics4.TextureUnit);
|
||||
untyped __cpp__("kinc_g4_render_target_use_depth_as_texture(&cubeMap->renderTarget, {0}->unit);", koreUnit);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_scissor(x, y, width, height);")
|
||||
public function scissor(x: Int, y: Int, width: Int, height: Int): Void {}
|
||||
|
||||
@:functionCode("kinc_g4_disable_scissor();")
|
||||
public function disableScissor(): Void {}
|
||||
|
||||
public function instancedRenderingAvailable(): Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
@:functionCode("
|
||||
kinc_g4_set_texture_addressing(unit->unit, KINC_G4_TEXTURE_DIRECTION_U, (kinc_g4_texture_addressing_t)uWrap);
|
||||
kinc_g4_set_texture_addressing(unit->unit, KINC_G4_TEXTURE_DIRECTION_V, (kinc_g4_texture_addressing_t)vWrap);
|
||||
")
|
||||
function setTextureWrapNative(unit: TextureUnit, uWrap: Int, vWrap: Int): Void {}
|
||||
|
||||
@:functionCode("
|
||||
kinc_g4_set_texture3d_addressing(unit->unit, KINC_G4_TEXTURE_DIRECTION_U, (kinc_g4_texture_addressing_t)uWrap);
|
||||
kinc_g4_set_texture3d_addressing(unit->unit, KINC_G4_TEXTURE_DIRECTION_V, (kinc_g4_texture_addressing_t)vWrap);
|
||||
kinc_g4_set_texture3d_addressing(unit->unit, KINC_G4_TEXTURE_DIRECTION_W, (kinc_g4_texture_addressing_t)wWrap);
|
||||
")
|
||||
function setTexture3DWrapNative(unit: TextureUnit, uWrap: Int, vWrap: Int, wWrap: Int): Void {}
|
||||
|
||||
@:functionCode("
|
||||
kinc_g4_set_texture_minification_filter(unit->unit, (kinc_g4_texture_filter_t)minificationFilter);
|
||||
kinc_g4_set_texture_magnification_filter(unit->unit, (kinc_g4_texture_filter_t)magnificationFilter);
|
||||
kinc_g4_set_texture_mipmap_filter(unit->unit, (kinc_g4_mipmap_filter_t)mipMapFilter);
|
||||
")
|
||||
function setTextureFiltersNative(unit: TextureUnit, minificationFilter: Int, magnificationFilter: Int, mipMapFilter: Int): Void {}
|
||||
|
||||
@:functionCode("
|
||||
kinc_g4_set_texture3d_minification_filter(unit->unit, (kinc_g4_texture_filter_t)minificationFilter);
|
||||
kinc_g4_set_texture3d_magnification_filter(unit->unit, (kinc_g4_texture_filter_t)magnificationFilter);
|
||||
kinc_g4_set_texture3d_mipmap_filter(unit->unit, (kinc_g4_mipmap_filter_t)mipMapFilter);
|
||||
")
|
||||
function setTexture3DFiltersNative(unit: TextureUnit, minificationFilter: Int, magnificationFilter: Int, mipMapFilter: Int): Void {}
|
||||
|
||||
public function setTextureParameters(texunit: kha.graphics4.TextureUnit, uAddressing: TextureAddressing, vAddressing: TextureAddressing,
|
||||
minificationFilter: TextureFilter, magnificationFilter: TextureFilter, mipmapFilter: MipMapFilter): Void {
|
||||
setTextureWrapNative(cast texunit, uAddressing, vAddressing);
|
||||
setTextureFiltersNative(cast texunit, minificationFilter, magnificationFilter, mipmapFilter);
|
||||
}
|
||||
|
||||
public function setTexture3DParameters(texunit: kha.graphics4.TextureUnit, uAddressing: TextureAddressing, vAddressing: TextureAddressing,
|
||||
wAddressing: TextureAddressing, minificationFilter: TextureFilter, magnificationFilter: TextureFilter, mipmapFilter: MipMapFilter): Void {
|
||||
setTexture3DWrapNative(cast texunit, uAddressing, vAddressing, wAddressing);
|
||||
setTexture3DFiltersNative(cast texunit, minificationFilter, magnificationFilter, mipmapFilter);
|
||||
}
|
||||
|
||||
public function setTextureCompareMode(texunit: kha.graphics4.TextureUnit, enabled: Bool) {
|
||||
var koreUnit = cast(texunit, kha.kore.graphics4.TextureUnit);
|
||||
untyped __cpp__("kinc_g4_set_texture_compare_mode({0}->unit, enabled);", koreUnit);
|
||||
}
|
||||
|
||||
public function setCubeMapCompareMode(texunit: kha.graphics4.TextureUnit, enabled: Bool) {
|
||||
var koreUnit = cast(texunit, kha.kore.graphics4.TextureUnit);
|
||||
untyped __cpp__("kinc_g4_set_cubemap_compare_mode({0}->unit, enabled);", koreUnit);
|
||||
}
|
||||
|
||||
@:functionCode("
|
||||
if (texture->imageType == KhaImageTypeTexture) kinc_g4_set_texture(unit->unit, &texture->texture);
|
||||
else if (texture->imageType == KhaImageTypeRenderTarget) kinc_g4_render_target_use_color_as_texture(&texture->renderTarget, unit->unit);
|
||||
")
|
||||
function setTextureInternal(unit: kha.kore.graphics4.TextureUnit, texture: kha.Image): Void {}
|
||||
|
||||
public function setTexture(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
setTextureInternal(cast unit, texture);
|
||||
}
|
||||
|
||||
public function setTextureDepth(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
var koreUnit = cast(unit, kha.kore.graphics4.TextureUnit);
|
||||
untyped __cpp__("kinc_g4_render_target_use_depth_as_texture(&texture->renderTarget, {0}->unit);", koreUnit);
|
||||
}
|
||||
|
||||
public function setTextureArray(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
var koreUnit = cast(unit, kha.kore.graphics4.TextureUnit);
|
||||
untyped __cpp__("if (texture->imageType == KhaImageTypeTextureArray) kinc_g4_set_texture_array({0}->unit, &texture->textureArray);", koreUnit);
|
||||
}
|
||||
|
||||
public function setVideoTexture(unit: kha.graphics4.TextureUnit, texture: kha.Video): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
setTextureInternal(cast unit, Image.fromVideo(texture));
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_image_texture(unit->unit, &texture->texture);")
|
||||
function setImageTextureInternal(unit: kha.kore.graphics4.TextureUnit, texture: kha.Image): Void {}
|
||||
|
||||
public function setImageTexture(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
setImageTextureInternal(cast unit, texture);
|
||||
}
|
||||
|
||||
@:functionCode("return kinc_g4_max_bound_textures();")
|
||||
public function maxBoundTextures(): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// public function createVertexShader(source: Blob): VertexShader {
|
||||
// return new Shader(source, ShaderType.VertexShader);
|
||||
// }
|
||||
// public function createFragmentShader(source: Blob): FragmentShader {
|
||||
// return new Shader(source, ShaderType.FragmentShader);
|
||||
// }
|
||||
// public function createProgram(): kha.graphics4.Program {
|
||||
// return new Program();
|
||||
// }
|
||||
|
||||
public function setPipeline(pipe: PipelineState): Void {
|
||||
pipe.set();
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_stencil_reference_value(value);")
|
||||
public function setStencilReferenceValue(value: Int): Void {}
|
||||
|
||||
public function setBool(location: kha.graphics4.ConstantLocation, value: Bool): Void {
|
||||
setBoolPrivate(cast location, value);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_bool(location->location, value);")
|
||||
function setBoolPrivate(location: kha.kore.graphics4.ConstantLocation, value: Bool): Void {}
|
||||
|
||||
public function setInt(location: kha.graphics4.ConstantLocation, value: Int): Void {
|
||||
setIntPrivate(cast location, value);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_int(location->location, value);")
|
||||
function setIntPrivate(location: ConstantLocation, value: Int): Void {}
|
||||
|
||||
public function setInt2(location: kha.graphics4.ConstantLocation, value1: Int, value2: Int): Void {
|
||||
setInt2Private(cast location, value1, value2);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_int2(location->location, value1, value2);")
|
||||
function setInt2Private(location: ConstantLocation, value1: Int, value2: Int): Void {}
|
||||
|
||||
public function setInt3(location: kha.graphics4.ConstantLocation, value1: Int, value2: Int, value3: Int): Void {
|
||||
setInt3Private(cast location, value1, value2, value3);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_int3(location->location, value1, value2, value3);")
|
||||
function setInt3Private(location: ConstantLocation, value1: Int, value2: Int, value3: Int): Void {}
|
||||
|
||||
public function setInt4(location: kha.graphics4.ConstantLocation, value1: Int, value2: Int, value3: Int, value4: Int): Void {
|
||||
setInt4Private(cast location, value1, value2, value3, value4);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_int4(location->location, value1, value2, value3, value4);")
|
||||
function setInt4Private(location: ConstantLocation, value1: Int, value2: Int, value3: Int, value4: Int): Void {}
|
||||
|
||||
public function setInts(location: kha.graphics4.ConstantLocation, values: kha.arrays.Int32Array): Void {
|
||||
setIntsPrivate(cast location, values);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_ints(location->location, (int*)values->self.data, values->byteArrayLength / 4);")
|
||||
function setIntsPrivate(location: ConstantLocation, values: kha.arrays.Int32Array): Void {}
|
||||
|
||||
public function setFloat(location: kha.graphics4.ConstantLocation, value: FastFloat): Void {
|
||||
setFloatPrivate(cast location, value);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_float(location->location, value);")
|
||||
function setFloatPrivate(location: ConstantLocation, value: FastFloat): Void {}
|
||||
|
||||
public function setFloat2(location: kha.graphics4.ConstantLocation, value1: FastFloat, value2: FastFloat): Void {
|
||||
setFloat2Private(cast location, value1, value2);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_float2(location->location, value1, value2);")
|
||||
function setFloat2Private(location: ConstantLocation, value1: FastFloat, value2: FastFloat): Void {}
|
||||
|
||||
public function setFloat3(location: kha.graphics4.ConstantLocation, value1: FastFloat, value2: FastFloat, value3: FastFloat): Void {
|
||||
setFloat3Private(cast location, value1, value2, value3);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_float3(location->location, value1, value2, value3);")
|
||||
function setFloat3Private(location: ConstantLocation, value1: FastFloat, value2: FastFloat, value3: FastFloat): Void {}
|
||||
|
||||
public function setFloat4(location: kha.graphics4.ConstantLocation, value1: FastFloat, value2: FastFloat, value3: FastFloat, value4: FastFloat): Void {
|
||||
setFloat4Private(cast location, value1, value2, value3, value4);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_float4(location->location, value1, value2, value3, value4);")
|
||||
function setFloat4Private(location: ConstantLocation, value1: FastFloat, value2: FastFloat, value3: FastFloat, value4: FastFloat): Void {}
|
||||
|
||||
public function setVector2(location: kha.graphics4.ConstantLocation, value: FastVector2): Void {
|
||||
setVector2Private(cast location, value.x, value.y);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_float2(location->location, x, y);")
|
||||
function setVector2Private(location: ConstantLocation, x: FastFloat, y: FastFloat): Void {}
|
||||
|
||||
public function setVector3(location: kha.graphics4.ConstantLocation, value: FastVector3): Void {
|
||||
setVector3Private(cast location, value.x, value.y, value.z);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_float3(location->location, x, y, z);")
|
||||
function setVector3Private(location: ConstantLocation, x: FastFloat, y: FastFloat, z: FastFloat): Void {}
|
||||
|
||||
public function setVector4(location: kha.graphics4.ConstantLocation, value: FastVector4): Void {
|
||||
setVector4Private(cast location, value.x, value.y, value.z, value.w);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_float4(location->location, x, y, z, w);")
|
||||
function setVector4Private(location: ConstantLocation, x: FastFloat, y: FastFloat, z: FastFloat, w: FastFloat): Void {}
|
||||
|
||||
public function setFloats(location: kha.graphics4.ConstantLocation, values: Float32Array): Void {
|
||||
setFloatsPrivate(cast location, values);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_set_floats(location->location, (float*)values->self.data, values->byteArrayLength / 4);")
|
||||
function setFloatsPrivate(location: ConstantLocation, values: Float32Array): Void {}
|
||||
|
||||
public function setMatrix(location: kha.graphics4.ConstantLocation, matrix: FastMatrix4): Void {
|
||||
setMatrixPrivate(cast location, matrix);
|
||||
}
|
||||
|
||||
@:functionCode("
|
||||
kinc_matrix4x4_t value;
|
||||
kinc_matrix4x4_set(&value, 0, 0, matrix->_00); kinc_matrix4x4_set(&value, 1, 0, matrix->_10); kinc_matrix4x4_set(&value, 2, 0, matrix->_20); kinc_matrix4x4_set(&value, 3, 0, matrix->_30);
|
||||
kinc_matrix4x4_set(&value, 0, 1, matrix->_01); kinc_matrix4x4_set(&value, 1, 1, matrix->_11); kinc_matrix4x4_set(&value, 2, 1, matrix->_21); kinc_matrix4x4_set(&value, 3, 1, matrix->_31);
|
||||
kinc_matrix4x4_set(&value, 0, 2, matrix->_02); kinc_matrix4x4_set(&value, 1, 2, matrix->_12); kinc_matrix4x4_set(&value, 2, 2, matrix->_22); kinc_matrix4x4_set(&value, 3, 2, matrix->_32);
|
||||
kinc_matrix4x4_set(&value, 0, 3, matrix->_03); kinc_matrix4x4_set(&value, 1, 3, matrix->_13); kinc_matrix4x4_set(&value, 2, 3, matrix->_23); kinc_matrix4x4_set(&value, 3, 3, matrix->_33);
|
||||
kinc_g4_set_matrix4(location->location, &value);
|
||||
")
|
||||
function setMatrixPrivate(location: ConstantLocation, matrix: FastMatrix4): Void {}
|
||||
|
||||
public function setMatrix3(location: kha.graphics4.ConstantLocation, matrix: FastMatrix3): Void {
|
||||
setMatrix3Private(cast location, matrix);
|
||||
}
|
||||
|
||||
@:functionCode("
|
||||
kinc_matrix3x3_t value;
|
||||
kinc_matrix3x3_set(&value, 0, 0, matrix->_00); kinc_matrix3x3_set(&value, 1, 0, matrix->_10); kinc_matrix3x3_set(&value, 2, 0, matrix->_20);
|
||||
kinc_matrix3x3_set(&value, 0, 1, matrix->_01); kinc_matrix3x3_set(&value, 1, 1, matrix->_11); kinc_matrix3x3_set(&value, 2, 1, matrix->_21);
|
||||
kinc_matrix3x3_set(&value, 0, 2, matrix->_02); kinc_matrix3x3_set(&value, 1, 2, matrix->_12); kinc_matrix3x3_set(&value, 2, 2, matrix->_22);
|
||||
kinc_g4_set_matrix3(location->location, &value);
|
||||
")
|
||||
function setMatrix3Private(location: ConstantLocation, matrix: FastMatrix3): Void {}
|
||||
|
||||
public function drawIndexedVertices(start: Int = 0, count: Int = -1): Void {
|
||||
if (count < 0)
|
||||
drawAllIndexedVertices();
|
||||
else
|
||||
drawSomeIndexedVertices(start, count);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_draw_indexed_vertices();")
|
||||
function drawAllIndexedVertices(): Void {}
|
||||
|
||||
@:functionCode("kinc_g4_draw_indexed_vertices_from_to(start, count);")
|
||||
public function drawSomeIndexedVertices(start: Int, count: Int): Void {}
|
||||
|
||||
public function drawIndexedVerticesInstanced(instanceCount: Int, start: Int = 0, count: Int = -1): Void {
|
||||
if (count < 0)
|
||||
drawAllIndexedVerticesInstanced(instanceCount);
|
||||
else
|
||||
drawSomeIndexedVerticesInstanced(instanceCount, start, count);
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_draw_indexed_vertices_instanced(instanceCount);")
|
||||
function drawAllIndexedVerticesInstanced(instanceCount: Int): Void {}
|
||||
|
||||
@:functionCode("kinc_g4_draw_indexed_vertices_instanced_from_to(instanceCount, start, count);")
|
||||
function drawSomeIndexedVerticesInstanced(instanceCount: Int, start: Int, count: Int): Void {}
|
||||
|
||||
function renderToTexture(additionalRenderTargets: Array<Canvas>): Void {
|
||||
if (additionalRenderTargets != null) {
|
||||
var len = additionalRenderTargets.length;
|
||||
|
||||
var image1 = cast(additionalRenderTargets[0], Image);
|
||||
var image2 = cast(additionalRenderTargets[1], Image);
|
||||
var image3 = cast(additionalRenderTargets[2], Image);
|
||||
var image4 = cast(additionalRenderTargets[3], Image);
|
||||
var image5 = cast(additionalRenderTargets[4], Image);
|
||||
var image6 = cast(additionalRenderTargets[5], Image);
|
||||
var image7 = cast(additionalRenderTargets[6], Image);
|
||||
|
||||
untyped __cpp__("
|
||||
kinc_g4_render_target_t *renderTargets[8] = { renderTarget, {1} == null() ? nullptr : &{1}->renderTarget, {2} == null() ? nullptr : &{2}->renderTarget, image3 == null() ? nullptr : &{3}->renderTarget, {4} == null() ? nullptr : &{4}->renderTarget, {5} == null() ? nullptr : &{5}->renderTarget, {6} == null() ? nullptr : &{6}->renderTarget, {7} == null() ? nullptr : &{7}->renderTarget };
|
||||
kinc_g4_set_render_targets(renderTargets, {0} + 1);
|
||||
", len, image1, image2, image3, image4, image5, image6, image7);
|
||||
}
|
||||
else {
|
||||
untyped __cpp__("
|
||||
kinc_g4_render_target_t *renderTargets[1] = { renderTarget };
|
||||
kinc_g4_set_render_targets(renderTargets, 1)
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_restore_render_target();")
|
||||
function renderToBackbuffer(): Void {}
|
||||
|
||||
public function begin(additionalRenderTargets: Array<Canvas> = null): Void {
|
||||
if (current == null) {
|
||||
current = this;
|
||||
}
|
||||
else {
|
||||
throw "End before you begin";
|
||||
}
|
||||
|
||||
var win: Int = window == null ? 0 : window;
|
||||
if (win != lastWindow) {
|
||||
if (lastWindow != -1) {
|
||||
untyped __cpp__("kinc_g4_end(lastWindow);");
|
||||
}
|
||||
untyped __cpp__("kinc_g4_begin(win);");
|
||||
lastWindow = win;
|
||||
}
|
||||
if (target == null) {
|
||||
renderToBackbuffer();
|
||||
}
|
||||
else
|
||||
renderToTexture(additionalRenderTargets);
|
||||
}
|
||||
|
||||
public function beginFace(face: Int): Void {
|
||||
if (current == null) {
|
||||
current = this;
|
||||
}
|
||||
else {
|
||||
throw "End before you begin";
|
||||
}
|
||||
|
||||
untyped __cpp__("kinc_g4_set_render_target_face(renderTarget, face)");
|
||||
}
|
||||
|
||||
public function beginEye(eye: Int): Void {}
|
||||
|
||||
public function end(): Void {
|
||||
if (current == this) {
|
||||
current = null;
|
||||
}
|
||||
else {
|
||||
throw "Begin before you end";
|
||||
}
|
||||
}
|
||||
|
||||
@:functionCode("kinc_g4_flush();")
|
||||
public function flush(): Void {}
|
||||
}
|
11
Kha/Backends/Kinc-hxcpp/kha/kore/graphics4/Graphics2.hx
Normal file
11
Kha/Backends/Kinc-hxcpp/kha/kore/graphics4/Graphics2.hx
Normal file
@ -0,0 +1,11 @@
|
||||
package kha.kore.graphics4;
|
||||
|
||||
class Graphics2 extends kha.graphics4.Graphics2 {
|
||||
override public function drawVideoInternal(video: kha.Video, x: Float, y: Float, width: Float, height: Float): Void {
|
||||
// color = Color.Blue;
|
||||
// fillRect(x, y, width, height);
|
||||
|
||||
color = Color.White;
|
||||
drawScaledSubImage(Image.fromVideo(video), 0, 0, video.width(), video.height() * 0.66, x, y, width, height);
|
||||
}
|
||||
}
|
6
Kha/Backends/Kinc-hxcpp/kha/kore/graphics4/ShaderType.hx
Normal file
6
Kha/Backends/Kinc-hxcpp/kha/kore/graphics4/ShaderType.hx
Normal file
@ -0,0 +1,6 @@
|
||||
package kha.kore.graphics4;
|
||||
|
||||
enum abstract ShaderType(Int) {
|
||||
var FragmentShader;
|
||||
var VertexShader;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package kha.kore.graphics4;
|
||||
|
||||
@:headerCode("
|
||||
#include <kinc/graphics4/textureunit.h>
|
||||
")
|
||||
@:headerClassCode("kinc_g4_texture_unit_t unit;")
|
||||
class TextureUnit implements kha.graphics4.TextureUnit {
|
||||
public function new() {}
|
||||
}
|
55
Kha/Backends/Kinc-hxcpp/kha/kore/graphics5_/Graphics.hx
Normal file
55
Kha/Backends/Kinc-hxcpp/kha/kore/graphics5_/Graphics.hx
Normal file
@ -0,0 +1,55 @@
|
||||
package kha.kore.graphics5;
|
||||
|
||||
import kha.graphics5.RenderTarget;
|
||||
import kha.graphics5.CommandList;
|
||||
#if kha_dxr
|
||||
import kha.graphics5.AccelerationStructure;
|
||||
import kha.graphics5.RayTraceTarget;
|
||||
import kha.graphics5.RayTracePipeline;
|
||||
#end
|
||||
|
||||
@:headerCode('
|
||||
#include <Kore/Graphics5/Graphics.h>
|
||||
#include <Kore/Graphics5/RayTrace.h>
|
||||
')
|
||||
class Graphics implements kha.graphics5.Graphics {
|
||||
private var target: Canvas;
|
||||
|
||||
public function new(target: Canvas = null) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public function begin(target: RenderTarget): Void {
|
||||
untyped __cpp__("Kore::Graphics5::begin(target->renderTarget);");
|
||||
}
|
||||
|
||||
public function end(): Void {
|
||||
untyped __cpp__("Kore::Graphics5::end();");
|
||||
}
|
||||
|
||||
public function swapBuffers(): Void {
|
||||
untyped __cpp__("Kore::Graphics5::swapBuffers();");
|
||||
}
|
||||
|
||||
#if kha_dxr
|
||||
public function setAccelerationStructure(accel: AccelerationStructure): Void {
|
||||
untyped __cpp__("Kore::Graphics5::setAccelerationStructure(accel->accel);");
|
||||
}
|
||||
|
||||
public function setRayTracePipeline(pipe: RayTracePipeline): Void {
|
||||
untyped __cpp__("Kore::Graphics5::setRayTracePipeline(pipe->pipeline);");
|
||||
}
|
||||
|
||||
public function setRayTraceTarget(target: RayTraceTarget): Void {
|
||||
untyped __cpp__("Kore::Graphics5::setRayTraceTarget(target->target);");
|
||||
}
|
||||
|
||||
public function dispatchRays(commandList: CommandList): Void {
|
||||
untyped __cpp__("Kore::Graphics5::dispatchRays(commandList->commandList);");
|
||||
}
|
||||
|
||||
public function copyRayTraceTarget(commandList: CommandList, renderTarget: RenderTarget, output: RayTraceTarget): Void {
|
||||
untyped __cpp__("Kore::Graphics5::copyRayTraceTarget(commandList->commandList, renderTarget->renderTarget, output->target);");
|
||||
}
|
||||
#end
|
||||
}
|
186
Kha/Backends/Kinc-hxcpp/kha/kore/vr/CardboardVrInterface.hx
Normal file
186
Kha/Backends/Kinc-hxcpp/kha/kore/vr/CardboardVrInterface.hx
Normal file
@ -0,0 +1,186 @@
|
||||
package kha.kore.vr;
|
||||
|
||||
import kha.graphics4.FragmentShader;
|
||||
import kha.graphics4.Graphics;
|
||||
import kha.graphics4.ConstantLocation;
|
||||
import kha.graphics4.TextureUnit;
|
||||
import kha.Framebuffer;
|
||||
import kha.graphics4.IndexBuffer;
|
||||
import kha.graphics4.Program;
|
||||
import kha.graphics4.Usage;
|
||||
import kha.graphics4.VertexBuffer;
|
||||
import kha.graphics4.VertexData;
|
||||
import kha.graphics4.VertexShader;
|
||||
import kha.graphics4.VertexStructure;
|
||||
import kha.graphics4.TextureFormat;
|
||||
import kha.graphics4.CullMode;
|
||||
import kha.graphics4.BlendingOperation;
|
||||
import kha.Image;
|
||||
import kha.math.Matrix4;
|
||||
import kha.math.Quaternion;
|
||||
import kha.math.Vector2;
|
||||
import kha.math.Vector3;
|
||||
import kha.math.Vector4;
|
||||
import kha.vr.Pose;
|
||||
import kha.vr.PoseState;
|
||||
import kha.vr.SensorState;
|
||||
import kha.vr.TimeWarpParms;
|
||||
import kha.Loader;
|
||||
|
||||
#if ANDROID
|
||||
@:headerCode('
|
||||
#include <Kore/Vr/VrInterface.h>
|
||||
')
|
||||
#end
|
||||
#if VR_CARDBOARD
|
||||
class CardboardVrInterfaceTest extends kha.vr.VrInterface {
|
||||
// We draw directly to the screen
|
||||
public var framebuffer: Framebuffer;
|
||||
|
||||
private var image: Image;
|
||||
|
||||
@:functionCode('
|
||||
return Kore::VrInterface::getGaze();
|
||||
')
|
||||
private function GetGaze(): Quaternion {
|
||||
return null;
|
||||
}
|
||||
|
||||
public override function GetSensorState(): SensorState {
|
||||
// Return from cardboard api
|
||||
|
||||
var s: SensorState = new SensorState();
|
||||
s.Predicted = s.Recorded = new PoseState();
|
||||
s.Predicted.Pose = new Pose();
|
||||
s.Predicted.Pose.Orientation = GetGaze();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public override function GetPredictedSensorState(time: Float): SensorState {
|
||||
// Return using cardboard api
|
||||
return GetSensorState();
|
||||
}
|
||||
|
||||
public override function WarpSwapBlack(): Void {
|
||||
// Oculus-specific
|
||||
}
|
||||
|
||||
public override function WarpSwapLoadingIcon(): Void {
|
||||
// Oculus-specific
|
||||
}
|
||||
|
||||
public override function WarpSwap(parms: TimeWarpParms): Void {
|
||||
// Draw the two images, side-by-side
|
||||
// parms.LeftImage.Image = Loader.the.getImage("use.png");
|
||||
|
||||
if (image == null) {
|
||||
image = Image.createRenderTarget(Sys.pixelWidth, Sys.pixelHeight, TextureFormat.RGBA32);
|
||||
}
|
||||
|
||||
var g: Graphics = image.g4;
|
||||
g.begin();
|
||||
|
||||
g.clear(Color.Orange);
|
||||
|
||||
g.setCullMode(CullMode.None);
|
||||
// g.setBlendingMode(BlendingOperation.BlendOne, BlendingOperation.BlendZero);
|
||||
|
||||
g.setProgram(program);
|
||||
g.setVertexBuffer(vb);
|
||||
g.setIndexBuffer(ib);
|
||||
|
||||
var texture: TextureUnit = program.getTextureUnit("tex");
|
||||
var matrixLocation: ConstantLocation = program.getConstantLocation("projectionMatrix");
|
||||
|
||||
var t: Matrix4 = Matrix4.translation(-0.5, 0, 0);
|
||||
var s: Matrix4 = Matrix4.scale(0.5, 1, 1);
|
||||
var m: Matrix4 = s.multmat(t);
|
||||
g.setMatrix(matrixLocation, m);
|
||||
|
||||
g.setTexture(texture, parms.LeftImage.Image);
|
||||
g.drawIndexedVertices();
|
||||
|
||||
t = Matrix4.translation(0.5, 0, 0);
|
||||
m = s.multmat(t);
|
||||
|
||||
g.setMatrix(matrixLocation, m);
|
||||
|
||||
g.setTexture(texture, parms.RightImage.Image);
|
||||
g.drawIndexedVertices();
|
||||
|
||||
g.end();
|
||||
|
||||
framebuffer.g4.begin();
|
||||
SendTextureToDistortion(image);
|
||||
|
||||
framebuffer.g4.end();
|
||||
}
|
||||
|
||||
@:functionCode('Kore::VrInterface::DistortTexture(image.mPtr);')
|
||||
private function SendTextureToDistortion(image: Image) {
|
||||
// TODO: Add a function to CPP VrInterface
|
||||
// TODO: Check how large the texture should be
|
||||
}
|
||||
|
||||
public override function GetTimeInSeconds(): Float {
|
||||
return Sys.getTime();
|
||||
}
|
||||
|
||||
var vb: VertexBuffer;
|
||||
var ib: IndexBuffer;
|
||||
|
||||
var program: Program;
|
||||
|
||||
private function setVertex(a: Array<Float>, index: Int, pos: Vector3, uv: Vector2, color: Vector4) {
|
||||
var base: Int = index * 9;
|
||||
a[base + 0] = pos.x;
|
||||
a[base + 1] = pos.y;
|
||||
a[base + 2] = pos.z;
|
||||
base += 3;
|
||||
a[base + 0] = uv.x;
|
||||
a[base + 1] = uv.y;
|
||||
base += 2;
|
||||
for (i in 0...4) {
|
||||
a[base + i] = color.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
|
||||
var structure: VertexStructure = new VertexStructure();
|
||||
structure.add("vertexPosition", VertexData.Float3);
|
||||
structure.add("vertexUV", VertexData.Float2);
|
||||
structure.add("vertexColor", VertexData.Float4);
|
||||
|
||||
vb = new VertexBuffer(4, structure, Usage.StaticUsage);
|
||||
var verts: Array<Float> = vb.lock();
|
||||
|
||||
setVertex(verts, 0, new Vector3(-1, -1, 0), new Vector2(0, 0), new Vector4(1, 1, 1, 1));
|
||||
setVertex(verts, 1, new Vector3(-1, 1, 0), new Vector2(0, 1), new Vector4(1, 1, 1, 1));
|
||||
setVertex(verts, 2, new Vector3(1, -1, 0), new Vector2(1, 0), new Vector4(1, 1, 1, 1));
|
||||
setVertex(verts, 3, new Vector3(1, 1, 0), new Vector2(1, 1), new Vector4(1, 1, 1, 1));
|
||||
|
||||
vb.unlock();
|
||||
|
||||
ib = new IndexBuffer(6, Usage.StaticUsage);
|
||||
var indices: Array<Int> = ib.lock();
|
||||
|
||||
indices[0] = 0;
|
||||
indices[1] = 1;
|
||||
indices[2] = 2;
|
||||
indices[3] = 1;
|
||||
indices[4] = 3;
|
||||
indices[5] = 2;
|
||||
|
||||
ib.unlock();
|
||||
|
||||
program = new Program();
|
||||
|
||||
program.setVertexShader(new VertexShader(Loader.the.getShader("painter-image.vert")));
|
||||
program.setFragmentShader(new FragmentShader(Loader.the.getShader("painter-image.frag")));
|
||||
program.link(structure);
|
||||
}
|
||||
}
|
||||
#end
|
75
Kha/Backends/Kinc-hxcpp/kha/kore/vr/VrInterface.hx
Normal file
75
Kha/Backends/Kinc-hxcpp/kha/kore/vr/VrInterface.hx
Normal file
@ -0,0 +1,75 @@
|
||||
package kha.kore.vr;
|
||||
|
||||
import kha.vr.SensorState;
|
||||
import kha.vr.TimeWarpParms;
|
||||
|
||||
#if ANDROID
|
||||
@:headerCode('
|
||||
#include <Kore/Vr/VrInterface.h>
|
||||
')
|
||||
#end
|
||||
class VrInterface extends kha.vr.VrInterface {
|
||||
#if ANDROID
|
||||
// Returns the current sensor state
|
||||
// Returns the predicted sensor state at the specified time
|
||||
@:functionCode('return Kore::VrInterface::GetSensorState();')
|
||||
public override function GetSensorState(): SensorState {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Returns the predicted sensor state at the specified time
|
||||
|
||||
@:functionCode('return Kore::VrInterface::GetPredictedSensorState(time);')
|
||||
public override function GetPredictedSensorState(time: Float): SensorState {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Sends a black image to the warp swap thread
|
||||
|
||||
@:functionCode('Kore::VrInterface::WarpSwapBlack();')
|
||||
public override function WarpSwapBlack(): Void {}
|
||||
|
||||
// Sends the Oculus loading symbol to the warp swap thread
|
||||
|
||||
@:functionCode('Kore::VrInterface::WarpSwapLoadingIcon();')
|
||||
public override function WarpSwapLoadingIcon(): Void {}
|
||||
|
||||
// Sends the set of images to the warp swap thread
|
||||
|
||||
@:functionCode('Kore::VrInterface::WarpSwap(parms.mPtr);')
|
||||
public override function WarpSwap(parms: TimeWarpParms): Void {}
|
||||
|
||||
@:functionCode('return Kore::VrInterface::GetTimeInSeconds();')
|
||||
public override function GetTimeInSeconds(): Float {
|
||||
return 0.0;
|
||||
}
|
||||
#else
|
||||
// Returns the current sensor state
|
||||
// Returns the predicted sensor state at the specified time
|
||||
public override function GetSensorState(): SensorState {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Returns the predicted sensor state at the specified time
|
||||
public override function GetPredictedSensorState(time: Float): SensorState {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Sends a black image to the warp swap thread
|
||||
public override function WarpSwapBlack(): Void {}
|
||||
|
||||
// Sends the Oculus loading symbol to the warp swap thread
|
||||
public override function WarpSwapLoadingIcon(): Void {}
|
||||
|
||||
// Sends the set of images to the warp swap thread
|
||||
public override function WarpSwap(parms: TimeWarpParms): Void {}
|
||||
|
||||
public override function GetTimeInSeconds(): Float {
|
||||
return 0.0;
|
||||
}
|
||||
#end
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
}
|
||||
}
|
62
Kha/Backends/Kinc-hxcpp/kha/kore/vr/VrInterfaceRift.hx
Normal file
62
Kha/Backends/Kinc-hxcpp/kha/kore/vr/VrInterfaceRift.hx
Normal file
@ -0,0 +1,62 @@
|
||||
package kha.kore.vr;
|
||||
|
||||
import kha.math.Quaternion;
|
||||
import kha.math.Vector3;
|
||||
import kha.vr.Pose;
|
||||
import kha.vr.PoseState;
|
||||
import kha.vr.SensorState;
|
||||
import kha.vr.TimeWarpParms;
|
||||
|
||||
@:headerCode('
|
||||
#include <Kore/Vr/VrInterface.h>
|
||||
')
|
||||
/**
|
||||
* ...
|
||||
* @author Florian Mehm
|
||||
*/
|
||||
class VrInterfaceRift extends VrInterface {
|
||||
// Returns the current sensor state
|
||||
#if VR_RIFT
|
||||
@:functionCode('
|
||||
return Kore::VrInterface::GetSensorState();
|
||||
')
|
||||
#end
|
||||
public override function GetSensorState(): SensorState {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Returns the predicted sensor state at the specified time
|
||||
public override function GetPredictedSensorState(time: Float): SensorState {
|
||||
return GetSensorState();
|
||||
}
|
||||
|
||||
// Sends a black image to the warp swap thread
|
||||
public override function WarpSwapBlack(): Void {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sends the Oculus loading symbol to the warp swap thread
|
||||
public override function WarpSwapLoadingIcon(): Void {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sends the set of images to the warp swap thread
|
||||
#if VR_RIFT
|
||||
@:functionCode('
|
||||
Kore::VrInterface::WarpSwap(parms.mPtr);
|
||||
')
|
||||
#end
|
||||
public override function WarpSwap(parms: TimeWarpParms): Void {
|
||||
return;
|
||||
}
|
||||
|
||||
// This returns the time that the TimeWarp thread uses
|
||||
// Since it is created from the library's vsync counting code, we should use this
|
||||
public override function GetTimeInSeconds(): Float {
|
||||
return System.time;
|
||||
}
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user