.. | .. |
---|
41 | 41 | |
---|
42 | 42 | java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
43 | 43 | |
---|
| 44 | + int tabIndex; |
---|
| 45 | + |
---|
44 | 46 | ScriptNode scriptnode; |
---|
45 | 47 | |
---|
46 | 48 | void deepCopyNode(Object3D other) |
---|
.. | .. |
---|
100 | 102 | other.softtouched = softtouched; |
---|
101 | 103 | |
---|
102 | 104 | other.random = random; |
---|
103 | | - other.link2master = link2master; |
---|
| 105 | + other.link2master = Link2Support(); |
---|
104 | 106 | other.transformcount = transformcount; |
---|
105 | 107 | other.marked = marked; |
---|
106 | 108 | other.skip = skip; |
---|
.. | .. |
---|
220 | 222 | return; |
---|
221 | 223 | |
---|
222 | 224 | transientsupport = support; |
---|
223 | | - transientlink2master = link2master; |
---|
| 225 | + transientlink2master = Link2Support(); |
---|
224 | 226 | |
---|
225 | 227 | support = null; |
---|
226 | 228 | link2master = false; |
---|
.. | .. |
---|
633 | 635 | transient boolean keepdontselect; |
---|
634 | 636 | boolean dontselect = false; |
---|
635 | 637 | boolean hide = false; |
---|
636 | | - boolean link2master = false; // performs reset support/master at each frame |
---|
| 638 | + |
---|
| 639 | + boolean link2master = false; // performs reset support/master at each frame (cannot rename due to serialization) |
---|
| 640 | + boolean link2support = false; // (cannot rename due to serialization) |
---|
| 641 | + |
---|
637 | 642 | boolean marked = false; // animation node |
---|
638 | 643 | boolean skip = false; // centroid issue |
---|
639 | 644 | boolean skipmocap = false; // mocap data |
---|
.. | .. |
---|
1023 | 1028 | |
---|
1024 | 1029 | void Step() |
---|
1025 | 1030 | { |
---|
1026 | | - // marde pour serialization de Texture |
---|
| 1031 | + // patch pour serialization de Texture |
---|
1027 | 1032 | resetmaxcount(); |
---|
1028 | 1033 | resettransformcount(); |
---|
1029 | 1034 | resetstep(); |
---|
.. | .. |
---|
4101 | 4106 | Step(); |
---|
4102 | 4107 | Touch(); |
---|
4103 | 4108 | |
---|
4104 | | - StepRecur(); |
---|
4105 | | - } |
---|
4106 | | - |
---|
4107 | | - void StepRecur() |
---|
4108 | | - { |
---|
4109 | 4109 | for (int i = 0; i < size(); i++) |
---|
4110 | 4110 | { |
---|
4111 | 4111 | Object3D child = (Object3D) get(i); // reserve(i); |
---|
.. | .. |
---|
6159 | 6159 | boolean NeedSupport() |
---|
6160 | 6160 | { |
---|
6161 | 6161 | return |
---|
6162 | | - CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
| 6162 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && Link2Support() && /*live &&*/ support != null |
---|
6163 | 6163 | // PROBLEM with CROWD!! |
---|
6164 | 6164 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
6165 | 6165 | } |
---|
.. | .. |
---|
6182 | 6182 | return live && bRep != null; |
---|
6183 | 6183 | } |
---|
6184 | 6184 | |
---|
| 6185 | + boolean Link2Support() |
---|
| 6186 | + { |
---|
| 6187 | + return link2master || link2support; |
---|
| 6188 | + } |
---|
| 6189 | + |
---|
| 6190 | + static cVector minima = new cVector(); |
---|
| 6191 | + static cVector maxima = new cVector(); |
---|
| 6192 | + static javax.vecmath.Point3d center = new javax.vecmath.Point3d(); |
---|
| 6193 | + |
---|
6185 | 6194 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
6186 | 6195 | { |
---|
6187 | 6196 | Invariants(); // june 2013 |
---|
.. | .. |
---|
6189 | 6198 | if (support != null) |
---|
6190 | 6199 | { |
---|
6191 | 6200 | // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); |
---|
| 6201 | + } |
---|
| 6202 | + |
---|
| 6203 | + if (live && Link2Support() && support == null && !this.marked) // project on ground |
---|
| 6204 | + { |
---|
| 6205 | + getBounds(minima, maxima, true); |
---|
| 6206 | + center.x = (minima.x + maxima.x) / 2; |
---|
| 6207 | + center.y = 10000; // (minima.y + maxima.y) / 2; |
---|
| 6208 | + center.z = (minima.z + maxima.z) / 2; |
---|
| 6209 | + |
---|
| 6210 | + Ray ray = new Ray(center, new Vector3d(0,-1,0)); |
---|
| 6211 | + |
---|
| 6212 | + IntersectResult res = new IntersectResult(); |
---|
| 6213 | + res.t = Double.POSITIVE_INFINITY; |
---|
| 6214 | + |
---|
| 6215 | + if (Grafreed.grafreed.universe.intersect(ray, res)) |
---|
| 6216 | + { |
---|
| 6217 | + double resx = ray.eyePoint.x + ray.viewDirection.x * res.t; |
---|
| 6218 | + double resy = ray.eyePoint.y + ray.viewDirection.y * res.t; |
---|
| 6219 | + double resz = ray.eyePoint.z + ray.viewDirection.z * res.t; |
---|
| 6220 | + |
---|
| 6221 | + LA.matTranslate(toParent, 0, resy - minima.y, 0); |
---|
| 6222 | + LA.matInvert(toParent, fromParent); |
---|
| 6223 | + } |
---|
6192 | 6224 | } |
---|
6193 | 6225 | |
---|
6194 | 6226 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
.. | .. |
---|
6243 | 6275 | support = support; |
---|
6244 | 6276 | |
---|
6245 | 6277 | boolean usecalllists = !IsDynamic() && |
---|
6246 | | - IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6278 | + IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !Link2Support()); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
6247 | 6279 | //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
6248 | 6280 | |
---|
6249 | 6281 | //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
.. | .. |
---|
6254 | 6286 | bRep.displaylist = 0; |
---|
6255 | 6287 | } |
---|
6256 | 6288 | // usecalllists &= !(parent instanceof RandomNode); |
---|
6257 | | - // usecalllists = false; |
---|
| 6289 | + if (CameraPane.BOXMODE) // Too dynamic |
---|
| 6290 | + usecalllists = false; |
---|
6258 | 6291 | |
---|
6259 | 6292 | if (display.DrawMode() == display.SHADOW) |
---|
6260 | 6293 | //GetBRep() != null) |
---|
.. | .. |
---|
6350 | 6383 | { |
---|
6351 | 6384 | if (display.DrawMode() == iCameraPane.SHADOW) |
---|
6352 | 6385 | { |
---|
6353 | | - if (!link2master // tricky to cull in shadow mode. |
---|
| 6386 | + if (!Link2Support() // tricky to cull in shadow mode. |
---|
6354 | 6387 | && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
6355 | 6388 | { |
---|
6356 | 6389 | //System.out.print("CULLED"); |
---|
.. | .. |
---|
6823 | 6856 | |
---|
6824 | 6857 | //javax.media.opengl.GL gl = display.GetGL(); |
---|
6825 | 6858 | |
---|
6826 | | - if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
| 6859 | + if (CameraPane.BOXMODE && !Link2Support()) //selected) // || CameraPane.movingcamera) |
---|
6827 | 6860 | { |
---|
6828 | 6861 | int fc = bRep.FaceCount(); |
---|
6829 | 6862 | int vc = bRep.VertexCount(); |
---|
.. | .. |
---|
6985 | 7018 | facescompare[k] = new FaceCompare(k); |
---|
6986 | 7019 | } |
---|
6987 | 7020 | |
---|
6988 | | - center = new cVector(); |
---|
| 7021 | + centertriangle = new cVector(); |
---|
6989 | 7022 | } |
---|
6990 | 7023 | else |
---|
6991 | 7024 | { |
---|
.. | .. |
---|
7108 | 7141 | */ |
---|
7109 | 7142 | } |
---|
7110 | 7143 | |
---|
7111 | | - transient cVector center; |
---|
| 7144 | + transient cVector centertriangle; |
---|
7112 | 7145 | |
---|
7113 | 7146 | class FaceCompare implements Comparable |
---|
7114 | 7147 | { |
---|
.. | .. |
---|
7137 | 7170 | Vertex q = bRep.GetVertex(face.q); |
---|
7138 | 7171 | Vertex r = bRep.GetVertex(face.r); |
---|
7139 | 7172 | |
---|
7140 | | - center.set(p); |
---|
7141 | | - center.add(q); |
---|
7142 | | - center.add(r); |
---|
7143 | | - center.mul(1.0/3); |
---|
| 7173 | + centertriangle.set(p); |
---|
| 7174 | + centertriangle.add(q); |
---|
| 7175 | + centertriangle.add(r); |
---|
| 7176 | + centertriangle.mul(1.0/3); |
---|
7144 | 7177 | |
---|
7145 | | - center.sub(Globals.theRenderer.EyeCamera().location); |
---|
| 7178 | + centertriangle.sub(Globals.theRenderer.EyeCamera().location); |
---|
7146 | 7179 | |
---|
7147 | | - distance = center.dot(center); |
---|
| 7180 | + distance = centertriangle.dot(centertriangle); |
---|
7148 | 7181 | } |
---|
7149 | 7182 | |
---|
7150 | 7183 | return distance; |
---|
.. | .. |
---|
8327 | 8360 | |
---|
8328 | 8361 | public int hashCode() |
---|
8329 | 8362 | { |
---|
8330 | | - // Fuck Vector... |
---|
| 8363 | + // Do not use Vector... |
---|
8331 | 8364 | return System.identityHashCode(this); |
---|
8332 | 8365 | } |
---|
8333 | 8366 | |
---|
.. | .. |
---|
8869 | 8902 | double diry = ray.viewDirection.y; |
---|
8870 | 8903 | double dirz = ray.viewDirection.z; |
---|
8871 | 8904 | |
---|
8872 | | - if (this.fromParent != null) |
---|
| 8905 | + if (this.fromParent != null && !(this instanceof TextureNode)) |
---|
8873 | 8906 | { |
---|
8874 | 8907 | eye.x = eyex; |
---|
8875 | 8908 | eye.y = eyey; |
---|
.. | .. |
---|
8894 | 8927 | |
---|
8895 | 8928 | boolean touch = false; |
---|
8896 | 8929 | |
---|
8897 | | - if (bRep != null) |
---|
| 8930 | + if (bRep != null && Link2Support()) |
---|
8898 | 8931 | { |
---|
8899 | 8932 | if (bbox == null) |
---|
8900 | 8933 | { |
---|
.. | .. |
---|
8903 | 8936 | cVector min = new cVector(); |
---|
8904 | 8937 | cVector max = new cVector(); |
---|
8905 | 8938 | |
---|
8906 | | - this.getBounds(min, max, false); |
---|
| 8939 | + this.getBounds(min, max, true); |
---|
8907 | 8940 | |
---|
8908 | 8941 | bbox.min.x = min.x; |
---|
8909 | 8942 | bbox.min.y = min.y; |
---|
.. | .. |
---|
8914 | 8947 | bbox.max.z = max.z; |
---|
8915 | 8948 | } |
---|
8916 | 8949 | |
---|
8917 | | - if (bbox.intersect(ray, result)) |
---|
| 8950 | + if (true) // NOT WORKING bbox.intersect(ray, result)) |
---|
8918 | 8951 | { |
---|
8919 | 8952 | success |= intersectMesh(ray, result); |
---|
8920 | 8953 | } |
---|
.. | .. |
---|
8958 | 8991 | |
---|
8959 | 8992 | private boolean intersectTriangle(Ray ray, IntersectResult result, Vertex v1, Vertex v2, Vertex v3) |
---|
8960 | 8993 | { |
---|
| 8994 | + if (false) |
---|
| 8995 | + { |
---|
| 8996 | + result.t = 0; |
---|
| 8997 | + return true; |
---|
| 8998 | + } |
---|
| 8999 | + |
---|
8961 | 9000 | /* |
---|
8962 | 9001 | Fast, Minimum Storage Ray/Triangle Intersection, Moller et al. |
---|
8963 | 9002 | |
---|