- Timestamp:
- 06/01/08 17:49:45 (6 months ago)
- Files:
-
- trunk/bin/yage3d.exe (modified) (previous)
- trunk/proj/buildme.d (modified) (1 diff)
- trunk/src/demo1/main.d (modified) (1 diff)
- trunk/src/yage/core/tree.d (modified) (5 diffs)
- trunk/src/yage/node/model.d (modified) (1 diff)
- trunk/src/yage/node/node.d (modified) (1 diff)
- trunk/src/yage/node/visible.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/proj/buildme.d
r63 r72 10 10 * This script can either use precompiled derelict libraries in the lib folder 11 11 * or build the derelict source directly with the engine. The former is 12 * of course faster, but the latter can be achieved by setting ign_path and 13 * lib_path to empty strings in the compilation options below. 12 * of course faster, but the latter can be achieved by setting 13 * lib_path to empty string and adding ../src/derelict to the src_path 14 * in the compilation options below. 14 15 * 15 16 * This script can easily be expanded to compile and generate docs for most trunk/src/demo1/main.d
r71 r72 119 119 planet.setAngularVelocity(Vec3f(0, -0.01, 0)); 120 120 121 122 123 121 124 //planet.getModel().clearAttribute("gl_Normal"); 122 125 123 126 // Asteroids 124 127 asteroidBelt(800, 1400, planet); 128 129 //delete planet; 125 130 126 131 // Add to the scene's update loop trunk/src/yage/core/tree.d
r71 r72 6 6 module yage.core.tree; 7 7 8 import std.gc; 8 9 9 10 /** … … 20 21 T[T] children; 21 22 22 /// Prohibit manual deletion of Tree elements. Use .remove() instead.23 delete(void* p)24 { throw new Exception("Tree elements cannot be deleted. Use remove().");23 /// Ensure that child is removed from its parent. 24 ~this() 25 { remove(); 25 26 } 26 27 … … 30 31 * Returns: A self reference.*/ 31 32 T addChild(T child) 32 in {assert(child !is this);} 33 body 33 in { 34 assert(child != this); 35 assert(child !is null); 36 }body 34 37 { child.setParent(cast(T)this); 35 38 return cast(T)this; … … 46 49 T getParent() 47 50 { return parent; 48 } 51 } 49 52 T setParent(T _parent) /// Ditto 50 53 in { assert(_parent !is null); 51 54 }body 52 { 53 if (parent && cast(T)this in parent.children) 55 { if (parent && cast(T)this in parent.children) 54 56 parent.children.remove(cast(T)this); 55 57 … … 60 62 } 61 63 62 /// Remove this element. This function should be used instead of delete. 64 /// Is elem a child of this element? 65 bool isChild(T elem) 66 { return cast(bool)(elem in children); 67 } 68 69 /// Remove this element from its parent 63 70 void remove() 64 71 { // this needs to happen because some children (like lights) may need to do more in their remove() function. trunk/src/yage/node/model.d
r71 r72 26 26 this(Node parent) 27 27 { super(parent); 28 visible = true; 29 } 28 } 30 29 31 30 /** trunk/src/yage/node/node.d
r71 r72 127 127 } 128 128 } 129 130 /// Prohibit manual deletion of Nodes. Use node.remove() instead.131 delete(void* p)132 { throw new Exception("Nodes cannot be deleted. Use remove().");133 }134 129 135 130 /** trunk/src/yage/node/visible.d
r71 r72 39 39 protected LightNode[] lights; // Lights that affect this VisibleNode 40 40 41 41 42 /// Construct as a child of parent. 42 43 this(Node parent) 43 { visible = false; 44 size = Vec3f(1); 44 { size = Vec3f(1); 45 45 color = Color("white"); 46 46 super(parent);
