00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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