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