World's Object class. More...

Inheritance diagram for WObject:

Public Member Functions

 WObject (World *world, QString name="unamed", const wMatrix &tm=wMatrix::identity(), bool addToWorld=true)
 create the object and automatically put this into the world
 
virtual ~WObject ()
 destroy the Object and drop it from the world
 
QColor color () const
 return the color of this object
 
bool isInvisible ()
 return if it is invisible
 
const wMatrixmatrix () const
 return a reference to the transformation matrix
 
QString name () const
 Return the name of this object.
 
virtual void postUpdate ()
 postUpdate the WObject this method is called at each step of the world just after the physic update
 
virtual void preUpdate ()
 preUpdate the WObject this method is called at each step of the world just before the physic update
 
void setAlpha (int alpha)
 set the value of alpha channel (the transparency)
 
void setColor (QColor c)
 Set the color to use on rendering.
 
void setInvisible (bool b)
 set invisibility
 
void setMatrix (const wMatrix &newm)
 set a new matrix
 
void setPosition (const wVector &newpos)
 set the position specified in global coordinate frame
 
void setPosition (real x, real y, real z)
 set the position specified in global coordinate frame
 
void setTexture (QString textureName)
 Set the texture to use for this WObject when rendered.
 
void setUseColorTextureOfOwner (bool b)
 set if the object will be rendered with the color and texture of our owner (if we have one)
 
QString texture () const
 Return the texture name.
 
bool useColorTextureOfOwner () const
 if true, we will use color and texture of our owner (if we have one)
 
Worldworld ()
 Return the world.
 
const Worldworld () const
 Return the world (const version)
 
- Public Member Functions inherited from Ownable
 Ownable ()
 Constructor.
 
virtual ~Ownable ()
 Destructor.
 
const QList< Owned > & owned () const
 Returns the list of objects owned by this one.
 
Ownableowner () const
 Returns the owner of this object.
 
void setOwner (Ownable *owner, bool destroy=true)
 Sets the owner of this object.
 

Protected Member Functions

virtual void changedMatrix ()
 virtual function called when the transformation matrix change
 

Protected Attributes

QColor colorv
 Color, it contains also alpha channel.
 
bool invisible
 if TRUE it will not renderized
 
QString namev
 Name of the WObject.
 
QString texturev
 Texture name.
 
wMatrix tm
 Trasformation matrix.
 
bool usecolortextureofowner
 if true, we will use color and texture of our owner (if we have one).
 
Worldworldv
 World.
 

Additional Inherited Members

- Public Types inherited from Ownable
typedef QList< OwnedOwnedList
 The type for the list of owned objects.
 

Detailed Description

World's Object class.

represent abstract object insertable into the World

Definition at line 39 of file wobject.h.

Constructor & Destructor Documentation

WObject ( World world,
QString  name = "unamed",
const wMatrix tm = wMatrix::identity(),
bool  addToWorld = true 
)

create the object and automatically put this into the world

Parameters
worldthe world where object lives
namethe name of the object
tmrotation and position in global coordinate frame
addToWorldif true the object is added to the world, if false it is not. This parameter should be set to false when this constructor is called by the constructor of a subclass because otherwise RTTI in this moment (e.g. in RenderWorld) identifies the newly added object as a WObject instead of the actual type (as the subclasses have not been constructed yet when the object is added to the world)

Definition at line 25 of file wobject.cpp.

References WObject::colorv, WObject::invisible, WObject::name(), WObject::namev, WObject::texturev, WObject::tm, WObject::usecolortextureofowner, and WObject::worldv.

~WObject ( )
virtual

destroy the Object and drop it from the world

Definition at line 38 of file wobject.cpp.

References WObject::worldv.

Member Function Documentation

void changedMatrix ( )
protectedvirtual

virtual function called when the transformation matrix change

Reimplemented in PhyMarXbot, PhyiCub, PhyEpuck, PhyMarXbot, PhyKhepera, and PhyObject.

Definition at line 117 of file wobject.cpp.

Referenced by WObject::setMatrix(), and WObject::setPosition().

bool isInvisible ( )

return if it is invisible

Definition at line 109 of file wobject.cpp.

References WObject::invisible.

