Code cleanup

This commit is contained in:
unknown 2019-04-06 16:05:01 +02:00
parent ad88b97d63
commit 445a4fdc61
22 changed files with 1 additions and 678 deletions

View file

@ -1,11 +0,0 @@
#version 450
uniform sampler2D tex;
uniform sampler2D tex2;
in vec2 texCoord;
out vec4 fragColor;
void main() {
fragColor.rgb = textureLod(tex, texCoord, 0.0).rgb + textureLod(tex2, texCoord, 0.0).rgb;
}

View file

@ -1,14 +0,0 @@
{
"contexts": [
{
"name": "combine_pass",
"depth_write": false,
"compare_mode": "always",
"cull_mode": "none",
"links": [],
"texture_params": [],
"vertex_shader": "../include/pass.vert.glsl",
"fragment_shader": "combine_pass.frag.glsl"
}
]
}

View file

@ -1,15 +0,0 @@
#version 450
#include "compiled.inc"
#include "std/gbuffer.glsl"
uniform sampler2D tex;
in vec2 texCoord;
out vec4 fragColor;
void main() {
vec4 col = textureLod(tex, texCoord, 0.0);
vec3 n = getNor(col.rg);
fragColor.rgb = n * 0.5 + 0.5;
}

View file

@ -1,27 +0,0 @@
{
"contexts": [
{
"name": "debug_normals",
"depth_write": false,
"compare_mode": "always",
"cull_mode": "none",
"links": [
{
"name": "eye",
"link": "_cameraPosition"
},
{
"name": "eyeLook",
"link": "_cameraLook"
},
{
"name": "invVP",
"link": "_inverseViewProjectionMatrix"
}
],
"texture_params": [],
"vertex_shader": "../include/pass.vert.glsl",
"fragment_shader": "debug_normals.frag.glsl"
}
]
}

View file

@ -1,13 +0,0 @@
#version 450
#include "compiled.inc"
uniform sampler2D tex;
in vec2 texCoord;
out vec4 fragColor;
void main() {
vec4 col = textureLod(tex, texCoord, 0.0);
fragColor.rgb = vec4(col.r * 10.0, col.g * 10.0, 0.0);
}

View file

@ -1,14 +0,0 @@
{
"contexts": [
{
"name": "debug_velocity",
"depth_write": false,
"compare_mode": "always",
"cull_mode": "none",
"links": [],
"texture_params": [],
"vertex_shader": "../include/pass.vert.glsl",
"fragment_shader": "debug_velocity.frag.glsl"
}
]
}

View file

@ -1,9 +0,0 @@
#version 450
in vec4 color;
out vec4 fragColor;
void main() {
fragColor = color;
}

View file

@ -1,40 +0,0 @@
{
"contexts": [
{
"name": "grease_pencil",
"depth_write": false,
"compare_mode": "always",
"cull_mode": "none",
"blend_source": "source_alpha",
"blend_destination": "inverse_source_alpha",
"blend_operation": "add",
"alpha_blend_source": "source_alpha",
"alpha_blend_destination": "inverse_source_alpha",
"alpha_blend_operation": "add",
"links": [
{
"name": "VP",
"link": "_viewProjectionMatrix"
}
],
"texture_params": [],
"vertex_shader": "grease_pencil.vert.glsl",
"fragment_shader": "grease_pencil.frag.glsl"
},
{
"name": "grease_pencil_shadows",
"depth_write": true,
"compare_mode": "less",
"cull_mode": "none",
"links": [
{
"name": "LWVP",
"link": "_biasLightWorldViewProjectionMatrix"
}
],
"texture_params": [],
"vertex_shader": "grease_pencil_shadows.vert.glsl",
"fragment_shader": "../include/empty.frag.glsl"
}
]
}

View file

@ -1,13 +0,0 @@
#version 450
in vec3 pos;
in vec4 col;
out vec4 color;
uniform mat4 VP;
void main() {
color = col;
gl_Position = VP * vec4(pos.xyz, 1.0);
}

