Ocean modifier hook.
This commit is contained in:
parent
a589a76250
commit
68452c0006
|
@ -69,8 +69,8 @@ class FirstPersonController extends Trait {
|
|||
// Look
|
||||
// if (!locked) {
|
||||
if (Input.touch) {
|
||||
camera.rotate(new Vec4(1, 0, 0), Input.deltaY / 200);
|
||||
transform.rotate(new Vec4(0, 0, 1), -Input.deltaX / 200);
|
||||
camera.rotate(new Vec4(1, 0, 0), Input.deltaY / 350);
|
||||
transform.rotate(new Vec4(0, 0, 1), -Input.deltaX / 350);
|
||||
body.syncTransform();
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ class FirstPersonController extends Trait {
|
|||
dir.add(force);
|
||||
}
|
||||
if (moveBackward) {
|
||||
var mat = Mat4.identity();
|
||||
var mat = Mat4.identity();
|
||||
transform.rot.saveToMatrix(mat);
|
||||
|
||||
var force = new Vec4(0, -1, 0);
|
||||
|
@ -93,7 +93,7 @@ class FirstPersonController extends Trait {
|
|||
dir.add(force);
|
||||
}
|
||||
if (moveLeft) {
|
||||
var mat = Mat4.identity();
|
||||
var mat = Mat4.identity();
|
||||
transform.rot.saveToMatrix(mat);
|
||||
|
||||
var force = new Vec4(-1, 0, 0);
|
||||
|
@ -101,7 +101,7 @@ class FirstPersonController extends Trait {
|
|||
dir.add(force);
|
||||
}
|
||||
if (moveRight) {
|
||||
var mat = Mat4.identity();
|
||||
var mat = Mat4.identity();
|
||||
transform.rot.saveToMatrix(mat);
|
||||
|
||||
var force = new Vec4(1, 0, 0);
|
||||
|
|
|
@ -1122,7 +1122,10 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper):
|
|||
# object reference, material references (for geometries), and transform.
|
||||
# Subnodes are then exported recursively.
|
||||
if (node.name[0] == "."):
|
||||
return; # Do not export nodes prefixed with '.'
|
||||
return # Do not export nodes prefixed with '.'
|
||||
|
||||
if self.cb_preprocess_node(node) == False:
|
||||
return
|
||||
|
||||
nodeRef = self.nodeArray.get(node)
|
||||
if (nodeRef):
|
||||
|
@ -2044,6 +2047,17 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper):
|
|||
break
|
||||
ArmoryExporter.material_ids = bpy.data.cameras[0].material_ids
|
||||
|
||||
def cb_preprocess_node(self, node): # Returns false if node should not be exported
|
||||
#return True
|
||||
|
||||
for m in node.modifiers:
|
||||
if m.type == 'OCEAN':
|
||||
# Process ocean modifier
|
||||
# Do not export this node
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def cb_export_node(self, node, o):
|
||||
#return
|
||||
# Export traits
|
||||
|
|
|
@ -10,11 +10,11 @@ in vec2 texCoord;
|
|||
|
||||
void main() {
|
||||
vec4 col = texture(tex, texCoord);
|
||||
float brightness = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722));
|
||||
if (brightness > 2.0) {
|
||||
gl_FragColor.rgb = vec3(col.rgb);
|
||||
return;
|
||||
}
|
||||
// float brightness = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722));
|
||||
// if (brightness > 2.0) {
|
||||
// gl_FragColor.rgb = vec3(col.rgb);
|
||||
// return;
|
||||
// }
|
||||
|
||||
gl_FragColor.rgb = vec3(0.0);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ uniform mat4 LMVP;
|
|||
uniform vec3 light;
|
||||
uniform vec3 eye;
|
||||
uniform vec3 eyeLook;
|
||||
uniform float time;
|
||||
|
||||
|
||||
|
||||
|
@ -182,7 +183,9 @@ float shadowTest(vec4 lPos) {
|
|||
lPosH.x = (lPosH.x + 1.0) / 2.0;
|
||||
lPosH.y = 1.0 - ((-lPosH.y + 1.0) / (2.0));
|
||||
|
||||
return PCF(vec2(2048, 2048), lPosH.st, lPosH.z - 0.005);
|
||||
const float bias = 0.005;
|
||||
// const float bias = 0.01;
|
||||
return PCF(vec2(2048, 2048), lPosH.st, lPosH.z - bias);
|
||||
}
|
||||
|
||||
vec2 octahedronWrap(vec2 v) {
|
||||
|
@ -458,8 +461,10 @@ void main() {
|
|||
|
||||
|
||||
// LTC
|
||||
// const float rectSizeX = 2.5;
|
||||
// const float rectSizeY = 1.2;
|
||||
// float sinval = (sin(time) * 0.5 + 0.5);
|
||||
// vec4 outColor = vec4(1.0);
|
||||
// float rectSizeX = 4.000 + sin(time) * 4.0;
|
||||
// float rectSizeY = 1.2;// + sin(time * 2.0);
|
||||
// vec3 ex = vec3(1, 0, 0)*rectSizeX;
|
||||
// vec3 ey = vec3(0, 0, 1)*rectSizeY;
|
||||
// vec3 p1 = light - ex + ey;
|
||||
|
@ -477,13 +482,19 @@ void main() {
|
|||
// vec3(t.w, 0, t.x)
|
||||
// );
|
||||
|
||||
// vec3 ltcspec = LTC_Evaluate(n, v, p, Minv, p1, p2, p3, p4, true);
|
||||
// vec3 ltcspec = LTC_Evaluate(n, v, p, Minv, p1, p2, p3, p4, true);
|
||||
|
||||
// ltcspec *= vec3(1.0, 1.0 - sinval, 1.0 - sinval);
|
||||
|
||||
// ltcspec *= texture(sltcMag, tuv).a;
|
||||
// vec3 ltcdiff = LTC_Evaluate(n, v, p, mat3(1), p1, p2, p3, p4, true);
|
||||
// vec3 ltcdiff = LTC_Evaluate(n, v, p, mat3(1), p1, p2, p3, p4, true);
|
||||
|
||||
// ltcdiff *= vec3(1.0, 1.0 - sinval, 1.0 - sinval);
|
||||
|
||||
// vec3 ltccol = ltcspec + ltcdiff * albedo;
|
||||
// ltccol /= 2.0*PI;
|
||||
// // outColor.rgb = ltccol * 12.0 * visibility + (indirect / 14.0 * ao);
|
||||
// outColor.rgb = ltccol * visibility + (indirect / 2.0 * ao);
|
||||
// outColor.rgb = ltccol * 5.0 * visibility + (indirect / 14.0 * ao * (rectSizeX / 6.0) );
|
||||
// // outColor.rgb = ltccol * visibility + (indirect / 2.0 * ao);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -52,12 +52,17 @@
|
|||
{
|
||||
"id": "sltcMat",
|
||||
"link": "_ltcMat",
|
||||
"ifdef": ["_PolyLight"]
|
||||
"ifdef": ["PolyLight"]
|
||||
},
|
||||
{
|
||||
"id": "sltcMag",
|
||||
"link": "_ltcMag",
|
||||
"ifdef": ["_PolyLight"]
|
||||
"ifdef": ["PolyLight"]
|
||||
},
|
||||
{
|
||||
"id": "time",
|
||||
"link": "_time",
|
||||
"ifdef": ["PolyLight"]
|
||||
}
|
||||
],
|
||||
"vertex_shader": "deferred_light.vert.glsl",
|
||||
|
|
|
@ -358,10 +358,10 @@ float godRays(vec2 uv) {
|
|||
void main() {
|
||||
// vec4 g0 = texture(gbuffer0, texCoord); // Normal.xy, mask
|
||||
// float gdepth = 1.0 - g0.a;
|
||||
float gdepth = texture(gbufferD, texCoord) * 2.0 - 1.0;
|
||||
float gdepth = texture(gbufferD, texCoord).r * 2.0 - 1.0;
|
||||
vec4 colorOriginal = texture(tex, texCoord);
|
||||
// if (gdepth == 0.0) {
|
||||
if (gdepth == 1.0) {
|
||||
if (gdepth == 0.0) {
|
||||
// if (gdepth == 1.0) {
|
||||
gl_FragColor = colorOriginal;
|
||||
return;
|
||||
}
|
||||
|
@ -395,8 +395,8 @@ void main() {
|
|||
// float epsx = clamp(dot(dist/2.0,dist/2.0) * 0.001, 0.01, 0.1);
|
||||
|
||||
float dist = max(0.1, length(surfacePoint - eye) * 1.2);
|
||||
// float epsx = dot(dist,dist) * 0.001;
|
||||
float epsx = dot(dist,dist) * 0.0008;
|
||||
float epsx = dot(dist,dist) * 0.0001;
|
||||
// float epsx = dot(dist,dist) * 0.0008;
|
||||
vec3 normal = getNormal(surfacePoint, epsx);
|
||||
|
||||
// vec3 normal = getNormal(surfacePoint, 0.1);
|
||||
|
|
Loading…
Reference in a new issue