TreeModelFactory.cpp

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #include <3dsparse/TreeModelFactory.h>
00022 #include <common/Defines.h>
00023 #include <stdio.h>
00024 #include <math.h>
00025 
00026 TreeModelFactory::TreeModelFactory()
00027 {
00028 }
00029 
00030 TreeModelFactory::~TreeModelFactory()
00031 {
00032 }
00033 
00034 Model *TreeModelFactory::createModel(const char *fileName,
00035         const char *texName)
00036 {
00037         Model *model = new Model();
00038         model->getMin() = Vector(-0.5f, -0.5f, -0.5f);
00039         model->getMax() = Vector(+0.5f, +0.5f, +0.5f);
00040         return model;
00041 }
00042 
00043 bool TreeModelFactory::getTypes(const char *type, bool snow, 
00044         TreeType &normalType, TreeType &burntType)
00045 {
00046         if (0 == strcmp(type, "pine"))
00047         {
00048                 normalType = (snow?ePineSnow:ePineNormal);
00049                 burntType = ePineBurnt;
00050         }
00051         else if (0 == strcmp(type, "pine2"))
00052         {
00053                 normalType = (snow?ePine2Snow:ePine2);
00054                 burntType = ePineBurnt;
00055         }
00056         else if (0 == strcmp(type, "pine3"))
00057         {
00058                 normalType = (snow?ePine3Snow:ePine3);;
00059                 burntType = ePineBurnt;
00060         }
00061         else if (0 == strcmp(type, "pine4"))
00062         {
00063                 normalType = (snow?ePine4Snow:ePine4);;
00064                 burntType = ePineBurnt;
00065         }
00066         else if (0 == strcmp(type, "burntpine"))
00067         {
00068                 normalType = ePineBurnt;
00069                 burntType = ePineBurnt;
00070         }
00071         else if (0 == strcmp(type, "yellowpine"))
00072         {
00073                 normalType = (snow?ePineSnow:ePineYellow);
00074                 burntType = ePineBurnt;
00075         }
00076         else if (0 == strcmp(type, "lightpine"))
00077         {
00078                 normalType = (snow?ePineSnow:ePineLight);
00079                 burntType = ePineBurnt;
00080         }
00081         else if (0 == strcmp(type, "palm"))
00082         {
00083                 normalType = ePalmNormal;
00084                 burntType = ePalmBurnt;
00085         }
00086         else if (0 == strcmp(type, "palm2"))
00087         {
00088                 normalType = ePalm2;
00089                 burntType = ePalmBurnt;
00090         }
00091         else if (0 == strcmp(type, "palm3"))
00092         {
00093                 normalType = ePalm3;
00094                 burntType = ePalmBurnt;
00095         }
00096         else if (0 == strcmp(type, "palm4"))
00097         {
00098                 normalType = ePalm4;
00099                 burntType = ePalmBurnt;
00100         }
00101         else if (0 == strcmp(type, "palmb"))
00102         {
00103                 normalType = ePalmB;
00104                 burntType = ePalmBurnt;
00105         }
00106         else if (0 == strcmp(type, "palmb2"))
00107         {
00108                 normalType = ePalmB2;
00109                 burntType = ePalmBurnt;
00110         }
00111         else if (0 == strcmp(type, "palmb3"))
00112         {
00113                 normalType = ePalmB3;
00114                 burntType = ePalmBurnt;
00115         }
00116         else if (0 == strcmp(type, "palmb4"))
00117         {
00118                 normalType = ePalmB4;
00119                 burntType = ePalmBurnt;
00120         }
00121         else if (0 == strcmp(type, "palmb5"))
00122         {
00123                 normalType = ePalmB5;
00124                 burntType = ePalmBurnt;
00125         }
00126         else if (0 == strcmp(type, "palmb6"))
00127         {
00128                 normalType = ePalmB6;
00129                 burntType = ePalmBurnt;
00130         }
00131         else if (0 == strcmp(type, "palmb7"))
00132         {
00133                 normalType = ePalmB7;
00134                 burntType = ePalmBurnt;
00135         }
00136         else if (0 == strcmp(type, "burntpalm"))
00137         {
00138                 normalType = ePalmBurnt;
00139                 burntType = ePalmBurnt;
00140         }
00141         else if (0 == strcmp(type, "oak"))
00142         {
00143                 normalType = eOak;
00144                 burntType = ePalmBurnt;
00145         }
00146         else if (0 == strcmp(type, "oak2"))
00147         {
00148                 normalType = eOak2;
00149                 burntType = ePalmBurnt;
00150         }
00151         else if (0 == strcmp(type, "oak3"))
00152         {
00153                 normalType = eOak3;
00154                 burntType = ePalmBurnt;
00155         }
00156         else if (0 == strcmp(type, "oak4"))
00157         {
00158                 normalType = eOak4;
00159                 burntType = ePalmBurnt;
00160         }
00161         else return false;
00162         return true;
00163 }
00164 

Generated on Mon Feb 16 15:14:48 2009 for Scorched3D by  doxygen 1.5.3