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

Method pDomain

ogsr_engine/xrParticles/particle_core.cpp:34–224  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////// Stuff for the pDomain.

Source from the content-addressed store, hash-verified

32////////////////////////////////////////////////////////////////////////////////
33// Stuff for the pDomain.
34pDomain::pDomain(PDomainEnum dtype, float a0, float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8)
35{
36 type = dtype;
37 switch (type)
38 {
39 case PDPoint: p1 = pVector(a0, a1, a2); break;
40 case PDLine: {
41 p1 = pVector(a0, a1, a2);
42 pVector tmp(a3, a4, a5);
43 // p2 is vector3 from p1 to other endpoint.
44 p2 = tmp - p1;
45 }
46 break;
47 case PDBox:
48 // p1 is the min corner. p2 is the max corner.
49 if (a0 < a3)
50 {
51 p1.x = a0;
52 p2.x = a3;
53 }
54 else
55 {
56 p1.x = a3;
57 p2.x = a0;
58 }
59 if (a1 < a4)
60 {
61 p1.y = a1;
62 p2.y = a4;
63 }
64 else
65 {
66 p1.y = a4;
67 p2.y = a1;
68 }
69 if (a2 < a5)
70 {
71 p1.z = a2;
72 p2.z = a5;
73 }
74 else
75 {
76 p1.z = a5;
77 p2.z = a2;
78 }
79 break;
80 case PDTriangle: {
81 p1 = pVector(a0, a1, a2);
82 pVector tp2 = pVector(a3, a4, a5);
83 pVector tp3 = pVector(a6, a7, a8);
84
85 u = tp2 - p1;
86 v = tp3 - p1;
87
88 // The rest of this is needed for bouncing.
89 radius1Sqr = u.length();
90 pVector tu = u / radius1Sqr;
91 radius2Sqr = v.length();

Callers

nothing calls this directly

Calls 6

pVectorClass · 0.85
_sqrFunction · 0.85
length2Method · 0.80
_absFunction · 0.50
lengthMethod · 0.45
normalize_safeMethod · 0.45

Tested by

no test coverage detected