.. | .. |
---|
40 | 40 | |
---|
41 | 41 | ScriptNode scriptnode; |
---|
42 | 42 | |
---|
| 43 | + int VersionCount() |
---|
| 44 | + { |
---|
| 45 | + int count = 0; |
---|
| 46 | + |
---|
| 47 | + for (int i = versionlist.length; --i >= 0;) |
---|
| 48 | + { |
---|
| 49 | + if (versionlist[i] != null) |
---|
| 50 | + count++; |
---|
| 51 | + } |
---|
| 52 | + |
---|
| 53 | + return count; |
---|
| 54 | + } |
---|
| 55 | + |
---|
43 | 56 | void InitOthers() |
---|
44 | 57 | { |
---|
45 | 58 | if (projectedVertices == null || projectedVertices.length <= 2) |
---|
.. | .. |
---|
568 | 581 | } |
---|
569 | 582 | } |
---|
570 | 583 | |
---|
571 | | - int memorysize; |
---|
| 584 | + transient int memorysize; // needs to be transient, dunno why |
---|
572 | 585 | |
---|
573 | 586 | int MemorySize() |
---|
574 | 587 | { |
---|
575 | | - if (true) // memorysize == 0) |
---|
| 588 | + if (memorysize == 0) |
---|
576 | 589 | { |
---|
577 | 590 | try |
---|
578 | 591 | { |
---|
.. | .. |
---|
3264 | 3277 | blockloop = false; |
---|
3265 | 3278 | } |
---|
3266 | 3279 | |
---|
| 3280 | + public void ResetTransform(int mask) |
---|
| 3281 | + { |
---|
| 3282 | + Object3D obj = this; |
---|
| 3283 | + |
---|
| 3284 | + if (mask == -1) |
---|
| 3285 | + { |
---|
| 3286 | + if (obj instanceof Camera) // jan 2014 |
---|
| 3287 | + { |
---|
| 3288 | + LA.matIdentity(obj.toParent); |
---|
| 3289 | + LA.matIdentity(obj.fromParent); |
---|
| 3290 | + } |
---|
| 3291 | + else |
---|
| 3292 | + { |
---|
| 3293 | + obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent); |
---|
| 3294 | + obj.fromParent = null; // LA.matIdentity(obj.fromParent); |
---|
| 3295 | + } |
---|
| 3296 | + return; |
---|
| 3297 | + } |
---|
| 3298 | + |
---|
| 3299 | + if ((mask&2) != 0) // Scale/rotation |
---|
| 3300 | + { |
---|
| 3301 | + obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; |
---|
| 3302 | + obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
| 3303 | + obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; |
---|
| 3304 | + obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; |
---|
| 3305 | + obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
| 3306 | + obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
| 3307 | + } |
---|
| 3308 | + if ((mask&1) != 0) // Translation |
---|
| 3309 | + { |
---|
| 3310 | + if (obj.toParent != null) |
---|
| 3311 | + { |
---|
| 3312 | + obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0; |
---|
| 3313 | + obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0; |
---|
| 3314 | + } |
---|
| 3315 | + } |
---|
| 3316 | + } |
---|
| 3317 | + |
---|
| 3318 | + public void TextureRatioTransform(int axis) |
---|
| 3319 | + { |
---|
| 3320 | + cTexture tex = GetTextures(); |
---|
| 3321 | + |
---|
| 3322 | + com.sun.opengl.util.texture.TextureData texturedata = null; |
---|
| 3323 | + |
---|
| 3324 | + try |
---|
| 3325 | + { |
---|
| 3326 | + texturedata = Globals.theRenderer.GetTextureData(tex, false, texres); |
---|
| 3327 | + } |
---|
| 3328 | + catch (Exception e) |
---|
| 3329 | + { |
---|
| 3330 | + System.err.println("FAIL TextureRatio: " + this); |
---|
| 3331 | + } |
---|
| 3332 | + |
---|
| 3333 | + LA.matIdentity(Object3D.mat); |
---|
| 3334 | + Object3D.mat[axis][axis] = (double)texturedata.getWidth() / texturedata.getHeight(); |
---|
| 3335 | + |
---|
| 3336 | + if (toParent == null) |
---|
| 3337 | + { |
---|
| 3338 | + toParent = LA.newMatrix(); |
---|
| 3339 | + fromParent = LA.newMatrix(); |
---|
| 3340 | + } |
---|
| 3341 | + |
---|
| 3342 | + ResetTransform(2); |
---|
| 3343 | + |
---|
| 3344 | + LA.matConcat(Object3D.mat, fromParent, fromParent); |
---|
| 3345 | + LA.matInvert(fromParent, toParent); |
---|
| 3346 | + } |
---|
| 3347 | + |
---|
| 3348 | + void TextureRatio(int axis) |
---|
| 3349 | + { |
---|
| 3350 | + if (blockloop) |
---|
| 3351 | + return; |
---|
| 3352 | + |
---|
| 3353 | + blockloop = true; |
---|
| 3354 | + |
---|
| 3355 | + TextureRatioTransform(axis); |
---|
| 3356 | + |
---|
| 3357 | + for (int i=Size(); --i>=0;) |
---|
| 3358 | + { |
---|
| 3359 | + Object3D v = get(i); |
---|
| 3360 | + |
---|
| 3361 | + v.TextureRatio(axis); |
---|
| 3362 | + } |
---|
| 3363 | + |
---|
| 3364 | + blockloop = false; |
---|
| 3365 | + } |
---|
| 3366 | + |
---|
3267 | 3367 | void TransformChildren() |
---|
3268 | 3368 | { |
---|
3269 | 3369 | if (toParent != null) |
---|
.. | .. |
---|
5969 | 6069 | return parent.IsLive(); |
---|
5970 | 6070 | } |
---|
5971 | 6071 | |
---|
| 6072 | + boolean IsDynamic() |
---|
| 6073 | + { |
---|
| 6074 | + return live && bRep != null; |
---|
| 6075 | + } |
---|
| 6076 | + |
---|
5972 | 6077 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5973 | 6078 | { |
---|
5974 | 6079 | Invariants(); // june 2013 |
---|
.. | .. |
---|
6029 | 6134 | if (support != null) |
---|
6030 | 6135 | support = support; |
---|
6031 | 6136 | |
---|
6032 | | - boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6137 | + boolean usecalllists = !IsDynamic() && |
---|
| 6138 | + IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
6033 | 6139 | //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
6034 | 6140 | |
---|
6035 | 6141 | //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
.. | .. |
---|
8075 | 8181 | } // + super.toString(); |
---|
8076 | 8182 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
8077 | 8183 | |
---|
8078 | | - if (!Globals.ADVANCED) |
---|
8079 | | - return objname; |
---|
| 8184 | +// if (!Globals.ADVANCED) |
---|
| 8185 | +// return objname; |
---|
8080 | 8186 | |
---|
8081 | | - return objname + " " + System.identityHashCode(this); |
---|
| 8187 | + return objname + " " + System.identityHashCode(this); // + GetUUID() |
---|
8082 | 8188 | } |
---|
8083 | 8189 | |
---|
8084 | 8190 | public int hashCode() |
---|