MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / TransformVertices

Method TransformVertices

TombEngine/Game/effects/Streamer.cpp:46–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 }
45
46 void Streamer::StreamerSegment::TransformVertices(float vel, float expRate)
47 {
48 // Apply expansion/contraction.
49 if (expRate != 0.0f)
50 {
51 float distSqr = Vector3::DistanceSquared(Vertices[0], Vertices[1]);
52 if (expRate < 0.0f && distSqr <= SQUARE(abs(expRate)))
53 {
54 auto center = (Vertices[0] + Vertices[1]) / 2;
55 Vertices[0] =
56 Vertices[1] = center;
57 }
58 else
59 {
60
61 auto dir = Orientation.ToDirection();
62 Vertices[0] = Geometry::TranslatePoint(Vertices[0], -dir, expRate);
63 Vertices[1] = Geometry::TranslatePoint(Vertices[1], dir, expRate);
64 }
65 }
66
67 // Apply directional velocity.
68 if (vel != 0.0f)
69 {
70 auto dir = Orientation.GetAxis();
71 Vertices[0] = Geometry::TranslatePoint(Vertices[0], dir, vel);
72 Vertices[1] = Geometry::TranslatePoint(Vertices[1], dir, vel);
73 }
74 }
75
76 Streamer::Streamer(StreamerFeatherMode featherMode, BlendMode blendMode)
77 {

Callers

nothing calls this directly

Calls 3

TranslatePointFunction · 0.85
GetAxisMethod · 0.80
ToDirectionMethod · 0.45

Tested by

no test coverage detected