From 60cec91731a350fe67e9b5ffe7a00d70e9026314 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Thu, 22 Aug 2019 22:45:00 -0400
Subject: [PATCH] Min shader.
---
ObjEditor.java | 2
CameraPane.java | 36 ++++++++++-------
Camera.java | 10 ++++
GroupEditor.java | 24 ++++++------
Checker.java | 2
cMaterial.java | 4 +-
Object3D.java | 19 ++++-----
7 files changed, 54 insertions(+), 43 deletions(-)
diff --git a/Camera.java b/Camera.java
index 4a67693..ecdc609 100644
--- a/Camera.java
+++ b/Camera.java
@@ -71,7 +71,7 @@
perspective = false;
break;
case 4: // Default light
- location = LA.newVector(-5, 20, 10);
+ location = LA.newVector(-5, 15, 10);
perspective = false;
break;
}
@@ -106,6 +106,14 @@
background = LA.newVector(0.8, 0.8, 0.8);
}
+ void CreateMaterial(boolean multiply)
+ {
+ super.CreateMaterial(multiply);
+
+ material.shift = 90;
+ material.cameralight = 0.2f;
+ }
+
void setAspect(int width, int height)
{
//hAspect = width;
diff --git a/CameraPane.java b/CameraPane.java
index c9b2423..4956fe0 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -881,7 +881,7 @@
//// tris.postdraw(this);
}
- static Camera localcamera = new Camera();
+ static Camera localAOcamera = new Camera();
static cVector from = new cVector();
static cVector to = new cVector();
@@ -890,7 +890,7 @@
CameraPane cp = this;
Camera keep = cp.RenderCamera();
- cp.renderCamera = localcamera;
+ cp.renderCamera = localAOcamera;
if (br.trimmed)
{
@@ -908,7 +908,7 @@
br.positions[i3 + 2] + br.normals[i3 + 2]);
LA.xformPos(from, transform, from);
LA.xformPos(to, transform, to); // RIGID ONLY
- localcamera.setAim(from, to);
+ localAOcamera.setAim(from, to);
CameraPane.occlusionbuffer.display();
@@ -942,7 +942,7 @@
to.set(v.x+v.norm.x, v.y+v.norm.y, v.z+v.norm.z);
LA.xformPos(from, transform, from);
LA.xformPos(to, transform, to); // RIGID ONLY
- localcamera.setAim(from, to);
+ localAOcamera.setAim(from, to);
CameraPane.occlusionbuffer.display();
@@ -12514,8 +12514,9 @@
String programmin =
// Min shader
"!!ARBfp1.0\n" +
- "PARAM zero123 = { 0.0, 1.0, 2, 1.25 };" +
- "PARAM pow2 = { 0.5, 0.25, 0.125, 0.0 };" +
+ "PARAM zero12t = { 0.0, 1.0, 2, 1.25 };" +
+ "PARAM pow_2 = { 0.5, 0.25, 0.125, 0.0 };" +
+ "PARAM pow2 = { 2, 4, 8, 0.0 };" +
"PARAM one = { 1.0, 1.0, 1.0, 1.0 };" +
"PARAM eps = { 0.001, 0.001, 0.001, 1.0 };" +
"PARAM infinity = { 100000000, 100000000, 100000000, 1.0 };" +
@@ -12530,10 +12531,11 @@
"TEMP eye;" +
"TEMP pos;" +
- "MAD normal, fragment.color, zero123.z, -zero123.y;" +
+ "MAD normal, fragment.color, zero12t.z, -zero12t.y;" +
Normalize("normal") +
"MOV light, state.light[0].position;" +
"DP3 ndotl.x, light, normal;" +
+ "MAX ndotl.x, ndotl.x, zero12t.x;" +
// shadow
"MOV pos, fragment.texcoord[1];" +
@@ -12549,7 +12551,7 @@
"MUL ndotl.x, ndotl.x, ndotl.z;" + // Shadow
// Backlit
- "MOV pos.w, zero123.y;" +
+ "MOV pos.w, zero12t.y;" + // one
"DP4 eye.x, pos, light2cam0;" +
"DP4 eye.y, pos, light2cam1;" +
"DP4 eye.z, pos, light2cam2;" +
@@ -12557,24 +12559,28 @@
"DP3 ndotl.y, -eye, normal;" +
//"MUL ndotl.y, ndotl.y, pow2.x;" +
- "POW ndotl.y, ndotl.y, pow2.z;" + // backlit
- "SUB ndotl.y, zero123.y, ndotl.y;" +
+ "POW ndotl.y, ndotl.y, pow2.x;" + // backlit
+ "SUB ndotl.y, zero12t.y, ndotl.y;" + // 1 - y
+ //"POW ndotl.y, ndotl.y, pow2.z;" + // backlit
//"SUB ndotl.y, zero123.y, ndotl.y;" +
//"MUL ndotl.y, ndotl.y, pow2.z;" +
+ "ADD ndotl.y, ndotl.y, one.x;" +
+ "MUL ndotl.y, ndotl.y, pow_2.x;" +
//"MAX ndotl.x, ndotl.x, ndotl.y;" + // Ambient
//"MAX ndotl.x, ndotl.x, pow2.y;" + // Ambient
// Pigment
"TEX temp, fragment.texcoord[0], texture[0], 2D;" +
- "LRP temp, zero123.w, temp, one;" + // texture proportion
- "MUL temp, temp, ndotl.x;" +
-
- "MUL temp, temp, zero123.z;" +
+ "LRP temp, zero12t.w, temp, one;" + // texture proportion
+ "MUL temp, temp, zero12t.w;" + // Times x
//"MUL temp, temp, ndotl.y;" +
+ "MAD ndotl.x, pow_2.xxxx, ndotl.yyyy, ndotl.x;" +
- "MOV temp.w, zero123.y;" + // reset alpha
+ "MUL temp, temp, ndotl.x;" + // lambert
+
+ "MOV temp.w, zero12t.y;" + // reset alpha
"MOV result.color, temp;" +
"END";
diff --git a/Checker.java b/Checker.java
index 06f161e..3c6ffdf 100644
--- a/Checker.java
+++ b/Checker.java
@@ -15,7 +15,7 @@
material.specular = 0.001f;
material.diffuse = 0.01f;
material.cameralight = 0.001f;
- material.opacity = 0.5f;
+ material.opacity = 0.25f;
flipV = true;
}
diff --git a/GroupEditor.java b/GroupEditor.java
index 8d5ddbb..83301a6 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -2129,24 +2129,24 @@
switch(axis)
{
case 0 :
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
norm = cVector.X;
break;
case 1 :
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
norm = cVector.Y;
break;
case 2 :
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
norm = cVector.Z;
break;
}
diff --git a/ObjEditor.java b/ObjEditor.java
index 83bebe7..63acad8 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -1767,7 +1767,7 @@
scrollpane.addMouseWheelListener(this); // Default not fast enough
/*JTabbedPane*/ scenePanel = new cGridBag();
- scenePanel.preferredWidth = 6;
+ scenePanel.preferredWidth = 5;
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.add(scrollpane);
diff --git a/Object3D.java b/Object3D.java
index 5df575e..3c575b0 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -687,7 +687,7 @@
{
if (maxcount != 1)
{
- new Exception().printStackTrace();
+ //new Exception().printStackTrace();
}
toParentMarked = LA.newMatrix();
@@ -2369,11 +2369,6 @@
InitOthers();
- if (this instanceof Camera)
- {
- material.shift = 90;
- }
-
material.multiply = multiply;
if (multiply)
@@ -7716,7 +7711,9 @@
scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
- if (modified || opposite)
+ // Modified could snap
+ if (//modified ||
+ opposite)
{
//assert(false);
/*
@@ -7810,7 +7807,7 @@
if (modified)
{
- // Rotate 90 degrees
+ // Rotate 45 degrees
angle /= (Math.PI / 4);
angle = Math.floor(angle + 0.5);
angle *= (Math.PI / 4);
@@ -7896,7 +7893,7 @@
case 3: // '\001'
if (modified || opposite)
{
- if (modified && opposite)
+ if (modified) // && opposite)
LA.matScale(toParent, totalScale, totalScale, totalScale);
else
//LA.matScale(toParent, 1, hScale, vScale);
@@ -7912,7 +7909,7 @@
case 2: // '\002'
if (modified || opposite)
{
- if (modified && opposite)
+ if (modified) // && opposite)
LA.matScale(toParent, totalScale, totalScale, totalScale);
else
//LA.matScale(toParent, hScale, 1, vScale);
@@ -7926,7 +7923,7 @@
case 1: // '\003'
if (modified || opposite)
{
- if (modified && opposite)
+ if (modified) // && opposite)
LA.matScale(toParent, totalScale, totalScale, totalScale);
else
//LA.matScale(toParent, hScale, vScale, 1);
diff --git a/cMaterial.java b/cMaterial.java
index 7f5463d..c84b510 100644
--- a/cMaterial.java
+++ b/cMaterial.java
@@ -362,10 +362,10 @@
// }
float color = 0.5f, modulation /*SATURATION*/ = 0.001f, metalness = 0.001f;
- float diffuse = 0.75f, specular = 0.25f, shininess = 0.75f, shift = 1;
+ float diffuse = 1f, specular = 0.25f, shininess = 0.75f, shift = 1;
float ambient = 0.001f, lightarea = 0.025f, factor = 0.001f, velvet = 0.001f;
float sheen = 1f, subsurface = 0.001f, bump = 0.75f, aniso = 0.001f, anisoV = 0.001f;
- float cameralight = 0.3f, diffuseness = 0.001f, shadow = 5f, texture = 1f, opacity = 1;
+ float cameralight = 0.5f, diffuseness = 0.001f, shadow = 5f, texture = 1f, opacity = 1;
float fakedepth = 0.5f, shadowbias = 0.01f; // 0.001f;
float parallax = 0;
--
Gitblit v1.6.2