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

Method DrawPoints

engine/Poseidon/World/Scene/Object.cpp:1341–1401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1339 colorI = colorI * accom;
1340 colorI.SetA(1);
1341 int sSpecial = GetSpecial();
1342 PackedColor cColor = sSpecial & IsColored ? GetConstantColor() : PackedWhite;
1343 Draw2D(_shape, lod, cColor);
1344}
1345
1346void Object::DrawPoints(int level, ClipFlags clipFlags, const FrameBase& frame)
1347{
1348 if (level == LOD_INVISIBLE)
1349 {
1350 return; // invisible LOD
1351 }
1352 if (clipFlags)
1353 {
1354 // try to clip bounding sphere; if the whole sphere is out the object is already skipped
1355 clipFlags &= GScene->GetCamera()->MayBeClipped(frame.Position(), GetRadius(), 1);
1356 }
1357
1358 // determine which LOD will be used
1359 PoseidonAssert(level >= 0);
1360 Shape* sShape = _shape->LevelOpaque(level);
1361 if (sShape->NPos() <= 0)
1362 {
1363 return;
1364 }
1365
1366 Animate(level);
1367
1368 Matrix4Val pointView = GScene->ScaledInvTransform() * frame.Transform();
1369
1370 // draw all points
1371 TLVertexTable tlTable(this, *sShape, pointView);
1372 ClipFlags clipAnd = clipFlags;
1373 clipFlags &= tlTable.CheckClipping(*GScene->GetCamera(), clipFlags, clipAnd);
1374 if (!clipAnd)
1375 {
1376 LightList noLights;
1377 GEngine->FlushQueues();
1378 const int spec = sShape->Special();
1379 const render::LegacySpec specT = render::SplitLegacy(spec);
1380 GEngine->PrepareMesh(specT);
1381 int bias = (spec & ZBiasMask) / ZBiasStep;
1382 // max. bias value is 3
1383 GEngine->SetBias(bias * 5);
1384
1385 if (render::Has(specT.routing, render::Routing::IsColored))
1386 {
1387 GScene->SetConstantColor(GetConstantColor());
1388 }
1389
1390 tlTable.DoLighting(this, MIdentity, noLights, *sShape, spec);
1391 tlTable.DoPerspective(*GScene->GetCamera(), clipFlags);
1392 GEngine->BeginMesh(tlTable, render::SplitLegacy(sShape->Special()));
1393 MipInfo mip = GEngine->TextBank()->UseMipmap(nullptr, 0, 0);
1394 if (!mip.IsOK())
1395 {
1396 return;
1397 }
1398 GEngine->PrepareTriangle(mip, spec);

Callers 1

DrawSkyMethod · 0.45

Calls 15

AnimateFunction · 0.85
SplitLegacyFunction · 0.85
DeanimateFunction · 0.85
MayBeClippedMethod · 0.80
GetCameraMethod · 0.80
LevelOpaqueMethod · 0.80
CheckClippingMethod · 0.80
DoLightingMethod · 0.80
DoPerspectiveMethod · 0.80
IsOKMethod · 0.80
GetRadiusFunction · 0.70
HasFunction · 0.50

Tested by

no test coverage detected