View file

@ -1,10 +0,0 @@
#version 450
in vec3 pos;
in vec4 col;
uniform mat4 LWVP;
void main() {
gl_Position = LWVP * vec4(pos.xyz, 1.0);
}

View file

@ -1,34 +0,0 @@
#version 450
#include "compiled.inc"
#include "std/conetrace.glsl"
#include "std/gbuffer.glsl"
// layout (local_size_x = 4, local_size_y = 4, local_size_z = 4) in;
layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
uniform layout(binding = 0, r32ui) readonly uimage3D voxelsNor;
uniform layout(binding = 1) sampler3D voxelsFrom;
uniform layout(binding = 2, rgba8) writeonly image3D voxelsTo;
void main() {
vec4 col = texelFetch(voxelsFrom, ivec3(gl_GlobalInvocationID.xyz), 0);
if (col.a == 0.0) {
// imageStore(voxelsTo, ivec3(gl_GlobalInvocationID.xyz), col);
imageStore(voxelsTo, ivec3(gl_GlobalInvocationID.xyz), vec4(0.0));
return;
}
const vec3 hres = voxelgiResolution / 2;
vec3 voxpos = (gl_GlobalInvocationID.xyz - hres) / hres;
vec3 wposition = voxpos * voxelgiHalfExtents;
uint unor = imageLoad(voxelsNor, ivec3(gl_GlobalInvocationID.xyz)).r;
vec3 wnormal = normalize(decNor(unor));
col.rgb += traceDiffuse(voxpos, wnormal, voxelsFrom).rgb * voxelgiDiff * 0.5;
col = clamp(col, vec4(0.0), vec4(1.0));
imageStore(voxelsTo, ivec3(gl_GlobalInvocationID.xyz), col);
}

View file

@ -1,83 +0,0 @@
#version 450
// layout (local_size_x = 4, local_size_y = 4, local_size_z = 4) in;
layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
#include "compiled.inc"
#include "std/math.glsl"
#include "std/gbuffer.glsl"
#include "std/shadows.glsl"
#include "std/imageatomic.glsl"
uniform vec3 lightPos;
uniform vec3 lightColor;
uniform int lightType;
uniform vec3 lightDir;
uniform vec2 spotData;
#ifdef _ShadowMap
uniform int lightShadow;
uniform vec2 lightProj;
uniform float shadowsBias;
uniform mat4 LVP;
#endif
uniform layout(binding = 0, r32ui) readonly uimage3D voxelsOpac;
// uniform layout(binding = 1, r32ui) readonly uimage3D voxelsNor;
uniform layout(binding = 1, r32ui) uimage3D voxels;
#ifdef _ShadowMap
uniform layout(binding = 2) sampler2DShadow shadowMap;
uniform layout(binding = 3) sampler2DShadow shadowMapSpot;
uniform layout(binding = 4) samplerCubeShadow shadowMapPoint;
#endif
void main() {
uint ucol = imageLoad(voxelsOpac, ivec3(gl_GlobalInvocationID.xyz)).r;
vec4 col = convRGBA8ToVec4(ucol);
if (col.a == 0.0) return;
const vec3 hres = voxelgiResolution / 2;
vec3 wposition = ((gl_GlobalInvocationID.xyz - hres) / hres) * voxelgiHalfExtents;
// uint unor = imageLoad(voxelsNor, ivec3(gl_GlobalInvocationID.xyz)).r;
// vec3 wnormal = normalize(decNor(unor));
// wposition -= wnormal * 0.01; // Offset
float visibility;
vec3 lp = lightPos - wposition;
vec3 l;
if (lightType == 0) { l = lightDir; visibility = 1.0; }
else { l = normalize(lp); visibility = attenuate(distance(wposition, lightPos)); }
// float dotNL = max(dot(wnormal, l), 0.0);
// if (dotNL == 0.0) return;
#ifdef _ShadowMap
if (lightShadow == 1) {
vec4 lightPosition = LVP * vec4(wposition, 1.0);
vec3 lPos = lightPosition.xyz / lightPosition.w;
visibility = texture(shadowMap, vec3(lPos.xy, lPos.z - shadowsBias)).r;
}
else if (lightShadow == 2) {
vec4 lightPosition = LVP * vec4(wposition, 1.0);
vec3 lPos = lightPosition.xyz / lightPosition.w;
visibility *= texture(shadowMapSpot, vec3(lPos.xy, lPos.z - shadowsBias)).r;
}
else if (lightShadow == 3) {
visibility *= texture(shadowMapPoint, vec4(-l, lpToDepth(lp, lightProj) - shadowsBias)).r;
}
#endif
if (lightType == 2) {
float spotEffect = dot(lightDir, l);
if (spotEffect < spotData.x) {
visibility *= smoothstep(spotData.y, spotData.x, spotEffect);
}
}
col.rgb *= visibility * lightColor;// * dotNL;
col = clamp(col, vec4(0.0), vec4(1.0));
imageAtomicAdd(voxels, ivec3(gl_GlobalInvocationID.xyz), convVec4ToRGBA8(col));
}

