Changeset 69

Show
Ignore:
Timestamp:
05/26/08 01:04:37 (3 months ago)
Author:
JoeCoder
Message:

Fixed misspelling of "moveable" throughout code.
Other minor changes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/demo1/main.d

    r68 r69  
    3838    Log.write("Starting update loop."); 
    3939    Scene scene = new Scene(); 
    40     scene.start(60); // update 60 times per second 
     40    //scene.start(60); // update 60 times per second 
    4141     
    4242    Device.onExit = &scene.stop; 
     
    147147        //} 
    148148        delta.reset(); 
     149        scene.update(dtime); 
    149150 
    150151        Input.processInput(); 
  • trunk/src/yage/node/all.d

    r59 r69  
    1313 
    1414public 
    15 {   import yage.node.base; 
     15{   import yage.node.movable; 
    1616    import yage.node.camera; 
    1717    import yage.node.graph; 
     
    1919    import yage.node.model; 
    2020    import yage.node.node; 
     21    import yage.node.base; 
     22    import yage.node.movable; 
    2123    import yage.node.scene; 
    2224    import yage.node.sprite; 
     
    2426    import yage.node.terrain; 
    2527} 
    26 public import yage.node.node: Node; 
    27 public import yage.node.camera: CameraNode; 
  • trunk/src/yage/node/base.d

    r67 r69  
    1313import yage.node.node; 
    1414import yage.node.scene; 
    15 import yage.node.moveable; 
     15import yage.node.movable; 
    1616 
    1717/** 
     
    2626    BaseNode    parent; 
    2727    Node[Node]  children;    
     28     
     29    protected Matrix    transform;              // The position and rotation of this node relative to its parent 
     30    protected Matrix    transform_abs;          // The position and rotation of this node in worldspace coordinates 
     31    protected bool      transform_dirty=true;   // The absolute transformation matrix needs to be recalculated. 
     32 
     33    protected Vec3f     linear_velocity; 
     34    protected Vec3f     angular_velocity; 
     35    protected Vec3f     linear_velocity_abs;    // Store a cached version of the absolute linear velocity. 
     36    protected Vec3f     angular_velocity_abs; 
     37    protected bool      velocity_dirty=true;    // The absolute velocity vectors need to be recalculated. 
     38 
     39    // Rendering and scene-graph updates run in different threads. 
     40    // If the scene is rendered halfway through updating, rendering glitches may occur. 
     41    // Therefore, the scene-graph implements a sort of "triple buffering". 
     42    // Each node has three extra copies of its relative and absolute transform matrices. 
     43    // The renderer simply uses the copy (buffer) that isn't being updated.  A third copy 
     44    // exists so neither the renderer or updater need to wait on one another. 
     45    struct Cache 
     46    {   Matrix transform; 
     47        Matrix transform_abs; 
     48    } 
     49    protected Cache cache[3]; 
     50 
    2851 
    2952    protected void delegate(BaseNode self) on_update = null;    // called on update 
    30      
    31     mixin MoveableNode; 
    3253 
    3354    /// Prohibit manual deletion of Nodes.  node.remove() must be used. 
    3455    delete(void* p) 
    35     {   throw new Exception("Nodes cannot be deleted."); 
     56    {   throw new Exception("Nodes cannot be deleted.  Use remove()."); 
    3657    } 
    3758 
     
    135156        // This prevents rendering a halfway-updated scenegraph. 
    136157        cache[scene.transform_write].transform = transform; 
    137         cache[scene.transform_write].transform_abs = getAbsoluteTransform(); 
     158        if (transform_dirty) 
     159            calcTransform(); 
     160        cache[scene.transform_write].transform_abs = transform_abs; 
    138161 
    139162        // Call the onUpdate() function 
  • trunk/src/yage/node/node.d

    r68 r69  
    1919import yage.node.light; 
    2020import yage.node.base; 
    21 import yage.node.moveable; 
     21import yage.node.movable; 
    2222import yage.system.constant; 
    2323import yage.system.device; 
     
    3434 * through every child node.  Likewise, updating of position and rotation 
    3535 * occurs recusively from Scene's update() method.  All Node methods that deal 
    36  * with position or velocity are separated into yage.node.moveable to keep things 
     36 * with position or velocity are separated into yage.node.movable to keep things 
    3737 * tidier. 
    3838 * 
    3939 * See_Also: 
    40  * yage.node.MoveableNode 
     40 * yage.node.MovableNode 
    4141 * yage.node.BaseNode 
    4242 * 
     
    5757 * -------------------------------- 
    5858 */ 
    59 class Node : BaseNode 
     59class Node : MovableNode 
    6060{ 
    6161    protected bool  onscreen = true;    // used internally by cameras to mark if they can see this node.