interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

/home/tetron/hack/vos/libs/vos/csplugin/vosmaterial.hh

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002    $Id: vosmaterial.h,v 1.6 2005/12/19 04:27:00 tetron Exp $
00003 
00004     This file is part of Crystal Space Virtual Object System Abstract
00005     3D Layer plugin (csvosa3dl).
00006 
00007     Copyright (C) 2004 Peter Amstutz
00008 
00009     This program is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU Lesser General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     along with this program; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 */
00023 
00024 #ifndef _VOSMATERIAL_H_
00025 #define _VOSMATERIAL_H_
00026 
00027 #include <vos/vos/vos.hh>
00028 #include <vos/metaobjects/a3dl/a3dl.hh>
00029 #include "csvosa3dl.hh"
00030 
00031 class ConstructMaterialTask;
00032 
00033 class csMetaMaterial :
00034   public A3DL::Material,
00035   public VOS::ChildChangeListener,
00036   public VOS::PropertyListener
00037 {
00038 protected:
00039   csRef<iMaterialWrapper> materialwrapper;
00040   bool alreadyLoaded;
00041   csVosA3DL* vosa3dl;
00042   bool needListener;
00043 
00044   static csRef<iMaterialWrapper> checkerboard;
00045 
00046   /** Generate the "checkerboard" default pattern (only called once)  */
00047   static void CreateCheckerboard();
00048 
00049 public:
00050   static iObjectRegistry* object_reg;
00051 
00052   csMetaMaterial(VOS::VobjectBase* superobject);
00053   virtual ~csMetaMaterial();
00054 
00055   virtual void Setup(csVosA3DL* vosa3dl);
00056 
00057   /** Return CS iMaterialWrapper interface for this object */
00058   csRef<iMaterialWrapper> GetMaterialWrapper();
00059 
00060   /** Get the "checkerboard" default pattern. */
00061   static csRef<iMaterialWrapper> GetCheckerboard();
00062 
00063   void updateMaterial();
00064 
00065   virtual void notifyPropertyChange(const VOS::PropertyEvent& event);
00066   virtual void notifyChildInserted(VOS::VobjectEvent& event);
00067   virtual void notifyChildReplaced(VOS::VobjectEvent& event);
00068   virtual void notifyChildRemoved(VOS::VobjectEvent& event);
00069 
00070   static VOS::MetaObject* new_csMetaMaterial(
00071     VOS::VobjectBase* superobject, const std::string& type);
00072 
00073   friend class ConstructMaterialTask;
00074 };
00075 
00076 #endif