.. | .. |
---|
464 | 464 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
465 | 465 | { |
---|
466 | 466 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
467 | | - boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
| 467 | + boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0) |
---|
| 468 | + // TEST LIVE NORMALS && !obj.dontselect |
---|
| 469 | + ; |
---|
468 | 470 | if (!hasnorm) |
---|
469 | 471 | { |
---|
470 | | - // System.out.println("FUCK!!"); |
---|
| 472 | + // System.out.println("Mesh normal"); |
---|
471 | 473 | LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0); |
---|
472 | 474 | LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); |
---|
473 | 475 | LA.vecCross(obj.v0, obj.v1, obj.v2); |
---|
.. | .. |
---|
1192 | 1194 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1193 | 1195 | } |
---|
1194 | 1196 | } |
---|
| 1197 | + |
---|
1195 | 1198 | if (flipV) |
---|
1196 | 1199 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1197 | 1200 | else |
---|
1198 | 1201 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1202 | + |
---|
1199 | 1203 | //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1200 | 1204 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1201 | 1205 | |
---|
.. | .. |
---|
1215 | 1219 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1216 | 1220 | } |
---|
1217 | 1221 | } |
---|
| 1222 | + |
---|
1218 | 1223 | if (flipV) |
---|
1219 | 1224 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1220 | 1225 | else |
---|
1221 | 1226 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1227 | + |
---|
1222 | 1228 | //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1223 | 1229 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1224 | 1230 | |
---|
.. | .. |
---|
1246 | 1252 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1247 | 1253 | else |
---|
1248 | 1254 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1255 | + |
---|
1249 | 1256 | //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
1250 | 1257 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1258 | + |
---|
1251 | 1259 | count2 += 2; |
---|
1252 | 1260 | count3 += 3; |
---|
1253 | 1261 | } |
---|
.. | .. |
---|
7921 | 7929 | ReleaseTexture(pigment, false); |
---|
7922 | 7930 | } |
---|
7923 | 7931 | |
---|
| 7932 | + public void ReleasePigmentTexture(cTexture tex) // INTERFACE |
---|
| 7933 | + { |
---|
| 7934 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7935 | + { |
---|
| 7936 | + return; |
---|
| 7937 | + } |
---|
| 7938 | + |
---|
| 7939 | + if (tex == null) |
---|
| 7940 | + { |
---|
| 7941 | + ReleaseTexture(null, false); |
---|
| 7942 | + return; |
---|
| 7943 | + } |
---|
| 7944 | + |
---|
| 7945 | + String pigment = Object3D.GetPigment(tex); |
---|
| 7946 | + |
---|
| 7947 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7948 | + { |
---|
| 7949 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7950 | + // System.out.println("; bump = " + bump); |
---|
| 7951 | + } |
---|
| 7952 | + |
---|
| 7953 | + if (pigment.equals("")) |
---|
| 7954 | + { |
---|
| 7955 | + pigment = null; |
---|
| 7956 | + } |
---|
| 7957 | + |
---|
| 7958 | + ReleaseTexture(pigment, false); |
---|
| 7959 | + } |
---|
| 7960 | + |
---|
| 7961 | + public void ReleaseBumpTexture(cTexture tex) // INTERFACE |
---|
| 7962 | + { |
---|
| 7963 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7964 | + { |
---|
| 7965 | + return; |
---|
| 7966 | + } |
---|
| 7967 | + |
---|
| 7968 | + if (tex == null) |
---|
| 7969 | + { |
---|
| 7970 | + ReleaseTexture(null, true); |
---|
| 7971 | + return; |
---|
| 7972 | + } |
---|
| 7973 | + |
---|
| 7974 | + String bump = Object3D.GetBump(tex); |
---|
| 7975 | + |
---|
| 7976 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7977 | + { |
---|
| 7978 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7979 | + // System.out.println("; bump = " + bump); |
---|
| 7980 | + } |
---|
| 7981 | + |
---|
| 7982 | + if (bump.equals("")) |
---|
| 7983 | + { |
---|
| 7984 | + bump = null; |
---|
| 7985 | + } |
---|
| 7986 | + |
---|
| 7987 | + ReleaseTexture(bump, true); |
---|
| 7988 | + } |
---|
| 7989 | + |
---|
7924 | 7990 | void ReleaseTexture(String tex, boolean bump) |
---|
7925 | 7991 | { |
---|
7926 | 7992 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
.. | .. |
---|
8069 | 8135 | return; // true; |
---|
8070 | 8136 | } |
---|
8071 | 8137 | |
---|
| 8138 | + /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8139 | + { |
---|
| 8140 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8141 | + ambientOcclusion ) // || !textureon) |
---|
| 8142 | + { |
---|
| 8143 | + return; // false; |
---|
| 8144 | + } |
---|
| 8145 | + |
---|
| 8146 | + if (tex == null) |
---|
| 8147 | + { |
---|
| 8148 | + BindTexture(null,false,resolution); |
---|
| 8149 | + return; |
---|
| 8150 | + } |
---|
| 8151 | + |
---|
| 8152 | + String pigment = Object3D.GetPigment(tex); |
---|
| 8153 | + |
---|
| 8154 | + usedtextures.put(pigment, pigment); |
---|
| 8155 | + |
---|
| 8156 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8157 | + { |
---|
| 8158 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8159 | + // System.out.println("; bump = " + bump); |
---|
| 8160 | + } |
---|
| 8161 | + |
---|
| 8162 | + if (pigment.equals("")) |
---|
| 8163 | + { |
---|
| 8164 | + pigment = null; |
---|
| 8165 | + } |
---|
| 8166 | + |
---|
| 8167 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8168 | + BindTexture(pigment, false, resolution); |
---|
| 8169 | + } |
---|
| 8170 | + |
---|
| 8171 | + /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8172 | + { |
---|
| 8173 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8174 | + ambientOcclusion ) // || !textureon) |
---|
| 8175 | + { |
---|
| 8176 | + return; // false; |
---|
| 8177 | + } |
---|
| 8178 | + |
---|
| 8179 | + if (tex == null) |
---|
| 8180 | + { |
---|
| 8181 | + BindTexture(null,true,resolution); |
---|
| 8182 | + return; |
---|
| 8183 | + } |
---|
| 8184 | + |
---|
| 8185 | + String bump = Object3D.GetBump(tex); |
---|
| 8186 | + |
---|
| 8187 | + usedtextures.put(bump, bump); |
---|
| 8188 | + |
---|
| 8189 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8190 | + { |
---|
| 8191 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8192 | + // System.out.println("; bump = " + bump); |
---|
| 8193 | + } |
---|
| 8194 | + |
---|
| 8195 | + if (bump.equals("")) |
---|
| 8196 | + { |
---|
| 8197 | + bump = null; |
---|
| 8198 | + } |
---|
| 8199 | + |
---|
| 8200 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
| 8201 | + BindTexture(bump, true, resolution); |
---|
| 8202 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8203 | + } |
---|
| 8204 | + |
---|
8072 | 8205 | java.util.HashSet<String> missingTextures = new java.util.HashSet<String>(); |
---|
8073 | 8206 | |
---|
8074 | 8207 | private boolean FileExists(String tex) |
---|