| 124 | static const EnvObjectGLState env_object_gl_state; |
| 125 | |
| 126 | static void UpdateDetailObjectSurfaces(EnvObject::DOSList* detail_object_surfaces, |
| 127 | const ObjectFileRef& ofr, |
| 128 | const TextureAssetRef& base_color, |
| 129 | const TextureAssetRef& base_normal, |
| 130 | const mat4 transform, |
| 131 | int model_id) { |
| 132 | // TODO: Make sure we aren't duplicating code from Terrain.cpp |
| 133 | for (auto& detail_object_surface : *detail_object_surfaces) { |
| 134 | delete detail_object_surface; |
| 135 | } |
| 136 | detail_object_surfaces->clear(); |
| 137 | detail_object_surfaces->resize(ofr->m_detail_object_layers.size()); |
| 138 | int counter = 0; |
| 139 | for (auto& dos : *detail_object_surfaces) { |
| 140 | dos = new DetailObjectSurface(); |
| 141 | DetailObjectLayer& dol = ofr->m_detail_object_layers[counter]; |
| 142 | dos->AttachTo(Models::Instance()->GetModel(model_id), transform); |
| 143 | dos->GetTrisInPatches(transform); |
| 144 | dos->LoadDetailModel(dol.obj_path); |
| 145 | dos->LoadWeightMap(dol.weight_path); |
| 146 | dos->SetDensity(dol.density); |
| 147 | dos->SetNormalConform(dol.normal_conform); |
| 148 | dos->SetMinEmbed(dol.min_embed); |
| 149 | dos->tint_weight = dol.tint_weight; |
| 150 | dos->SetMaxEmbed(dol.max_embed); |
| 151 | dos->SetMinScale(dol.min_scale); |
| 152 | dos->SetMaxScale(dol.max_scale); |
| 153 | dos->SetViewDist(dol.view_dist); |
| 154 | dos->SetJitterDegrees(dol.jitter_degrees); |
| 155 | dos->SetOverbright(dol.overbright); |
| 156 | dos->SetCollisionType(dol.collision_type); |
| 157 | dos->SetBaseTextures(base_color, base_normal); |
| 158 | ++counter; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | EnvObject::EnvObject() : bullet_object_(NULL), |
| 163 | csg_modified_(false), |
no test coverage detected