MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / visible

Method visible

ogsr_engine/xrGame/visual_memory_manager.cpp:350–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350bool CVisualMemoryManager::visible(const CGameObject* game_object, float time_delta)
351{
352 VERIFY(game_object);
353
354 if (game_object->getDestroy())
355 return (false);
356
357
358 float object_distance, distance = object_visible_distance(game_object, object_distance);
359
360 CNotYetVisibleObject* object = not_yet_visible_object(game_object);
361
362 if (distance < object_distance)
363 {
364 if (object)
365 {
366 object->m_value -= current_state().m_decrease_value;
367 if (object->m_value < 0.f)
368 object->m_value = 0.f;
369 else
370 object->m_update_time = Device.dwTimeGlobal;
371 return (object->m_value >= current_state().m_visibility_threshold);
372 }
373 return (false);
374 }
375
376 float luminocity = object_luminocity(game_object);
377 float trans;
378 if (current_state().m_transparency_factor > 0.f && smart_cast<const CActor*>(game_object))
379 {
380 trans = visible_transparency_threshold(game_object);
381 if (trans < 1.f)
382 trans = trans < 0.f ? 1.f : (trans * current_state().m_transparency_factor);
383
384 clamp(trans, 0.f, 1.f);
385 }
386 else
387 trans = 1.f;
388
389 if (!object)
390 {
391 CNotYetVisibleObject new_object;
392 new_object.m_object = game_object;
393 new_object.m_prev_time = 0;
394 new_object.m_value = get_visible_value(distance, object_distance, time_delta, get_object_velocity(game_object, new_object), luminocity, trans);
395 clamp(new_object.m_value, 0.f, current_state().m_visibility_threshold + EPS_L);
396 new_object.m_update_time = Device.dwTimeGlobal;
397 new_object.m_prev_time = get_prev_time(game_object);
398 add_not_yet_visible_object(new_object);
399 return (new_object.m_value >= current_state().m_visibility_threshold);
400 }
401
402 object->m_update_time = Device.dwTimeGlobal;
403 object->m_value += get_visible_value(distance, object_distance, time_delta, get_object_velocity(game_object, *object), luminocity, trans);
404 clamp(object->m_value, 0.f, current_state().m_visibility_threshold + EPS_L);
405 object->m_prev_time = get_prev_time(game_object);
406
407 return (object->m_value >= current_state().m_visibility_threshold);

Callers 8

memoryMethod · 0.45
visible_right_nowMethod · 0.45
visible_nowMethod · 0.45
check_visiblesMethod · 0.45
updateMethod · 0.45
process_enemiesMethod · 0.45

Calls 10

not_yet_visible_objectFunction · 0.85
clampFunction · 0.85
angle_differenceFunction · 0.85
vertex_positionMethod · 0.80
PositionMethod · 0.80
getHPMethod · 0.80
subMethod · 0.45
normalize_safeMethod · 0.45
level_vertex_idMethod · 0.45

Tested by

no test coverage detected