MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / UpdateDetailObjectSurfaces

Function UpdateDetailObjectSurfaces

Source/Objects/envobject.cpp:126–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124static const EnvObjectGLState env_object_gl_state;
125
126static 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
162EnvObject::EnvObject() : bullet_object_(NULL),
163 csg_modified_(false),

Callers 2

MovedMethod · 0.85
LoadMethod · 0.85

Calls 15

GetTrisInPatchesMethod · 0.80
LoadDetailModelMethod · 0.80
LoadWeightMapMethod · 0.80
SetDensityMethod · 0.80
SetNormalConformMethod · 0.80
SetMinEmbedMethod · 0.80
SetMaxEmbedMethod · 0.80
SetMinScaleMethod · 0.80
SetMaxScaleMethod · 0.80
SetViewDistMethod · 0.80
SetJitterDegreesMethod · 0.80
SetOverbrightMethod · 0.80

Tested by

no test coverage detected