Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions h3d/impl/GlDriver.hx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class GlDriver extends Driver {
static var UID = 0;
public var gl : GL;
public static var ALLOW_WEBGL2 = true;
public static var MAX_PRECISION = null;
public var textureSupport:hxd.PixelFormat;
#end

Expand Down Expand Up @@ -280,6 +281,9 @@ class GlDriver extends Driver {
var glout = new ShaderCompiler();
glout.glES = glES;
glout.version = shaderVersion;
#if js
glout.precision = MAX_PRECISION;
#end
#if !usegl
@:privateAccess glout.intelDriverFix = isIntelGpu;
#end
Expand Down
13 changes: 11 additions & 2 deletions h3d/scene/Skin.hx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Skin extends MultiMaterial {
var paletteChanged : Bool;
var skinShader : h3d.shader.SkinBase;
var jointsGraphics : Graphics;
var additivePose : Array<h3d.Matrix>;

public var showJoints : Bool;
public var enableRetargeting : Bool = true;
Expand Down Expand Up @@ -170,10 +171,14 @@ class Skin extends MultiMaterial {
return skinData;
}

public function setJointRelPosition( name : String, pos : h3d.Matrix ) {
public function setJointRelPosition( name : String, pos : h3d.Matrix, additive = false ) {
var j = skinData.namedJoints.get(name);
if( j == null ) return;
currentRelPose[j.index] = pos;
if( additive ) {
if( additivePose == null ) additivePose = [];
additivePose[j.index] = pos;
} else
currentRelPose[j.index] = pos;
jointsUpdated = true;
}

Expand Down Expand Up @@ -251,6 +256,10 @@ class Skin extends MultiMaterial {
m.multiply3x4inline(r, absPos);
else
m.multiply3x4inline(r, currentAbsPose[j.parent.index]);
if( additivePose != null ) {
var a = additivePose[id];
if( a != null ) m.multiply3x4inline(a, m);
}
if( bid >= 0 )
currentPalette[bid].multiply3x4inline(j.transPos, m);
}
Expand Down
4 changes: 2 additions & 2 deletions hxsl/Flatten.hx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class Flatten {
if( idx == idx2 )
readField(expr, pos, size);
else {
var k = 4 - pos;
var k = (idx2 << 2) - pos;
var type = switch(size) {
case 2: Vec2;
case 3: Vec3;
Expand All @@ -193,7 +193,7 @@ class Flatten {
}
{ e : TCall({ e : TGlobal(type), p : e.p, t : TVoid },[
readField(expr, pos, k),
readField(expr, pos + 1, size - k)
readField(expr, pos + k, size - k)
]), t : e.t, p : e.p }
}
case TMat4:
Expand Down
6 changes: 5 additions & 1 deletion hxsl/GlslOut.hx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class GlslOut {
public var varNames : Map<Int,String>;
public var glES : Null<Float>;
public var version : Null<Int>;
public var precision : Null<String> = null;

/*
Intel HD driver fix:
Expand Down Expand Up @@ -811,14 +812,17 @@ class GlslOut {

if( isCompute ) {
// no prec
} else if( precision != null ) {
decl('precision $precision float;');
decl('precision $precision int;');
} else if( isVertex ) {
decl("precision highp float;");
decl("precision highp int;");
} else {
decl("precision mediump float;");
decl("precision mediump int;");
}

initVars(s);

if( isCompute )
Expand Down