MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Skip

Method Skip

engine/Poseidon/World/Entities/Vehicles/Tracks.cpp:316–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316void TrackDraw::Skip(const Frame& pos)
317{
318 if (!_offsets)
319 {
320 return;
321 }
322 Point3 left = pos.PositionModelToWorld(_lOffset);
323 Point3 right = pos.PositionModelToWorld(_rOffset);
324 float eps = GLOB_ENGINE->ZShadowEpsilon();
325 // RoadSurfaceY, not SurfaceY: roads float a few cm above the terrain mesh,
326 // so a terrain-height track sits below the road and is depth-rejected.
327 left[1] = GLOB_LAND->RoadSurfaceY(left[0], left[2]) + eps;
328 right[1] = GLOB_LAND->RoadSurfaceY(right[0], right[2]) + eps;
329 const float vMap = 2.0;
330 for (int level = 0; level < TrackLODLevels; level++)
331 {
332 TrackLODLevel& lod = _lods[level];
333 if (lod._initDone)
334 {
335 float distL2 = lod._lastL.Distance2(left);
336 float distR2 = lod._lastR.Distance2(right);
337 float v = lod._lastV + sqrt((distL2 + distR2) * 0.5) * vMap;
338 lod._lastV = v;
339 lod._lastL = left;
340 lod._lastR = right;
341 }
342 }
343}
344
345void UnregisterVBShape(LODShapeWithShadow* shape);
346

Callers 1

UpdateMethod · 0.45

Calls 5

sqrtFunction · 0.85
PositionModelToWorldMethod · 0.80
RoadSurfaceYMethod · 0.80
ZShadowEpsilonMethod · 0.45
Distance2Method · 0.45

Tested by

no test coverage detected