Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

vos/metaobjects/misc/avatar3d.cc

Go to the documentation of this file.
00001 /*
00002     This file is part of the Virtual Object System of
00003     the Interreality project (http://interreality.org).
00004 
00005     Copyright (C) 2003 Reed Hedges
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 
00021     Reed Hedges <reed@interreality.org>
00022 */
00023 
00024 #include <vos/corelibs/vos/vos.hh>
00025 #include "avatar3d.hh"
00026 
00027 
00028 Avatar3D::Avatar3D(MetaObject* super) : MetaObject(super), Avatar(super) {
00029 }
00030 
00031 Avatar3D::~Avatar3D() {
00032 }
00033 
00034 void Avatar3D::registerExtenders() {
00035     LocalSite::addLocalObjectExtension(typeid(Avatar3D).name(), &Avatar3D::new_Avatar3D);
00036     LocalSite::addLocalObjectExtension("misc:avatar.3d", &Avatar3D::new_Avatar3D);
00037     RemoteSite::addRemoteObjectExtension(typeid(Avatar3D).name(), &Avatar3D::new_Avatar3D);
00038     RemoteSite::addRemoteObjectExtension("misc:avatar.3d", &Avatar3D::new_Avatar3D);
00039 }
00040 
00041 const string Avatar3D::getType() {
00042     return "misc:avatar.3d";
00043 }
00044 
00045 MetaObject* Avatar3D::new_Avatar3D(MetaObject* super, const string& type) {
00046     return new Avatar3D(super);
00047 }
00048 
00049 void Avatar3D::setPointerPosition(double x, double y, double z, PropertyAccessControl* ac) {
00050     if(!ac)
00051         ac = defaultAccessControl;
00052     vector<double> v(3);
00053     v[0] = x;
00054     v[1] = y;
00055     v[2] = z;
00056     Property::setFloatVectorProperty(*this, "misc:pointer-position", v, ac);
00057 }
00058 
00059 void Avatar3D::setNullPointerPosition(PropertyAccessControl* ac) {
00060     if(!ac)
00061         ac = defaultAccessControl;
00062     Property::setProperty(*this, "misc:pointer-position", "", "text/x-vector-float", ac);
00063 }
00064 
00065 void Avatar3D::getPointerPosition(double& x, double& y, double& z)  {
00066     vector<double> v = Property::getFloatVectorProperty(*this, "misc:pointer-position");
00067     if(v.size() >= 3) {
00068         x = v[0];
00069         y = v[1];
00070         z = v[2];
00071     } else {
00072         throw range_error("misc:pointer-position property has less than 3 elements.");
00073     }
00074 }
00075 
00076 

Generated on Tue Aug 12 03:55:44 2003 for Interreality Project - VOS by doxygen 1.3.2