Merge branch 'master' into anim-keyframes

This commit is contained in:
MoritzBrueckner 2019-07-18 21:02:35 +02:00
commit 963b2bd389
24 changed files with 219 additions and 116 deletions

View file

@ -3,7 +3,7 @@ armory
[![Build Status](https://travis-ci.org/armory3d/armory.svg?branch=master)](https://travis-ci.org/armory3d/armory)
[armory3d.org](http://armory3d.org) - [Manual](http://armory3d.org/manual) - [Roadmap](https://github.com/armory3d/armory/projects) - [Community](https://armory3d.org/community)
[armory3d.org](https://armory3d.org) - [Manual](https://github.com/armory3d/armory/wiki) - [Roadmap](https://github.com/armory3d/armory/projects) - [Community](https://armory3d.org/community)
In development! Armory is an open-source 3D game engine with full Blender integration. The engine is currently available in a form of [early preview](http://armory3d.org/download.html).

View file

@ -13,7 +13,7 @@ in vec2 texCoord;
out vec4 fragColor;
void main() {
float roughness = unpackFloat(textureLod(gbuffer0, texCoord, 0.0).b).y;
float roughness = textureLod(gbuffer0, texCoord, 0.0).b;
// if (roughness == 0.0) { // Always blur for now, non blured output can produce noise
// fragColor.rgb = textureLod(tex, texCoord).rgb;
// return;

View file

@ -171,11 +171,15 @@ void main() {
n.xy = n.z >= 0.0 ? g0.xy : octahedronWrap(g0.xy);
n = normalize(n);
vec2 metrough = unpackFloat(g0.b);
float roughness = g0.b;
float metallic;
uint matid;
unpackFloatInt16(g0.a, metallic, matid);
vec4 g1 = textureLod(gbuffer1, texCoord, 0.0); // Basecolor.rgb, spec/occ
vec2 occspec = unpackFloat2(g1.a);
vec3 albedo = surfaceAlbedo(g1.rgb, metrough.x); // g1.rgb - basecolor
vec3 f0 = surfaceF0(g1.rgb, metrough.x);
vec3 albedo = surfaceAlbedo(g1.rgb, metallic); // g1.rgb - basecolor
vec3 f0 = surfaceF0(g1.rgb, metallic);
float depth = textureLod(gbufferD, texCoord, 0.0).r * 2.0 - 1.0;
vec3 p = getPos(eye, eyeLook, normalize(viewRay), depth, cameraProj);
@ -187,7 +191,7 @@ void main() {
#endif
#ifdef _Brdf
vec2 envBRDF = textureLod(senvmapBrdf, vec2(metrough.y, 1.0 - dotNV), 0.0).xy;
vec2 envBRDF = textureLod(senvmapBrdf, vec2(roughness, 1.0 - dotNV), 0.0).xy;
#endif
// Envmap
@ -202,7 +206,7 @@ void main() {
#ifdef _Rad
vec3 reflectionWorld = reflect(-v, n);
float lod = getMipFromRoughness(metrough.y, envmapNumMipmaps);
float lod = getMipFromRoughness(roughness, envmapNumMipmaps);
vec3 prefilteredColor = textureLod(senvmapRadiance, envMapEquirect(reflectionWorld), lod).rgb;
#endif
@ -219,7 +223,7 @@ void main() {
envl.rgb += prefilteredColor * (f0 * envBRDF.x + envBRDF.y) * 1.5 * occspec.y;
#else
#ifdef _EnvCol
envl.rgb += backgroundCol * surfaceF0(g1.rgb, metrough.x); // f0
envl.rgb += backgroundCol * surfaceF0(g1.rgb, metallic); // f0
#endif
#endif
@ -281,7 +285,7 @@ void main() {
float sdotNL = dot(n, sunDir);
float svisibility = 1.0;
vec3 sdirect = lambertDiffuseBRDF(albedo, sdotNL) +
specularBRDF(f0, metrough.y, sdotNL, sdotNH, dotNV, sdotVH) * occspec.y;
specularBRDF(f0, roughness, sdotNL, sdotNH, dotNV, sdotVH) * occspec.y;
#ifdef _ShadowMap
#ifdef _CSM
@ -317,11 +321,11 @@ void main() {
// #ifdef _Hair // Aniso
// if (g0.a == 2.0) {
// const float shinyParallel = metrough.y;
// const float shinyParallel = roughness;
// const float shinyPerpendicular = 0.1;
// const vec3 v = vec3(0.99146, 0.11664, 0.05832);
// vec3 T = abs(dot(n, v)) > 0.99999 ? cross(n, vec3(0.0, 1.0, 0.0)) : cross(n, v);
// fragColor.rgb = orenNayarDiffuseBRDF(albedo, metrough.y, dotNV, dotNL, dotVH) + wardSpecular(n, h, dotNL, dotNV, dotNH, T, shinyParallel, shinyPerpendicular) * spec;
// fragColor.rgb = orenNayarDiffuseBRDF(albedo, roughness, dotNV, dotNL, dotVH) + wardSpecular(n, h, dotNL, dotNV, dotNH, T, shinyParallel, shinyPerpendicular) * spec;
// }
// #endif
@ -340,7 +344,7 @@ void main() {
#ifdef _SinglePoint
fragColor.rgb += sampleLight(
p, n, v, dotNV, pointPos, pointCol, albedo, metrough.y, occspec.y, f0
p, n, v, dotNV, pointPos, pointCol, albedo, roughness, occspec.y, f0
#ifdef _ShadowMap
, 0, pointBias
#endif
@ -392,7 +396,7 @@ void main() {
lightsArray[li * 2].xyz, // lp
lightsArray[li * 2 + 1].xyz, // lightCol
albedo,
metrough.y,
roughness,
occspec.y,
f0
#ifdef _ShadowMap

View file

@ -102,11 +102,15 @@ void main() {
n.xy = n.z >= 0.0 ? g0.xy : octahedronWrap(g0.xy);
n = normalize(n);
vec2 metrough = unpackFloat(g0.b);
float roughness = g0.b;
float metallic;
uint matid;
unpackFloatInt16(g0.a, metallic, matid);
vec4 g1 = textureLod(gbuffer1, texCoord, 0.0); // Basecolor.rgb, spec/occ
vec2 occspec = unpackFloat2(g1.a);
vec3 albedo = surfaceAlbedo(g1.rgb, metrough.x); // g1.rgb - basecolor
vec3 f0 = surfaceF0(g1.rgb, metrough.x);
vec3 albedo = surfaceAlbedo(g1.rgb, metallic); // g1.rgb - basecolor
vec3 f0 = surfaceF0(g1.rgb, metallic);
float depth = textureLod(gbufferD, texCoord, 0.0).r * 2.0 - 1.0;
vec3 p = getPos(eye, eyeLook, normalize(viewRay), depth, cameraProj);
@ -114,7 +118,7 @@ void main() {
float dotNV = max(dot(n, v), 0.0);
#ifdef _Brdf
vec2 envBRDF = textureLod(senvmapBrdf, vec2(metrough.y, 1.0 - dotNV), 0.0).xy;
vec2 envBRDF = textureLod(senvmapBrdf, vec2(roughness, 1.0 - dotNV), 0.0).xy;
#endif
// Envmap
@ -129,7 +133,7 @@ void main() {
#ifdef _Rad
vec3 reflectionWorld = reflect(-v, n);
float lod = getMipFromRoughness(metrough.y, envmapNumMipmaps);
float lod = getMipFromRoughness(roughness, envmapNumMipmaps);
vec3 prefilteredColor = textureLod(senvmapRadiance, envMapEquirect(reflectionWorld), lod).rgb;
#endif
@ -146,7 +150,7 @@ void main() {
envl.rgb += prefilteredColor * (f0 * envBRDF.x + envBRDF.y) * 1.5 * occspec.y;
#else
#ifdef _EnvCol
envl.rgb += backgroundCol * surfaceF0(g1.rgb, metrough.x); // f0
envl.rgb += backgroundCol * surfaceF0(g1.rgb, metallic); // f0
#endif
#endif
@ -160,7 +164,7 @@ void main() {
float sdotNL = dot(n, sunDir);
float svisibility = 1.0;
vec3 sdirect = lambertDiffuseBRDF(albedo, sdotNL) +
specularBRDF(f0, metrough.y, sdotNL, sdotNH, dotNV, sdotVH) * occspec.y;
specularBRDF(f0, roughness, sdotNL, sdotNH, dotNV, sdotVH) * occspec.y;
#ifdef _ShadowMap
#ifdef _CSM
@ -176,7 +180,7 @@ void main() {
#ifdef _SinglePoint
fragColor.rgb += sampleLight(
p, n, v, dotNV, pointPos, pointCol, albedo, metrough.y, occspec.y, f0
p, n, v, dotNV, pointPos, pointCol, albedo, roughness, occspec.y, f0
#ifdef _ShadowMap
, 0, pointBias
#endif
@ -210,7 +214,7 @@ void main() {
lightsArray[li * 2].xyz, // lp
lightsArray[li * 2 + 1].xyz, // lightCol
albedo,
metrough.y,
roughness,
occspec.y,
f0
#ifdef _ShadowMap

View file

@ -23,7 +23,7 @@ void main() {
vec4 g0 = textureLod(gbuffer0, texCoord, 0.0); // Normal.xy, metallic/roughness, depth
float roughness = unpackFloat(g0.b).y;
float roughness = g0.b;
if (roughness > 0.95) {
fragColor.rgb = vec3(0.0);
return;

View file

@ -23,7 +23,7 @@ void main() {
vec4 g0 = textureLod(gbuffer0, texCoord, 0.0); // Normal.xy, metallic/roughness, depth
float roughness = unpackFloat(g0.b).y;
float roughness = g0.b;
if (roughness > 0.95) {
fragColor.rgb = vec3(0.0);
return;

View file

@ -63,7 +63,7 @@ vec4 rayCast(vec3 dir) {
void main() {
vec4 g0 = textureLod(gbuffer0, texCoord, 0.0);
float roughness = unpackFloat(g0.b).y;
float roughness = g0.b;
if (roughness == 1.0) { fragColor.rgb = vec3(0.0); return; }
float spec = fract(textureLod(gbuffer1, texCoord, 0.0).a);

View file

@ -98,7 +98,7 @@ vec4 encodeRGBM(const vec3 rgb) {
vec3 decodeRGBM(const vec4 rgbm) {
const float maxRange = 6.0;
return rgbm.rgb * rgbm.a * maxRange;
return rgbm.rgb * rgbm.a * maxRange;
}
uint encNor(vec3 n) {
@ -127,4 +127,68 @@ vec3 decNor(uint val) {
return normal;
}
// GBuffer helper - Sebastien Lagarde
// https://seblagarde.wordpress.com/2018/09/02/gbuffer-helper-packing-integer-and-float-together/
float packFloatInt8(const float f, const uint i) {
// Constant optimize by compiler
const int numBitTarget = 8;
const int numBitI = 4;
const float prec = float(1 << numBitTarget);
const float maxi = float(1 << numBitI);
const float precMinusOne = prec - 1.0;
const float t1 = ((prec / maxi) - 1.0) / precMinusOne;
const float t2 = (prec / maxi) / precMinusOne;
// Code
return t1 * f + t2 * float(i);
}
float packFloatInt16(const float f, const uint i) {
// Constant optimize by compiler
const int numBitTarget = 16;
const int numBitI = 4;
const float prec = float(1 << numBitTarget);
const float maxi = float(1 << numBitI);
const float precMinusOne = prec - 1.0;
const float t1 = ((prec / maxi) - 1.0) / precMinusOne;
const float t2 = (prec / maxi) / precMinusOne;
// Code
return t1 * f + t2 * float(i);
}
void unpackFloatInt8(const float val, out float f, out uint i) {
// Constant optimize by compiler
const int numBitTarget = 8;
const int numBitI = 4;
const float prec = float(1 << numBitTarget);
const float maxi = float(1 << numBitI);
const float precMinusOne = prec - 1.0;
const float t1 = ((prec / maxi) - 1.0) / precMinusOne;
const float t2 = (prec / maxi) / precMinusOne;
// Code
// extract integer part
// + rcp(precMinusOne) to deal with precision issue
i = int((val / t2) + (1.0 / precMinusOne));
// Now that we have i, solve formula in packFloatInt for f
//f = (val - t2 * float(i)) / t1 => convert in mads form
f = clamp((-t2 * float(i) + val) / t1, 0.0, 1.0); // Saturate in case of precision issue
}
void unpackFloatInt16(const float val, out float f, out uint i) {
// Constant optimize by compiler
const int numBitTarget = 16;
const int numBitI = 4;
const float prec = float(1 << numBitTarget);
const float maxi = float(1 << numBitI);
const float precMinusOne = prec - 1.0;
const float t1 = ((prec / maxi) - 1.0) / precMinusOne;
const float t2 = (prec / maxi) / precMinusOne;
// Code
// extract integer part
// + rcp(precMinusOne) to deal with precision issue
i = int((val / t2) + (1.0 / precMinusOne));
// Now that we have i, solve formula in packFloatInt for f
//f = (val - t2 * float(i)) / t1 => convert in mads form
f = clamp((-t2 * float(i) + val) / t1, 0.0, 1.0); // Saturate in case of precision issue
}
#endif

View file

@ -18,7 +18,8 @@ class CastPhysicsRayNode extends LogicNode {
#if arm_physics
var physics = armory.trait.physics.PhysicsWorld.active;
var rb = physics.rayCast(vfrom, vto);
var hit = physics.rayCast(vfrom, vto);
var rb = (hit != null) ? hit.rb : null;
if (from == 0) { // Object
if (rb != null) return rb.object;

View file

@ -8,12 +8,15 @@ class RenderPathCreator {
public static var path:RenderPath;
#if (rp_renderer == "Forward")
public static var setTargetMeshes:Void->Void = RenderPathForward.setTargetMeshes;
public static var drawMeshes:Void->Void = RenderPathForward.drawMeshes;
public static var applyConfig:Void->Void = RenderPathForward.applyConfig;
#elseif (rp_renderer == "Deferred")
public static var setTargetMeshes:Void->Void = RenderPathDeferred.setTargetMeshes;
public static var drawMeshes:Void->Void = RenderPathDeferred.drawMeshes;
public static var applyConfig:Void->Void = RenderPathDeferred.applyConfig;
#else
public static var setTargetMeshes:Void->Void = function() {};
public static var drawMeshes:Void->Void = function() {};
public static var applyConfig:Void->Void = function() {};
#end

View file

@ -13,6 +13,18 @@ class RenderPathDeferred {
static var voxelsLast = "voxels";
#end
public static function setTargetMeshes() {
#if rp_gbuffer2
{
path.setTarget("gbuffer0", ["gbuffer1", "gbuffer2"]);
}
#else
{
path.setTarget("gbuffer0", ["gbuffer1"]);
}
#end
}
public static function drawMeshes() {
path.drawMeshes("mesh");
}
@ -394,14 +406,11 @@ class RenderPathDeferred {
{
path.setTarget("gbuffer2");
path.clearTarget(0xff000000);
path.setTarget("gbuffer0", ["gbuffer1", "gbuffer2"]);
}
#else
{
path.setTarget("gbuffer0", ["gbuffer1"]);
}
#end
RenderPathCreator.setTargetMeshes();
#if rp_stereo
{
path.drawStereo(drawMeshes);

View file

@ -13,26 +13,42 @@ class RenderPathForward {
static var voxelsLast = "voxels";
#end
public static function setTargetMeshes() {
#if rp_render_to_texture
{
#if rp_ssr
path.setTarget("lbuffer0", ["lbuffer1"]);
#else
path.setTarget("lbuffer0");
#end
}
#else
{
path.setTarget("");
}
#end
}
public static function drawMeshes() {
path.drawMeshes("mesh");
#if (rp_background == "World")
{
setTargetMain();
RenderPathCreator.setTargetMeshes();
path.drawSkydome("shader_datas/world_pass/world_pass");
}
#end
#if rp_blending
{
setTargetMain();
RenderPathCreator.setTargetMeshes();
path.drawMeshes("blend");
}
#end
#if rp_translucency
{
setTargetMain();
RenderPathCreator.setTargetMeshes();
Inc.drawTranslucency("lbuffer0");
}
#end
@ -260,22 +276,6 @@ class RenderPathForward {
#end
}
static function setTargetMain() {
#if rp_render_to_texture
{
#if rp_ssr
path.setTarget("lbuffer0", ["lbuffer1"]);
#else
path.setTarget("lbuffer0");
#end
}
#else
{
path.setTarget("");
}
#end
}
public static function commands() {
#if rp_shadowmap
@ -311,7 +311,7 @@ class RenderPathForward {
}
#end
setTargetMain();
RenderPathCreator.setTargetMeshes();
#if (rp_background == "Clear")
{
@ -326,7 +326,7 @@ class RenderPathForward {
#if rp_depthprepass
{
path.drawMeshes("depth");
setTargetMain();
RenderPathCreator.setTargetMeshes();
}
#end

View file

@ -8,6 +8,17 @@ import iron.math.Vec4;
import iron.math.RayCaster;
import iron.data.SceneFormat;
class Hit {
public var rb:RigidBody;
public var pos:Vec4;
public var normal:Vec4;
public function new(rb:RigidBody, pos:Vec4, normal:Vec4){
this.rb = rb;
this.pos = pos;
this.normal = normal;
}
}
class ContactPair {
public var a:Int;
public var b:Int;
@ -301,10 +312,12 @@ class PhysicsWorld extends Trait {
var start = new Vec4();
var end = new Vec4();
RayCaster.getDirection(start, end, inputX, inputY, camera);
return rayCast(camera.transform.world.getLoc(), end);
var hit = rayCast(camera.transform.world.getLoc(), end);
var rb = (hit != null) ? hit.rb : null;
return rb;
}
public function rayCast(from:Vec4, to:Vec4):RigidBody {
public function rayCast(from:Vec4, to:Vec4):Hit {
var rayFrom = vec1;
var rayTo = vec2;
rayFrom.setValue(from.x, from.y, from.z);
@ -315,6 +328,7 @@ class PhysicsWorld extends Trait {
var worldCol:bullet.Bt.CollisionWorld = worldDyn;
worldCol.rayTest(rayFrom, rayTo, rayCallback);
var rb:RigidBody = null;
var hitInfo:Hit = null;
var rc:bullet.Bt.RayResultCallback = rayCallback;
if (rc.hasHit()) {
@ -326,12 +340,14 @@ class PhysicsWorld extends Trait {
var norm = rayCallback.get_m_hitNormalWorld();
hitNormalWorld.set(norm.x(), norm.y(), norm.z());
rb = rbMap.get(untyped body.userIndex);
hitInfo = new Hit(rb,hitPointWorld,hitNormalWorld);
#elseif cpp
var hit = rayCallback.m_hitPointWorld;
hitPointWorld.set(hit.x(), hit.y(), hit.z());
var norm = rayCallback.m_hitNormalWorld;
hitNormalWorld.set(norm.x(), norm.y(), norm.z());
rb = rbMap.get(rayCallback.m_collisionObject.getUserIndex());
hitInfo = new Hit(rb,hitPointWorld,hitNormalWorld);
#end
}
@ -341,7 +357,7 @@ class PhysicsWorld extends Trait {
rayCallback.delete();
#end
return rb;
return hitInfo;
}
public function notifyOnPreUpdate(f:Void->Void) {

View file

@ -52,12 +52,12 @@ class KeyboardNode(Node, ArmLogicTreeNode):
('7', '7', '7'),
('8', '8', '8'),
('9', '9', '9'),
('.', '.', '.'),
(',', ',', ','),
('period', 'period', 'period'),
('comma', 'comma', 'comma'),
('space', 'space', 'space'),
('backspace', 'backspace', 'backspace'),
('tab', 'tab', 'tab'),
('return', 'return', 'return'),
('enter', 'enter', 'enter'),
('shift', 'shift', 'shift'),
('control', 'control', 'control'),
('alt', 'alt', 'alt'),

View file

@ -52,12 +52,12 @@ class OnKeyboardNode(Node, ArmLogicTreeNode):
('7', '7', '7'),
('8', '8', '8'),
('9', '9', '9'),
('.', '.', '.'),
(',', ',', ','),
('period', 'period', 'period'),
('comma', 'comma', 'comma'),
('space', 'space', 'space'),
('backspace', 'backspace', 'backspace'),
('tab', 'tab', 'tab'),
('return', 'return', 'return'),
('enter', 'enter', 'enter'),
('shift', 'shift', 'shift'),
('control', 'control', 'control'),
('alt', 'alt', 'alt'),

View file

@ -510,17 +510,13 @@ def build_success():
elif wrd.arm_runtime == 'Krom':
if wrd.arm_live_patch:
open(arm.utils.get_fp_build() + '/debug/krom/krom.patch', 'w').close()
if arm.utils.get_os() == 'win':
bin_ext = '' if state.export_gapi == 'direct3d11' else '_' + state.export_gapi
else:
bin_ext = '' if state.export_gapi == 'opengl' else '_' + state.export_gapi
krom_location, krom_path = arm.utils.krom_paths(bin_ext=bin_ext)
krom_location, krom_path = arm.utils.krom_paths()
os.chdir(krom_location)
cmd = [krom_path, arm.utils.get_fp_build() + '/debug/krom', arm.utils.get_fp_build() + '/debug/krom-resources']
if arm.utils.get_os() == 'win':
cmd.append('--consolepid')
cmd.append(str(os.getpid()))
if wrd.arm_audio == 'Enabled':
if wrd.arm_audio == 'Enabled' and arm.utils.get_os() != 'mac':
cmd.append('--sound')
state.proc_play = run_proc(cmd, play_done)

View file

@ -1262,6 +1262,34 @@ def parse_value(node, socket):
out_val = '({0} * {1})'.format(val1, val2)
elif op == 'DIVIDE':
out_val = '({0} / {1})'.format(val1, val2)
elif op == 'POWER':
out_val = 'pow({0}, {1})'.format(val1, val2)
elif op == 'LOGARITHM':
out_val = 'log({0})'.format(val1)
elif op == 'SQRT':
out_val = 'sqrt({0})'.format(val1)
elif op == 'ABSOLUTE':
out_val = 'abs({0})'.format(val1)
elif op == 'MINIMUM':
out_val = 'min({0}, {1})'.format(val1, val2)
elif op == 'MAXIMUM':
out_val = 'max({0}, {1})'.format(val1, val2)
elif op == 'LESS_THAN':
out_val = 'float({0} < {1})'.format(val1, val2)
elif op == 'GREATER_THAN':
out_val = 'float({0} > {1})'.format(val1, val2)
elif op == 'ROUND':
# out_val = 'round({0})'.format(val1)
out_val = 'floor({0} + 0.5)'.format(val1)
elif op == 'FLOOR':
out_val = 'floor({0})'.format(val1)
elif op == 'CEIL':
out_val = 'ceil({0})'.format(val1)
elif op == 'FRACT':
out_val = 'fract({0})'.format(val1)
elif op == 'MODULO':
# out_val = 'float({0} % {1})'.format(val1, val2)
out_val = 'mod({0}, {1})'.format(val1, val2)
elif op == 'SINE':
out_val = 'sin({0})'.format(val1)
elif op == 'COSINE':
@ -1274,26 +1302,8 @@ def parse_value(node, socket):
out_val = 'acos({0})'.format(val1)
elif op == 'ARCTANGENT':
out_val = 'atan({0})'.format(val1)
elif op == 'POWER':
out_val = 'pow({0}, {1})'.format(val1, val2)
elif op == 'LOGARITHM':
out_val = 'log({0})'.format(val1)
elif op == 'MINIMUM':
out_val = 'min({0}, {1})'.format(val1, val2)
elif op == 'MAXIMUM':
out_val = 'max({0}, {1})'.format(val1, val2)
elif op == 'ROUND':
# out_val = 'round({0})'.format(val1)
out_val = 'floor({0} + 0.5)'.format(val1)
elif op == 'LESS_THAN':
out_val = 'float({0} < {1})'.format(val1, val2)
elif op == 'GREATER_THAN':
out_val = 'float({0} > {1})'.format(val1, val2)
elif op == 'MODULO':
# out_val = 'float({0} % {1})'.format(val1, val2)
out_val = 'mod({0}, {1})'.format(val1, val2)
elif op == 'ABSOLUTE':
out_val = 'abs({0})'.format(val1)
elif op == 'ARCTAN2':
out_val = 'atan({0}, {1})'.format(val1, val2)
if node.use_clamp:
return 'clamp({0}, 0.0, 1.0)'.format(out_val)
else:

View file

@ -67,7 +67,7 @@ def make(context_id):
frag.write('n /= (abs(n.x) + abs(n.y) + abs(n.z));')
frag.write('n.xy = n.z >= 0.0 ? n.xy : octahedronWrap(n.xy);')
frag.write('fragColor[0] = vec4(n.xy, packFloat(metallic, roughness), opacity);')
frag.write('fragColor[0] = vec4(n.xy, roughness, opacity);')
frag.write('fragColor[1] = vec4(basecol.rgb, opacity);')
make_finalize.make(con_decal)

View file

@ -245,16 +245,16 @@ def make_deferred(con_mesh, rpasses):
frag.write('n.xy = n.z >= 0.0 ? n.xy : octahedronWrap(n.xy);')
if '_Emission' in wrd.world_defs or '_SSS' in wrd.world_defs or '_Hair' in wrd.world_defs:
frag.write('float matid = 0.0;')
frag.write('uint matid = 0;')
if '_Emission' in wrd.world_defs:
frag.write('if (emission > 0) { basecol *= emission; matid = 1.0; }')
frag.write('if (emission > 0) { basecol *= emission; matid = 1; }')
if '_SSS' in wrd.world_defs or '_Hair' in wrd.world_defs:
frag.add_uniform('int materialID')
frag.write('if (materialID == 2) matid = 2.0;')
frag.write('if (materialID == 2) matid = 2;')
else:
frag.write('const float matid = 0.0;')
frag.write('const uint matid = 0;')
frag.write('fragColor[0] = vec4(n.xy, packFloat(metallic, roughness), matid);')
frag.write('fragColor[0] = vec4(n.xy, roughness, packFloatInt16(metallic, matid));')
frag.write('fragColor[1] = vec4(basecol, packFloat2(occlusion, specular));')
if '_gbuffer2' in wrd.world_defs:
@ -537,7 +537,7 @@ def make_forward(con_mesh):
frag.write('n /= (abs(n.x) + abs(n.y) + abs(n.z));')
frag.write('n.xy = n.z >= 0.0 ? n.xy : octahedronWrap(n.xy);')
frag.write('fragColor[0] = vec4(direct + indirect, packFloat2(occlusion, specular));')
frag.write('fragColor[1] = vec4(n.xy, packFloat(metallic, roughness), 1.0);')
frag.write('fragColor[1] = vec4(n.xy, roughness, metallic);')
else:
frag.add_out('vec4 fragColor[1]')
frag.write('fragColor[0] = vec4(direct + indirect, 1.0);')

View file

@ -12,7 +12,7 @@ import arm.proxy
import arm.nodes_logic
# Armory version
arm_version = '2019.6'
arm_version = '2019.7'
arm_commit = '$Id$'
def init_properties():

View file

@ -321,11 +321,10 @@ class ArmEditCanvasButton(bpy.types.Operator):
project_path = arm.utils.get_fp()
item = obj.arm_traitlist[obj.arm_traitlist_index]
canvas_path = project_path + '/Bundled/canvas/' + item.canvas_name_prop + '.json'
sdk_path = arm.utils.get_sdk_path()
armory2d_path = sdk_path + '/lib/armory_tools/armory2d'
bin_ext = '_opengl' if arm.utils.get_os() == 'win' else ''
krom_location, krom_path = arm.utils.krom_paths(bin_ext=bin_ext)
ext = 'd3d11' if arm.utils.get_os() == 'win' else 'opengl'
armory2d_path = sdk_path + '/lib/armory_tools/armory2d/' + ext
krom_location, krom_path = arm.utils.krom_paths()
os.chdir(krom_location)
cpath = canvas_path.replace('\\', '/')
uiscale = str(arm.utils.get_ui_scale())

View file

@ -85,7 +85,7 @@ def get_gapi():
return getattr(item, target_to_gapi(item.arm_project_target))
if wrd.arm_runtime == 'Browser':
return 'webgl'
return arm.utils.get_player_gapi()
return 'direct3d11' if get_os() == 'win' else 'opengl'
def get_rp():
wrd = bpy.data.worlds['Arm']
@ -139,11 +139,6 @@ def get_renderdoc_path():
p = pdefault
return p
def get_player_gapi():
preferences = bpy.context.preferences
addon_prefs = preferences.addons['armory'].preferences
return 'opengl' if not hasattr(addon_prefs, 'player_gapi_' + get_os()) else getattr(addon_prefs, 'player_gapi_' + get_os())
def get_code_editor():
preferences = bpy.context.preferences
addon_prefs = preferences.addons['armory'].preferences
@ -209,17 +204,17 @@ def get_haxe_path():
def get_khamake_path():
return get_kha_path() + '/make'
def krom_paths(bin_ext=''):
def krom_paths():
sdk_path = get_sdk_path()
if arm.utils.get_os() == 'win':
krom_location = sdk_path + '/Krom'
krom_path = krom_location + '/Krom' + bin_ext + '.exe'
krom_path = krom_location + '/Krom.exe'
elif arm.utils.get_os() == 'mac':
krom_location = sdk_path + '/Krom/Krom.app/Contents/MacOS'
krom_path = krom_location + '/Krom' + bin_ext
krom_path = krom_location + '/Krom'
else:
krom_location = sdk_path + '/Krom'
krom_path = krom_location + '/Krom' + bin_ext
krom_path = krom_location + '/Krom'
return krom_location, krom_path
def fetch_bundled_script_names():
@ -233,11 +228,13 @@ script_props = {}
script_props_defaults = {}
def fetch_script_props(file):
with open(file) as f:
if '/' in file:
file = file.split('/')[-1]
if '\\' in file:
file = file.split('\\')[-1]
name = file.rsplit('.')[0]
if 'Sources' in name:
name = name[name.index('Sources')+8:]
if '/' in name:
name = name.replace('/','.')
if '\\' in file:
name = name.replace('\\','.')
script_props[name] = []
script_props_defaults[name] = []
lines = f.read().splitlines()

View file

@ -154,8 +154,7 @@ project.addSources('Sources');
f.write("project.addParameter('" + import_traits[i] + "');\n")
f.write("""project.addParameter("--macro keep('""" + import_traits[i] + """')");\n""")
jstarget = state.target == 'krom' or state.target == 'html5'
noembed = wrd.arm_cache_build and not is_publish and jstarget
noembed = wrd.arm_cache_build and not is_publish and state.target == 'krom'
if noembed:
# Load shaders manually
assets.add_khafile_def('arm_noembed')

View file

@ -1,3 +1,4 @@
* 2019-06-30: Return value of `PhysicsWorld.rayCast()` changed, see https://github.com/armory3d/armory/commit/dfb7609a28cebf3a520e6a25a8563d01c32f2b01.
* 2019-04-06: Use voxelao instead of voxelgi, gi will be reworked into raytracing.
* 2019-01-13: If you are using Armory Updater, get Armory 0.6beta from https://armory.itch.io/armory3d first (or clone the sdk from https://github.com/armory3d/armsdk).
* 2018-08-28: `LampObject` and `LampData` is now `LightObject` and `LightData`