32 Vec2 *newVec2(
float x = 0.f,
float y = 0.f);
34 Vec3 *newVec3(
float x = 0.f,
float y = 0.f,
float z = 0.f);
38 Mat4 *newMat4Translation(
float x,
float y,
float z);
40 Mat4 *newMat4Scale(
float sx,
float sy,
float sz);
42 Mat4 *newMat4RotationZ(
float radians);
46 float clamp(
float x,
float lo,
float hi)
const;
48 float lerp(
float a,
float b,
float t)
const;
50 float smoothstep(
float edge0,
float edge1,
float x)
const;
52 float remap(
float x,
float inMin,
float inMax,
float outMin,
float outMax)
const;
54 float degToRad(
float deg)
const;
56 float radToDeg(
float rad)
const;
58 float sign(
float x)
const;
60 float fract(
float x)
const;
62 float approach(
float current,
float target,
float maxDelta)
const;
64 float wrap(
float x,
float lo,
float hi)
const;
66 float pingPong(
float t,
float length)
const;
70 float inverseLerp(
float a,
float b,
float x)
const;
72 float smootherstep(
float edge0,
float edge1,
float x)
const;
74 float bias(
float t,
float b)
const;
76 float gain(
float t,
float g)
const;
82 float ease(
float t,
const std::string &
kind)
const;
86 float quantize(
float x,
float stepSize)
const;
88 float snap(
float x,
float grid)
const;
92 float length2(
float x,
float y)
const;
94 float length3(
float x,
float y,
float z)
const;
96 float distance2(
float x1,
float y1,
float x2,
float y2)
const;
98 float distance3(
float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
const;
100 float dot2(
float x1,
float y1,
float x2,
float y2)
const;
102 float dot3(
float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
const;
104 float cross2(
float x1,
float y1,
float x2,
float y2)
const;
106 float angle2(
float x,
float y)
const;
108 float angleBetween2(
float x1,
float y1,
float x2,
float y2)
const;
110 float lerpAngle(
float a,
float b,
float t)
const;
112 float normalize2X(
float x,
float y)
const;
114 float normalize2Y(
float x,
float y)
const;
116 float normalize3X(
float x,
float y,
float z)
const;
118 float normalize3Y(
float x,
float y,
float z)
const;
120 float normalize3Z(
float x,
float y,
float z)
const;
124 Vec2 *steeringSeek2(
float x,
float y,
float targetX,
float targetY,
float maxSpeed)
const;
126 Vec3 *steeringSeek3(
float x,
float y,
float z,
float targetX,
float targetY,
float targetZ,
127 float maxSpeed)
const;
129 Vec2 *steeringFlee2(
float x,
float y,
float targetX,
float targetY,
float maxSpeed)
const;
131 Vec3 *steeringFlee3(
float x,
float y,
float z,
float targetX,
float targetY,
float targetZ,
132 float maxSpeed)
const;
134 Vec2 *steeringArrive2(
float x,
float y,
float targetX,
float targetY,
float maxSpeed,
135 float slowRadius,
float stopRadius)
const;
137 Vec3 *steeringArrive3(
float x,
float y,
float z,
float targetX,
float targetY,
float targetZ,
138 float maxSpeed,
float slowRadius,
float stopRadius)
const;
140 Vec2 *steeringSeparation2(
float x,
float y,
const std::string &neighbors,
float radius,
141 float maxAcceleration)
const;
143 Vec3 *steeringSeparation3(
float x,
float y,
float z,
const std::string &neighbors,
144 float radius,
float maxAcceleration)
const;
146 int steeringPathTarget2(
float x,
float y,
const std::string &
points,
int current,
147 float tolerance)
const;
149 int steeringPathTarget3(
float x,
float y,
float z,
const std::string &
points,
int current,
150 float tolerance)
const;
152 Vec2 *steeringAvoid2(
float x,
float y,
float velocityX,
float velocityY,
float obstacleX,
153 float obstacleY,
float obstacleRadius,
float lookAhead,
154 float maxAcceleration)
const;
156 Vec3 *steeringAvoid3(
float x,
float y,
float z,
float velocityX,
float velocityY,
157 float velocityZ,
float obstacleX,
float obstacleY,
float obstacleZ,
158 float obstacleRadius,
float lookAhead,
float maxAcceleration)
const;
161 float rotate2X(
float x,
float y,
float radians)
const;
163 float rotate2Y(
float x,
float y,
float radians)
const;
165 float polarX(
float radius,
float radians)
const;
167 float polarY(
float radius,
float radians)
const;
169 float cartesianRadius(
float x,
float y)
const;
171 float cartesianAngle(
float x,
float y)
const;
175 bool pointInCircle(
float px,
float py,
float cx,
float cy,
float radius)
const;
177 bool pointInRect(
float px,
float py,
float rx,
float ry,
float rw,
float rh)
const;
179 bool circlesOverlap(
float x1,
float y1,
float r1,
float x2,
float y2,
float r2)
const;
181 bool rectsOverlap(
float x1,
float y1,
float w1,
float h1,
float x2,
float y2,
float w2,
184 bool circleRectOverlap(
float cx,
float cy,
float radius,
float rx,
float ry,
float rw,
187 bool segmentsIntersect(
float ax,
float ay,
float bx,
float by,
float cx,
float cy,
float dx,
193 float raycastCircle2(
float ox,
float oy,
float dx,
float dy,
float cx,
float cy,
196 float raycastRect2(
float ox,
float oy,
float dx,
float dy,
float rx,
float ry,
float rw,
199 float closestPointOnSegment2X(
float px,
float py,
float ax,
float ay,
float bx,
float by)
const;
201 float closestPointOnSegment2Y(
float px,
float py,
float ax,
float ay,
float bx,
float by)
const;
205 bool pointInSphere(
float px,
float py,
float pz,
float cx,
float cy,
float cz,
208 bool pointInBox(
float px,
float py,
float pz,
float minX,
float minY,
float minZ,
float maxX,
209 float maxY,
float maxZ)
const;
211 bool spheresOverlap(
float x1,
float y1,
float z1,
float r1,
float x2,
float y2,
float z2,
214 bool boxesOverlap(
float minAx,
float minAy,
float minAz,
float maxAx,
float maxAy,
float maxAz,
215 float minBx,
float minBy,
float minBz,
float maxBx,
float maxBy,
218 float raycastSphere(
float ox,
float oy,
float oz,
float dx,
float dy,
float dz,
float cx,
219 float cy,
float cz,
float radius)
const;
221 float raycastBox(
float ox,
float oy,
float oz,
float dx,
float dy,
float dz,
float minX,
222 float minY,
float minZ,
float maxX,
float maxY,
float maxZ)
const;
227 float raycastPlane(
float ox,
float oy,
float oz,
float dx,
float dy,
float dz,
float px,
228 float py,
float pz,
float nx,
float ny,
float nz)
const;
230 float closestPointOnSegment3X(
float px,
float py,
float pz,
float ax,
float ay,
float az,
231 float bx,
float by,
float bz)
const;
233 float closestPointOnSegment3Y(
float px,
float py,
float pz,
float ax,
float ay,
float az,
234 float bx,
float by,
float bz)
const;
236 float closestPointOnSegment3Z(
float px,
float py,
float pz,
float ax,
float ay,
float az,
237 float bx,
float by,
float bz)
const;
240 float bilinear(
float v00,
float v10,
float v01,
float v11,
float u,
float v)
const;
244 void setRandomSeed(uint32_t
seed);
246 void setRandomSeedFromTime();
248 uint32_t getRandomSeed()
const;
252 float randomRange(
float min,
float max);
254 int randomInt(
int min,
int maxInclusive);
256 float randomGaussian(
float mean,
float stddev);
260 float hash1(
float x)
const;
262 float hash2(
float x,
float y)
const;
264 float hash3(
float x,
float y,
float z)
const;
268 float noise1(
float x)
const;
270 float noise2(
float x,
float y)
const;
272 float noise3(
float x,
float y,
float z)
const;
274 float perlin2(
float x,
float y)
const;
276 float perlin3(
float x,
float y,
float z)
const;
282 float fbm2(
float x,
float y,
int octaves = 4,
float lacunarity = 2.f,
283 float gain = 0.5f)
const;
285 float fbm3(
float x,
float y,
float z,
int octaves = 4,
float lacunarity = 2.f,
286 float gain = 0.5f)
const;
288 float ridged2(
float x,
float y,
int octaves = 4,
float lacunarity = 2.f,
289 float gain = 0.5f)
const;
291 float ridged3(
float x,
float y,
float z,
int octaves = 4,
float lacunarity = 2.f,
292 float gain = 0.5f)
const;
294 float turbulence2(
float x,
float y,
int octaves = 4,
float lacunarity = 2.f,
295 float gain = 0.5f)
const;
301 float voronoi2(
float x,
float y)
const;
303 float voronoiEdge2(
float x,
float y)
const;
309 float warpNoise2(
float x,
float y,
float warpAmp = 1.f)
const;
313 float bezierQuadratic(
float t,
float p0,
float p1,
float p2)
const;
315 float bezierCubic(
float t,
float p0,
float p1,
float p2,
float p3)
const;
317 float bezierQuadratic2X(
float t,
float x0,
float y0,
float x1,
float y1,
float x2,
320 float bezierQuadratic2Y(
float t,
float x0,
float y0,
float x1,
float y1,
float x2,
323 float bezierCubic2X(
float t,
float x0,
float y0,
float x1,
float y1,
float x2,
float y2,
324 float x3,
float y3)
const;
326 float bezierCubic2Y(
float t,
float x0,
float y0,
float x1,
float y1,
float x2,
float y2,
327 float x3,
float y3)
const;
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
std::shared_ptr< const std::vector< glm::vec2 > > points
std::unordered_map< std::uint32_t, std::uint32_t > remap
EVENGINE_API_FOUNDATION public API.
Column-major 4x4 matrix wrapping glm::mat4.
Math module — glm-backed vectors/matrices, noise, bezier, random. Script: math <- eve....
~Math() override=default
Releases module state; caller-owned Vec/Mat pointers are not freed.
2D float vector (script-facing math module value).
3D float vector (script-facing math module value).