ROOT logo
// $Id: Dynamico.h 2320 2010-01-02 12:37:35Z matevz $

// Copyright (C) 1999-2008, Matevz Tadel. All rights reserved.
// This file is part of GLED, released under GNU General Public License version 2.
// For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/.

#ifndef Var1_Dynamico_H
#define Var1_Dynamico_H

#include <Glasses/Extendio.h>
#include <Stones/GravData.h>

class Statico;

class Dynamico : public Extendio
{
  friend class Tringula;
  MAC_RNR_FRIENDS(Dynamico);

private:
  void _init();

protected:
  HTransF         mLastTrans;  // Last transform from current master.
  Opcode::AABB    mLastAABB;   // Last enclosing bbox in parent frame.

  Float_t&        mV;          // X{GS}  7 Value(-range=>[-100,100, 1,1000], -join=>1)
  Float_t&        mW;          // X{GS}  7 Value(-range=>[  -5,  5, 1,1000])

  // Float_t         mPowPerM;    // X{GS}  7 Value(-range=>[-10,10, 1,1000])
  // Force per mass, perchance?
  // No ... force ... mass is eventually variable.
  // Then need "engine type"; min/max F, max dF/dt

  HPointF         mVVec;       // X{RS}  7 HPointF()
  HPointF         mWVec;       // X{RS}  7 HPointF()

  Float_t         mSafety;     //! Safe distance to tringula boundaries.
  Float_t         mExtraStep;  //! Extra distance traveled due collisions etc.

  GravData        mGrav;

  UInt_t          mOPCRCCache; //!

public:
  Dynamico(const Text_t* n="Dynamico", const Text_t* t=0);

  virtual void SetTringula(Tringula* tring);

  virtual void TimeTick(Double_t t, Double_t dt) {}

  virtual void update_last_data() { mLastTrans = mTrans; mLastAABB = mAABB; }

  virtual void update_grav_safeties(Float_t vl, Float_t vt);

  using Extendio::height_above_terrain;
  Float_t height_above_terrain() { return height_above_terrain(mGrav.Dir()); }

  static bool handle_collision(Dynamico            * dyno,
                               Statico             * stato,
                               Opcode::RayCollider & ray_collider,
                               Opcode::Ray         & ray,
                               Opcode::Point       & com_dyno,
                               CollisionSegments   & segments);

  static bool handle_collision(Dynamico            * dyno0,
                               Dynamico            * dyno1,
                               Opcode::Point       & up_dir,
                               CollisionSegments   & segments);

#include "Dynamico.h7"
  ClassDef(Dynamico, 1);
}; // endclass Dynamico

#endif
 Dynamico.h:1
 Dynamico.h:2
 Dynamico.h:3
 Dynamico.h:4
 Dynamico.h:5
 Dynamico.h:6
 Dynamico.h:7
 Dynamico.h:8
 Dynamico.h:9
 Dynamico.h:10
 Dynamico.h:11
 Dynamico.h:12
 Dynamico.h:13
 Dynamico.h:14
 Dynamico.h:15
 Dynamico.h:16
 Dynamico.h:17
 Dynamico.h:18
 Dynamico.h:19
 Dynamico.h:20
 Dynamico.h:21
 Dynamico.h:22
 Dynamico.h:23
 Dynamico.h:24
 Dynamico.h:25
 Dynamico.h:26
 Dynamico.h:27
 Dynamico.h:28
 Dynamico.h:29
 Dynamico.h:30
 Dynamico.h:31
 Dynamico.h:32
 Dynamico.h:33
 Dynamico.h:34
 Dynamico.h:35
 Dynamico.h:36
 Dynamico.h:37
 Dynamico.h:38
 Dynamico.h:39
 Dynamico.h:40
 Dynamico.h:41
 Dynamico.h:42
 Dynamico.h:43
 Dynamico.h:44
 Dynamico.h:45
 Dynamico.h:46
 Dynamico.h:47
 Dynamico.h:48
 Dynamico.h:49
 Dynamico.h:50
 Dynamico.h:51
 Dynamico.h:52
 Dynamico.h:53
 Dynamico.h:54
 Dynamico.h:55
 Dynamico.h:56
 Dynamico.h:57
 Dynamico.h:58
 Dynamico.h:59
 Dynamico.h:60
 Dynamico.h:61
 Dynamico.h:62
 Dynamico.h:63
 Dynamico.h:64
 Dynamico.h:65
 Dynamico.h:66
 Dynamico.h:67
 Dynamico.h:68
 Dynamico.h:69
 Dynamico.h:70
 Dynamico.h:71
 Dynamico.h:72
 Dynamico.h:73
 Dynamico.h:74
 Dynamico.h:75