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

Method Draw

Source/Objects/placeholderobject.cpp:105–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105void PlaceholderObject::Draw() {
106 if (g_debug_runtime_disable_placeholder_object_draw) {
107 return;
108 }
109
110 if (!scenegraph_->map_editor->IsTypeEnabled(_placeholder_object) ||
111 scenegraph_->map_editor->state_ == MapEditor::kInGame ||
112 !visible_ ||
113 Graphics::Instance()->media_mode() ||
114 ActiveCameras::Instance()->Get()->GetFlags() == Camera::kPreviewCamera) {
115 if (title_debug_string_id != -1) {
116 DebugDraw::Instance()->SetVisible(title_debug_string_id, false);
117 }
118 } else {
119 if (title_debug_string_id != -1) {
120 DebugDraw::Instance()->SetVisible(title_debug_string_id, true);
121 }
122
123 bool old_shadow_cache_dirty = shadow_cache_dirty;
124 for (auto& preview_object : preview_objects_) {
125 preview_object->SetTransformationMatrix(GetTransform());
126 preview_object->ReceiveObjectMessage(OBJECT_MSG::DRAW);
127 }
128 shadow_cache_dirty = old_shadow_cache_dirty; // We don't want to update static shadow maps just because we moved this preview object
129
130 if (ActiveCameras::Get()->GetFlags() == Camera::kEditorCamera) {
131 if (billboard_texture_ref_.valid()) {
132 DebugDraw::Instance()->AddBillboard(billboard_texture_ref_->GetTextureRef(), GetTranslation(), GetScale()[0], vec4(1.0f), kStraight, _delete_on_draw);
133 }
134 DrawEditorLabel();
135 } else {
136 ClearEditorLabel();
137 }
138
139 if (connect_id_ != -1) {
140 Object* obj = scenegraph_->GetObjectFromID(connect_id_);
141 if (obj) {
142 DebugDraw::Instance()->AddLine(GetTranslation(), obj->GetTranslation(), vec4(1.0f, 1.0f, 1.0f, 0.5f), _delete_on_draw);
143 }
144 }
145 }
146}
147
148void PlaceholderObject::GetDesc(EntityDescription& desc) const {
149 Object::GetDesc(desc);

Callers

nothing calls this directly

Calls 15

GetTranslationFunction · 0.85
GetScaleFunction · 0.85
media_modeMethod · 0.80
AddBillboardMethod · 0.80
GetTextureRefMethod · 0.80
GetObjectFromIDMethod · 0.80
GetTranslationMethod · 0.80
GetFunction · 0.50
vec4Class · 0.50
IsTypeEnabledMethod · 0.45
GetFlagsMethod · 0.45

Tested by

no test coverage detected