View file

@ -5,32 +5,6 @@ import iron.RenderPath;
class Inc {
static var path:RenderPath;
// #if (rp_gi == "Voxel GI")
// static var voxel_sh:kha.compute.Shader = null;
// static var voxel_ta:kha.compute.TextureUnit;
// static var voxel_tb:kha.compute.TextureUnit;
// static var voxel_tc:kha.compute.TextureUnit;
// static var voxel_td:kha.compute.TextureUnit;
// static var voxel_te:kha.compute.TextureUnit;
// static var voxel_tf:kha.compute.TextureUnit;
// static var voxel_ca:kha.compute.ConstantLocation;
// static var voxel_cb:kha.compute.ConstantLocation;
// static var voxel_cc:kha.compute.ConstantLocation;
// static var voxel_cd:kha.compute.ConstantLocation;
// static var voxel_ce:kha.compute.ConstantLocation;
// static var voxel_cf:kha.compute.ConstantLocation;
// static var voxel_cg:kha.compute.ConstantLocation;
// static var voxel_ch:kha.compute.ConstantLocation;
// static var voxel_ci:kha.compute.ConstantLocation;
// static var m = iron.math.Mat4.identity();
// #end
// #if (rp_gi_bounces)
// static var bounce_sh:kha.compute.Shader = null;
// static var bounce_ta:kha.compute.TextureUnit;
// static var bounce_tb:kha.compute.TextureUnit;
// static var bounce_tc:kha.compute.TextureUnit;
// #end
public static var superSample = 1.0;
static var pointIndex = 0;
@ -191,25 +165,6 @@ class Inc {
#end // arm_config
}
// #if (rp_shadowmap && kha_webgl)
// public static function initEmpty() {
// // Bind empty when requested target is not found
// var tempty = new RenderTargetRaw();
// tempty.name = "arm_empty";
// tempty.width = 1;
// tempty.height = 1;
// tempty.format = "DEPTH16";
// path.createRenderTarget(tempty);
// var temptyCube = new RenderTargetRaw();
// temptyCube.name = "arm_empty_cube";
// temptyCube.width = 1;
// temptyCube.height = 1;
// temptyCube.format = "DEPTH16";
// temptyCube.is_cubemap = true;
// path.createRenderTarget(temptyCube);
// }
// #end
#if (rp_translucency)
public static function initTranslucency() {
path.createDepthBuffer("main", "DEPTH24");
@ -391,119 +346,4 @@ class Inc {
return null;
#end
}
// #if (rp_gi == "Voxel GI")
// public static function computeVoxelsBegin() {
// if (voxel_sh == null) {
// voxel_sh = path.getComputeShader("voxel_light");
// voxel_ta = voxel_sh.getTextureUnit("voxelsOpac");
// // voxel_tb = voxel_sh.getTextureUnit("voxelsNor");
// voxel_tc = voxel_sh.getTextureUnit("voxels");
// voxel_td = voxel_sh.getTextureUnit("shadowMap");
// voxel_te = voxel_sh.getTextureUnit("shadowMapSpot");
// voxel_tf = voxel_sh.getTextureUnit("shadowMapPoint");
// voxel_ca = voxel_sh.getConstantLocation("lightPos");
// voxel_cb = voxel_sh.getConstantLocation("lightColor");
// voxel_cc = voxel_sh.getConstantLocation("lightType");
// voxel_cd = voxel_sh.getConstantLocation("lightDir");
// voxel_ci = voxel_sh.getConstantLocation("spotData");
// #if (rp_shadowmap)
// voxel_ce = voxel_sh.getConstantLocation("lightShadow");
// voxel_cf = voxel_sh.getConstantLocation("lightProj");
// voxel_cg = voxel_sh.getConstantLocation("LVP");
// voxel_ch = voxel_sh.getConstantLocation("shadowsBias");
// #end
// }
// path.clearImage("voxels", 0x00000000);
// }
// public static function computeVoxels() {
// var rts = path.renderTargets;
// var res = Inc.getVoxelRes();
// var lights = iron.Scene.active.lights;
// for (i in 0...lights.length) {
// var l = lights[i];
// if (!l.visible) continue;
// path.light = l;
// kha.compute.Compute.setShader(voxel_sh);
// kha.compute.Compute.setTexture(voxel_ta, rts.get("voxelsOpac").image, kha.compute.Access.Read);
// // kha.compute.Compute.setTexture(voxel_tb, rts.get("voxelsNor").image, kha.compute.Access.Read);
// kha.compute.Compute.setTexture(voxel_tc, rts.get("voxels").image, kha.compute.Access.Write);
// #if (rp_shadowmap)
// if (l.data.raw.type == "sun") {
// kha.compute.Compute.setSampledTexture(voxel_td, rts.get("shadowMap").image);
// kha.compute.Compute.setInt(voxel_ce, 1); // lightShadow
// }
// else if (l.data.raw.type == "spot") {
// kha.compute.Compute.setSampledTexture(voxel_te, rts.get("shadowMapSpot[0]").image);
// kha.compute.Compute.setInt(voxel_ce, 2);
// }
// else {
// kha.compute.Compute.setSampledCubeMap(voxel_tf, rts.get("shadowMapPoint[0]").cubeMap);
// kha.compute.Compute.setInt(voxel_ce, 3);
// }
// // lightProj
// var near = l.data.raw.near_plane;
// var far = l.data.raw.far_plane;
// var a:kha.FastFloat = far + near;
// var b:kha.FastFloat = far - near;
// var f2:kha.FastFloat = 2.0;
// var c:kha.FastFloat = f2 * far * near;
// var vx:kha.FastFloat = a / b;
// var vy:kha.FastFloat = c / b;
// kha.compute.Compute.setFloat2(voxel_cf, vx, vy);
// // LVP
// m.setFrom(l.VP);
// m.multmat(iron.object.Uniforms.biasMat);
// kha.compute.Compute.setMatrix(voxel_cg, m.self);
// // shadowsBias
// kha.compute.Compute.setFloat(voxel_ch, l.data.raw.shadows_bias);
// #end
// // lightPos
// kha.compute.Compute.setFloat3(voxel_ca, l.transform.worldx(), l.transform.worldy(), l.transform.worldz());
// // lightCol
// var f = l.data.raw.strength;
// kha.compute.Compute.setFloat3(voxel_cb, l.data.raw.color[0] * f, l.data.raw.color[1] * f, l.data.raw.color[2] * f);
// // lightType
// kha.compute.Compute.setInt(voxel_cc, iron.data.LightData.typeToInt(l.data.raw.type));
// // lightDir
// var v = l.look();
// kha.compute.Compute.setFloat3(voxel_cd, 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_ci, vx, vy);
// }
// kha.compute.Compute.compute(res, res, res);
// }
// }
// public static function computeVoxelsEnd() {
// var rts = path.renderTargets;
// var res = Inc.getVoxelRes();
// path.generateMipmaps("voxels");
// // #if (rp_gi_bounces)
// // if (bounce_sh == null) {
// // bounce_sh = path.getComputeShader("voxel_bounce");
// // bounce_ta = bounce_sh.getTextureUnit("voxelsNor");
// // bounce_tb = bounce_sh.getTextureUnit("voxelsFrom");
// // bounce_tc = bounce_sh.getTextureUnit("voxelsTo");
// // }
// // // path.clearImage("voxelsBounce", 0x00000000);
// // kha.compute.Compute.setShader(bounce_sh);
// // kha.compute.Compute.setTexture(bounce_ta, rts.get("voxelsNor").image, kha.compute.Access.Read);
// // kha.compute.Compute.setTexture3DParameters(bounce_tb, kha.graphics4.TextureAddressing.Clamp, kha.graphics4.TextureAddressing.Clamp, kha.graphics4.TextureAddressing.Clamp, kha.graphics4.TextureFilter.LinearFilter, kha.graphics4.TextureFilter.PointFilter, kha.graphics4.MipMapFilter.LinearMipFilter);
// // kha.compute.Compute.setSampledTexture(bounce_tb, rts.get("voxels").image);
// // kha.compute.Compute.setTexture(bounce_tc, rts.get("voxelsBounce").image, kha.compute.Access.Write);
// // kha.compute.Compute.compute(res, res, res);
// // path.generateMipmaps("voxelsBounce");
// // #end
// }
// #end
}

View file

@ -25,10 +25,6 @@ class RenderPathDeferred {
path = _path;
// #if (rp_shadowmap && kha_webgl)
// Inc.initEmpty();
// #end
#if (rp_background == "World")
{
path.loadShader("shader_datas/world_pass/world_pass");
@ -443,9 +439,6 @@ class RenderPathDeferred {
path.bindTarget("_main", "gbufferD");
#end
path.bindTarget("gbuffer0", "gbuffer0");
// #if (rp_ssgi == "RTGI")
// path.bindTarget("gbuffer1", "gbuffer1");
// #end
path.drawShader("shader_datas/ssgi_pass/ssgi_pass");
path.setTarget("singleb");
@ -508,19 +501,13 @@ class RenderPathDeferred {
if (voxelize) {
var res = Inc.getVoxelRes();
// #if (rp_gi == "Voxel GI")
// var voxtex = "voxelsOpac";
// #else
var voxtex = voxels;
// #end
path.clearImage(voxtex, 0x00000000);
path.setTarget("");
path.setViewport(res, res);
path.bindTarget(voxtex, "voxels");
#if (rp_gi == "Voxel GI")
// path.bindTarget("voxelsNor", "voxelsNor");
for (l in iron.Scene.active.lights) {
if (!l.visible || !l.data.raw.cast_shadow || l.data.raw.type != "sun") continue;
var n = "shadowMap";
@ -531,13 +518,6 @@ class RenderPathDeferred {
path.drawMeshes("voxel");
path.generateMipmaps(voxels);
}
// if (relight) {
// Inc.computeVoxelsBegin();
// Inc.computeVoxels();
// Inc.computeVoxelsEnd();
// path.generateMipmaps(voxels);
// }
}
#end

View file

@ -42,10 +42,6 @@ class RenderPathForward {
public static function init(_path:RenderPath) {
path = _path;
// #if (rp_shadowmap && kha_webgl)
// Inc.initEmpty();
// #end
#if (rp_background == "World")
{
@ -291,19 +287,13 @@ class RenderPathForward {
if (voxelize) {
var res = Inc.getVoxelRes();
// #if (rp_gi == "Voxel GI")
// var voxtex = "voxelsOpac";
// #else
var voxtex = voxels;
// #end
path.clearImage(voxtex, 0x00000000);
path.setTarget("");
path.setViewport(res, res);
path.bindTarget(voxtex, "voxels");
#if (rp_gi == "Voxel GI")
// path.bindTarget("voxelsNor", "voxelsNor");
for (l in iron.Scene.active.lights) {
if (!l.visible || !l.data.raw.cast_shadow || l.data.raw.type != "sun") continue;
var n = "shadowMap";
@ -314,13 +304,6 @@ class RenderPathForward {
path.drawMeshes("voxel");
path.generateMipmaps(voxels);
}
// if (relight) {
// Inc.computeVoxelsBegin();
// Inc.computeVoxels();
// Inc.computeVoxelsEnd();
// path.generateMipmaps(voxels);
// }
}
#end
@ -531,33 +514,10 @@ class RenderPathForward {
path.bindTarget("bufa", "edgesTex");
path.drawShader("shader_datas/smaa_blend_weight/smaa_blend_weight");
// #if (rp_antialiasing == "TAA")
// path.setTarget("bufa");
// #else
path.setTarget(framebuffer);
// #end
path.bindTarget("buf", "colorTex");
path.bindTarget("bufb", "blendTex");
// #if (rp_antialiasing == "TAA")
// {
// path.bindTarget("gbuffer2", "sveloc");
// }
// #end
path.drawShader("shader_datas/smaa_neighborhood_blend/smaa_neighborhood_blend");
// #if (rp_antialiasing == "TAA")
// {
// path.setTarget(framebuffer);
// path.bindTarget("bufa", "tex");
// path.bindTarget("taa", "tex2");
// path.bindTarget("gbuffer2", "sveloc");
// path.drawShader("shader_datas/taa_pass/taa_pass");
// path.setTarget("taa");
// path.bindTarget("bufa", "tex");
// path.drawShader("shader_datas/copy_pass/copy_pass");
// }
// #end
}
#end

View file

@ -46,17 +46,6 @@ vec4 tex_voronoi(const vec3 x) {
}
";
// Based on https://www.shadertoy.com/view/4sfGzS
// Copyright © 2013 Inigo Quilez
// The MIT License - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// float tex_noise_f(const vec3 x) {
// vec3 p = floor(x);
// vec3 f = fract(x);
// f = f * f * (3.0 - 2.0 * f);
// vec2 uv = (p.xy + vec2(37.0, 17.0) * p.z) + f.xy;
// vec2 rg = texture(snoise256, (uv + 0.5) / 256.0).yx;
// return mix(rg.x, rg.y, f.z);
// }
// By Morgan McGuire @morgan3d, http://graphicscodex.com Reuse permitted under the BSD license.
// https://www.shadertoy.com/view/4dS3Wd
public static var str_tex_noise = "

View file

@ -1,22 +0,0 @@
package armory.trait;
import iron.Trait;
class SceneInstance extends Trait {
function safeFilename(s:String) {
s = StringTools.replace(s, '.', '_');
s = StringTools.replace(s, '-', '_');
s = StringTools.replace(s, ' ', '_');
if (Std.parseInt(s.charAt(0)) != null) s = '_' + s; // Prefix _ if first char is digit
return s;
}
public function new(sceneName:String) {
super();
notifyOnInit(function() {
iron.Scene.active.addScene(safeFilename(sceneName), object, function(o:iron.object.Object) {});
});
}
}

View file

@ -1,85 +0,0 @@
package armory.trait;
import iron.object.Object;
import iron.math.Vec4;
import armory.trait.internal.CameraController;
class SidescrollerController extends CameraController {
#if (!arm_physics)
public function new() { super(); }
#else
var animObject:String;
var idleAction:String;
var runAction:String;
var currentAction:String;
var arm:Object;
public function new(animObject = "", idle = "idle", run = "run") {
super();
this.animObject = animObject;
this.idleAction = idle;
this.runAction = run;
currentAction = idleAction;
iron.Scene.active.notifyOnInit(init);
}
function init() {
if (animObject == "") arm = findAnimation(object);
else arm = object.getChild(animObject);
notifyOnUpdate(update);
}
function findAnimation(o:Object):Object {
if (o.animation != null) return o;
for (c in o.children) {
var co = findAnimation(c);
if (co != null) return co;
}
return null;
}
var dir = new Vec4();
function update() {
if (!body.ready) return;
if (jump) {
body.applyImpulse(new Vec4(0, 0, 20));
jump = false;
}
// Move
dir.set(0, 0, 0);
if (moveLeft) dir.add(transform.look().mult(-1));
if (moveRight) dir.add(transform.look());
// Push down
var btvec = body.getLinearVelocity();
body.setLinearVelocity(0.0, 0.0, btvec.z - 1.0);
if (moveLeft || moveRight) {
if (currentAction != runAction) {
arm.animation.play(runAction, null, 0.2);
currentAction = runAction;
}
dir.mult(-4 * 0.7);
body.activate();
body.setLinearVelocity(dir.x, dir.y, btvec.z - 1.0);
}
else {
if (currentAction != idleAction) {
arm.animation.play(idleAction, null, 0.2);
currentAction = idleAction;
}
}
// Keep vertical
body.setAngularFactor(0, 0, 0);
camera.buildMatrix();
}
#end
}

View file

@ -1,42 +0,0 @@
package armory.trait;
import iron.Trait;
import iron.system.Input;
import iron.system.Time;
import iron.object.CameraObject;
import iron.math.Vec4;
class VRNavigation extends Trait {
#if arm_vr
static inline var speed = 5.0;
var camera:CameraObject;
var mouse:Mouse;
public function new() {
super();
notifyOnInit(init);
notifyOnUpdate(update);
}
function init() {
mouse = Input.getMouse();
camera = cast(object, CameraObject);
}
var look = new Vec4();
function update() {
// Testing..
if (mouse.down()) {
var vr = kha.vr.VrInterface.instance;
var V = (vr != null && vr.IsPresenting()) ? camera.leftV : camera.V;
look.set(-V._02, -V._12, -V._22);
camera.transform.move(look, Time.delta * speed);
}
}
#end
}

View file

@ -165,8 +165,6 @@ def export_data(fp, sdk_path):
assets.shader_passes_assets[ref] = []
if ref.startswith('compositor_pass'):
compile_shader_pass(res, raw_shaders_path, ref, defs + cdefs, make_variants=has_config)
# elif ref.startswith('grease_pencil'):
# compile_shader_pass(res, raw_shaders_path, ref, [], make_variants=has_config)
else:
compile_shader_pass(res, raw_shaders_path, ref, defs, make_variants=has_config)
arm.utils.write_arm(shaders_path + '/shader_datas.arm', res)

View file

@ -139,8 +139,6 @@ def init_properties():
bpy.types.MetaBall.arm_cached = BoolProperty(name="Mesh Cached", description="No need to reexport metaball data", default=False)
bpy.types.MetaBall.arm_aabb = FloatVectorProperty(name="AABB", size=3, default=[0,0,0])
bpy.types.MetaBall.arm_dynamic_usage = BoolProperty(name="Dynamic Data Usage", description="Metaball data can change at runtime", default=False)
# For grease pencil
# bpy.types.GreasePencil.arm_cached = BoolProperty(name="GP Cached", description="No need to reexport grease pencil data", default=False)
# For armature
bpy.types.Armature.arm_cached = BoolProperty(name="Armature Cached", description="No need to reexport armature data", default=False)
# For camera

View file

@ -24,7 +24,6 @@ def update_preset(self, context):
rpdat.rp_hdr = True
rpdat.rp_background = 'World'
rpdat.rp_stereo = False
# rpdat.rp_greasepencil = False
rpdat.rp_gi = 'Off'
rpdat.rp_render_to_texture = True
rpdat.rp_supersampling = '1'
@ -57,7 +56,6 @@ def update_preset(self, context):
rpdat.rp_hdr = False
rpdat.rp_background = 'Clear'
rpdat.rp_stereo = False
# rpdat.rp_greasepencil = False
rpdat.rp_gi = 'Off'
rpdat.rp_render_to_texture = False
rpdat.rp_supersampling = '1'
@ -88,7 +86,6 @@ def update_preset(self, context):
rpdat.rp_hdr = True
rpdat.rp_background = 'World'
rpdat.rp_stereo = False
# rpdat.rp_greasepencil = False
rpdat.rp_gi = 'Voxel AO'
rpdat.rp_voxelgi_resolution = '128'
rpdat.arm_voxelgi_revoxelize = False
@ -128,7 +125,6 @@ def update_preset(self, context):
rpdat.rp_hdr = False
rpdat.rp_background = 'Clear'
rpdat.rp_stereo = False
# rpdat.rp_greasepencil = False
rpdat.rp_gi = 'Off'
rpdat.rp_render_to_texture = False
rpdat.rp_supersampling = '1'
@ -216,7 +212,7 @@ class ArmRPListItem(bpy.types.PropertyGroup):
rp_renderer: EnumProperty(
items=[('Forward', 'Forward Clustered', 'Forward'),
('Deferred', 'Deferred Clustered', 'Deferred'),
# ('Raytracer', 'Raytracer', 'Raytracer', 'ERROR', 2),
# ('Raytracer', 'Raytracer', 'Raytracer (Direct3D 12)', 'ERROR', 2),
],
name="Renderer", description="Renderer type", default='Deferred', update=update_renderpath)
rp_depthprepass: BoolProperty(name="Depth Prepass", description="Depth Prepass for mesh context", default=False, update=update_renderpath)
@ -324,7 +320,6 @@ class ArmRPListItem(bpy.types.PropertyGroup):
('Shader', 'Shader', 'Shader')],
name='Draw Order', description='Sort objects', default='Auto', update=assets.invalidate_compiled_data)
rp_stereo: BoolProperty(name="VR", description="Stereo rendering", default=False, update=update_renderpath)
rp_greasepencil: BoolProperty(name="Grease Pencil", description="Render Grease Pencil data", default=False, update=update_renderpath)
rp_ocean: BoolProperty(name="Ocean", description="Ocean pass", default=False, update=update_renderpath)
rp_gi: EnumProperty(
@ -383,12 +378,7 @@ class ArmRPListItem(bpy.types.PropertyGroup):
arm_voxelgi_dimensions: FloatProperty(name="Dimensions", description="Voxelization bounds",default=16, update=assets.invalidate_compiled_data)
arm_voxelgi_revoxelize: BoolProperty(name="Revoxelize", description="Revoxelize scene each frame", default=False, update=assets.invalidate_shader_cache)
arm_voxelgi_temporal: BoolProperty(name="Temporal Filter", description="Use temporal filtering to stabilize voxels", default=False, update=assets.invalidate_shader_cache)
# arm_voxelgi_bounces: EnumProperty(
# items=[('1', '1', '1'),
# ('2', '2', '2')],
# name="Bounces", description="Trace multiple light bounces", default='1', update=update_renderpath)
arm_voxelgi_camera: BoolProperty(name="Dynamic Camera", description="Use camera as voxelization origin", default=False, update=assets.invalidate_shader_cache)
# arm_voxelgi_anisotropic: BoolProperty(name="Anisotropic", description="Use anisotropic voxels", default=False, update=update_renderpath)
arm_voxelgi_shadows: BoolProperty(name="Shadows", description="Use voxels to render shadows", default=False, update=update_renderpath)
arm_samples_per_pixel: EnumProperty(
items=[('1', '1', '1'),