Author Topic: Object Picking and Moving  (Read 2005 times)

0 Members and 1 Guest are viewing this topic.

Charles Pegge

  • Guest
Object Picking and Moving
« on: May 08, 2013, 01:06:44 PM »
At this stage, OOP begins to become a useful construct for encapsulating objects and standardising methods for future types of object:

 class cones
  ===========
  float  x,y,z
  float  sc,rz,ry,sm
  sys    n,tex
  '
  float  xx,yy,zz

  ===========>>
  '  
  
  '
  method Render()
  ===============
  if tex then glBindTexture GL_TEXTURE_2D,tex
  glPushMatrix
  gltranslatef  x,y,z
  glrotatef     ang1,0,1,0
  glscalef      sc,sc,sc
  ConeSides     n,rz,ry,sm
  glPopMatrix
  end method
  '
  method anchor()
  ===============
  xx=x
  yy=y
  zz=z
  end method
  '
  method move(single mx,my,mz)
  ============================
  x=xx+mx
  y=yy+my
  z=zz+mz
  end method
  '
  method drag()
  =============
  float dx,dy,dz
  dx=mposx-sposx
  dy=sposy-mposy
  dz=-z/crect.right
  move dx*dz,dy*dz,0
  end method
  '
  end class


X