00001 /* 00002 This file is part of the Virtual Object System of 00003 the Interreality project (http://interreality.org). 00004 00005 Copyright (C) 2001, 2002 Peter Amstutz 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 Peter Amstutz <tetron@interreality.org> 00022 */ 00023 00024 #ifndef _MODEL_HH_ 00025 #define _MODEL_HH_ 00026 00027 #if defined(_WIN32) && defined(_MSC_VER) 00028 # ifdef A3DL_EXPORTS 00029 # define A3DL_API __declspec(dllexport) 00030 # else 00031 # define A3DL_API __declspec(dllimport) 00032 # endif 00033 #else 00034 # define A3DL_API 00035 #endif 00036 00037 #include "object3d.hh" 00038 00039 namespace A3DL 00040 { 00041 00042 /* This object's geometry is defined by model data in a 00043 * format such as 3DS, VRML, POV, etc. contained in a subproperty named 00044 * "model". 00045 * @note: if you use Object3D::initialize() on a Model object, make sure 00046 * that you also call setModel() or setModelToFile() to complete the object. 00047 */ 00048 class A3DL_API Model : public virtual Object3D 00049 { 00050 public: 00051 Model(MetaObject* superobject); 00052 virtual ~Model(); 00053 00054 /** Set the value of "model" property to m. 00055 * @param m Model data 00056 * @param datatype Data type identifier (MIME type or typechain). 00057 * Default is "?". */ 00058 virtual void setModel(const string& m, const string& datatype = "?"); 00059 00060 /** Make the "model" property use a file as storage, rather than memory. 00061 * @param filename Name of the file on disk. 00062 * @param datatype Data type identifier. (MIME type or typechain). Default is "?". 00063 * @see FileProperty 00064 * @throw FileAccessError if the file cannot be opened. 00065 */ 00066 virtual void setModelToFile(const string& filename, const string& datatype = "?"); 00067 00068 virtual const string getType(); 00069 static void registerExtenders(); 00070 static MetaObject* new_Model(MetaObject* superobject, const string& type); 00071 00072 virtual Property* getModelObj(); 00073 virtual void setModelObj(Property* obj); 00074 }; 00075 } 00076 00077 #endif