Referenced by RenderWorld::draw(), and RenderCamera::paintGL().

void postUpdate ( )
virtual

postUpdate the WObject this method is called at each step of the world just after the physic update

Reimplemented in PhyMarXbot, PhyObjectsGroup, PhyiCub, PhyEpuck, PhyKhepera, WCamera, and PhyMarXbot.

Definition at line 100 of file wobject.cpp.

void preUpdate ( )
virtual

preUpdate the WObject this method is called at each step of the world just before the physic update

Reimplemented in PhyMarXbot, PhyObjectsGroup, PhyiCub, PhyEpuck, PhyKhepera, WCamera, and PhyMarXbot.

Definition at line 96 of file wobject.cpp.

void setAlpha ( int  alpha)

set the value of alpha channel (the transparency)

Definition at line 80 of file wobject.cpp.

References WObject::colorv.

Referenced by RenderWorld::draw().

void setColor ( QColor  c)

Set the color to use on rendering.

When the texture is setted, then the color is behind the texture. To display the object with only color set the texture to "none" - setTexture("none")

Definition at line 76 of file wobject.cpp.

References WObject::colorv.

Referenced by PhyEpuck::PhyEpuck(), PhyKhepera::PhyKhepera(), PhyMarXbot::PhyMarXbot(), PhyMarXbot::setDrawFrontMarker(), PhyKhepera::setDrawFrontMarker(), PhyEpuck::setDrawFrontMarker(), SingleIRGraphic::SingleIRGraphic(), and WCamera::WCamera().

void setInvisible ( bool  b)

set invisibility

Invisible means that the object will be never rendered on widgets

Definition at line 113 of file wobject.cpp.

References WObject::invisible.

void setPosition ( const wVector newpos)

set the position specified in global coordinate frame

Definition at line 46 of file wobject.cpp.

References WObject::changedMatrix(), and WObject::tm.

Referenced by PhyiCub::PhyiCub().

void setPosition ( real  x,
real  y,
real  z 
)

set the position specified in global coordinate frame

Definition at line 51 of file wobject.cpp.

References WObject::changedMatrix(), and WObject::tm.

void setTexture ( QString  textureName)
void setUseColorTextureOfOwner ( bool  b)

set if the object will be rendered with the color and texture of our owner (if we have one)

Definition at line 92 of file wobject.cpp.

References WObject::usecolortextureofowner.

Referenced by PhyMarXbot::PhyMarXbot(), PhyMarXbot::setDrawFrontMarker(), PhyKhepera::setDrawFrontMarker(), PhyEpuck::setDrawFrontMarker(), and SingleIRGraphic::SingleIRGraphic().

QString texture ( ) const

Return the texture name.

Definition at line 72 of file wobject.cpp.

References WObject::texturev.

Referenced by RenderWObjectContainer::setupColorTexture().

bool useColorTextureOfOwner ( ) const

if true, we will use color and texture of our owner (if we have one)

Definition at line 88 of file wobject.cpp.

References WObject::usecolortextureofowner.

Referenced by RenderWObjectContainer::setupColorTexture().

const World * world ( ) const

Return the world (const version)

Definition at line 60 of file wobject.cpp.

References WObject::worldv.

Member Data Documentation

bool invisible
protected

if TRUE it will not renderized

Definition at line 119 of file wobject.h.

Referenced by WObject::isInvisible(), WObject::setInvisible(), and WObject::WObject().

QString namev
protected

Name of the WObject.

Definition at line 113 of file wobject.h.

Referenced by WObject::name(), and WObject::WObject().

QString texturev
protected

Texture name.

Definition at line 115 of file wobject.h.

Referenced by WObject::setTexture(), WObject::texture(), and WObject::WObject().

bool usecolortextureofowner
protected

if true, we will use color and texture of our owner (if we have one).

True by default

Definition at line 121 of file wobject.h.

Referenced by WObject::setUseColorTextureOfOwner(), WObject::useColorTextureOfOwner(), and WObject::WObject().

World* worldv
protected

World.

Definition at line 109 of file wobject.h.

Referenced by WObject::WObject(), WObject::world(), and WObject::~WObject().


The documentation for this class was generated from the following files: