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;
61 float remap(
float x,
float inMin,
float inMax,
float outMin,
float outMax)
const;
63 float degToRad(
float deg)
const;
65 float radToDeg(
float rad)
const;
67 float sign(
float x)
const;
69 float fract(
float x)
const;
71 float approach(
float current,
float target,
float maxDelta)
const;
73 float wrap(
float x,
float lo,
float hi)
const;
75 float pingPong(
float t,
float length)
const;
79 float inverseLerp(
float a,
float b,
float x)
const;
81 float smootherstep(
float edge0,
float edge1,
float x)
const;
83 float bias(
float t,
float b)
const;
85 float gain(
float t,
float g)
const;
91 float ease(
float t,
const std::string &
kind)
const;
95 float quantize(
float x,
float stepSize)
const;
97 float snap(
float x,
float grid)
const;
101 float length2(
float x,
float y)
const;
103 float length3(
float x,
float y,
float z)
const;
105 float distance2(
float x1,
float y1,
float x2,
float y2)
const;
107 float distance3(
float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
const;
109 float dot2(
float x1,
float y1,
float x2,
float y2)
const;
111 float dot3(
float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
const;
113 float cross2(
float x1,
float y1,
float x2,
float y2)
const;
115 float angle2(
float x,
float y)
const;
117 float angleBetween2(
float x1,
float y1,
float x2,
float y2)
const;
119 float lerpAngle(
float a,
float b,
float t)
const;
121 float normalize2X(
float x,
float y)
const;
123 float normalize2Y(
float x,
float y)
const;
125 float normalize3X(
float x,
float y,
float z)
const;
127 float normalize3Y(
float x,
float y,
float z)
const;
129 float normalize3Z(
float x,
float y,
float z)
const;
133 Vec2 *steeringSeek2(
float x,
float y,
float targetX,
float targetY,
float maxSpeed)
const;
135 Vec3 *steeringSeek3(
float x,
float y,
float z,
float targetX,
float targetY,
float targetZ,
136 float maxSpeed)
const;
138 Vec2 *steeringFlee2(
float x,
float y,
float targetX,
float targetY,
float maxSpeed)
const;
140 Vec3 *steeringFlee3(
float x,
float y,
float z,
float targetX,
float targetY,
float targetZ,
141 float maxSpeed)
const;
143 Vec2 *steeringArrive2(
float x,
float y,
float targetX,
float targetY,
float maxSpeed,
144 float slowRadius,
float stopRadius)
const;
146 Vec3 *steeringArrive3(
float x,
float y,
float z,
float targetX,
float targetY,
float targetZ,
147 float maxSpeed,
float slowRadius,
float stopRadius)
const;
149 Vec2 *steeringSeparation2(
float x,
float y,
const std::string &neighbors,
float radius,
152 Vec3 *steeringSeparation3(
float x,
float y,
float z,
const std::string &neighbors,
155 int steeringPathTarget2(
float x,
float y,
const std::string &
points,
int current,
156 float tolerance)
const;
158 int steeringPathTarget3(
float x,
float y,
float z,
const std::string &
points,
int current,
159 float tolerance)
const;
161 Vec2 *steeringAvoid2(
float x,
float y,
float velocityX,
float velocityY,
float obstacleX,
162 float obstacleY,
float obstacleRadius,
float lookAhead,
165 Vec3 *steeringAvoid3(
float x,
float y,
float z,
float velocityX,
float velocityY,
166 float velocityZ,
float obstacleX,
float obstacleY,
float obstacleZ,
170 float rotate2X(
float x,
float y,
float radians)
const;
172 float rotate2Y(
float x,
float y,
float radians)
const;
174 float polarX(
float radius,
float radians)
const;
176 float polarY(
float radius,
float radians)
const;
178 float cartesianRadius(
float x,
float y)
const;
180 float cartesianAngle(
float x,
float y)
const;
184 bool pointInCircle(
float px,
float py,
float cx,
float cy,
float radius)
const;
186 bool pointInRect(
float px,
float py,
float rx,
float ry,
float rw,
float rh)
const;
188 bool circlesOverlap(
float x1,
float y1,
float r1,
float x2,
float y2,
float r2)
const;
190 bool rectsOverlap(
float x1,
float y1,
float w1,
float h1,
float x2,
float y2,
float w2,
193 bool circleRectOverlap(
float cx,
float cy,
float radius,
float rx,
float ry,
float rw,
196 bool segmentsIntersect(
float ax,
float ay,
float bx,
float by,
float cx,
float cy,
float dx,
202 float raycastCircle2(
float ox,
float oy,
float dx,
float dy,
float cx,
float cy,
205 float raycastRect2(
float ox,
float oy,
float dx,
float dy,
float rx,
float ry,
float rw,
208 float closestPointOnSegment2X(
float px,
float py,
float ax,
float ay,
float bx,
float by)
const;
210 float closestPointOnSegment2Y(
float px,
float py,
float ax,
float ay,
float bx,
float by)
const;
214 bool pointInSphere(
float px,
float py,
float pz,
float cx,
float cy,
float cz,
217 bool pointInBox(
float px,
float py,
float pz,
float minX,
float minY,
float minZ,
float maxX,
218 float maxY,
float maxZ)
const;
220 bool spheresOverlap(
float x1,
float y1,
float z1,
float r1,
float x2,
float y2,
float z2,
223 bool boxesOverlap(
float minAx,
float minAy,
float minAz,
float maxAx,
float maxAy,
float maxAz,
224 float minBx,
float minBy,
float minBz,
float maxBx,
float maxBy,
227 float raycastSphere(
float ox,
float oy,
float oz,
float dx,
float dy,
float dz,
float cx,
228 float cy,
float cz,
float radius)
const;
230 float raycastBox(
float ox,
float oy,
float oz,
float dx,
float dy,
float dz,
float minX,
231 float minY,
float minZ,
float maxX,
float maxY,
float maxZ)
const;
236 float raycastPlane(
float ox,
float oy,
float oz,
float dx,
float dy,
float dz,
float px,
237 float py,
float pz,
float nx,
float ny,
float nz)
const;
239 float closestPointOnSegment3X(
float px,
float py,
float pz,
float ax,
float ay,
float az,
240 float bx,
float by,
float bz)
const;
242 float closestPointOnSegment3Y(
float px,
float py,
float pz,
float ax,
float ay,
float az,
243 float bx,
float by,
float bz)
const;
245 float closestPointOnSegment3Z(
float px,
float py,
float pz,
float ax,
float ay,
float az,
246 float bx,
float by,
float bz)
const;
249 float bilinear(
float v00,
float v10,
float v01,
float v11,
float u,
float v)
const;
253 void setRandomSeed(uint32_t
seed);
255 void setRandomSeedFromTime();
257 uint32_t getRandomSeed()
const;
261 float randomRange(
float min,
float max);
263 int randomInt(
int min,
int maxInclusive);
265 float randomGaussian(
float mean,
float stddev);
269 float hash1(
float x)
const;
271 float hash2(
float x,
float y)
const;
273 float hash3(
float x,
float y,
float z)
const;
280 float noise1(
float x)
const;
282 float noise2(
float x,
float y)
const;
284 float noise3(
float x,
float y,
float z)
const;
286 float simplex1(
float x)
const;
288 float simplex2(
float x,
float y)
const;
290 float simplex3(
float x,
float y,
float z)
const;
292 float perlin2(
float x,
float y)
const;
294 float perlin3(
float x,
float y,
float z)
const;
296 float white2(
float x,
float y)
const;
298 float value2(
float x,
float y)
const;
304 float fbm2(
float x,
float y,
int octaves = 4,
float lacunarity = 2.f,
305 float gain = 0.5f)
const;
307 float fbm3(
float x,
float y,
float z,
int octaves = 4,
float lacunarity = 2.f,
308 float gain = 0.5f)
const;
310 float ridged2(
float x,
float y,
int octaves = 4,
float lacunarity = 2.f,
311 float gain = 0.5f)
const;
313 float ridged3(
float x,
float y,
float z,
int octaves = 4,
float lacunarity = 2.f,
314 float gain = 0.5f)
const;
316 float turbulence2(
float x,
float y,
int octaves = 4,
float lacunarity = 2.f,
317 float gain = 0.5f)
const;
319 float billow2(
float x,
float y,
int octaves = 4,
float lacunarity = 2.f,
float gain = 0.5f)
const;
325 float voronoi2(
float x,
float y)
const;
327 float voronoiEdge2(
float x,
float y)
const;
329 float worley2(
float x,
float y)
const;
335 float warpNoise2(
float x,
float y,
float warpAmp = 1.f)
const;
339 float warpNoise2Deep(
float x,
float y,
float warpAmp = 1.f)
const;
342 float voronoiF2_2(
float x,
float y)
const;
344 float worleyManhattan2(
float x,
float y)
const;
346 float worleyChebyshev2(
float x,
float y)
const;
348 float worleySmooth2(
float x,
float y,
float smoothness)
const;
351 float curlNoise2X(
float x,
float y,
float eps)
const;
353 float curlNoise2Y(
float x,
float y,
float eps)
const;
356 float hexDistance2(
float x,
float y)
const;
358 float hexEdge2(
float x,
float y,
float width,
float soft)
const;
361 float gyroid3(
float x,
float y,
float z)
const;
363 float gyroidFbm3(
float x,
float y,
float z,
int octaves)
const;
366 float swiss2(
float x,
float y,
int octaves,
float lacunarity,
float gain,
float warpStrength)
const;
368 float hybrid2(
float x,
float y,
int octaves,
float lacunarity,
float gain,
float offset)
const;
370 float jordan2(
float x,
float y,
int octaves,
float lacunarity,
float gain,
float warpStrength)
const;
373 float gabor2(
float x,
float y,
float dirX,
float dirY,
float frequency)
const;
375 float gaborFbm2(
float x,
float y,
int octaves,
float dirX,
float dirY)
const;
378 float valueDx2(
float x,
float y,
float eps)
const;
380 float valueDy2(
float x,
float y,
float eps)
const;
382 float valueSlope2(
float x,
float y,
float eps)
const;
385 float isoLine2(
float x,
float y,
int levels,
float width)
const;
387 float banding2(
float x,
float y,
int bands)
const;
389 float fbmColor2(
float x,
float y,
int channel,
int octaves,
float lacunarity,
float gain)
const;
392 float white3(
float x,
float y,
float z)
const;
394 float value3(
float x,
float y,
float z)
const;
396 float worley3(
float x,
float y,
float z)
const;
400 float bezierQuadratic(
float t,
float p0,
float p1,
float p2)
const;
402 float bezierCubic(
float t,
float p0,
float p1,
float p2,
float p3)
const;
404 float bezierQuadratic2X(
float t,
float x0,
float y0,
float x1,
float y1,
float x2,
407 float bezierQuadratic2Y(
float t,
float x0,
float y0,
float x1,
float y1,
float x2,
410 float bezierCubic2X(
float t,
float x0,
float y0,
float x1,
float y1,
float x2,
float y2,
411 float x3,
float y3)
const;
413 float bezierCubic2Y(
float t,
float x0,
float y0,
float x1,
float y1,
float x2,
float y2,
414 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).
float smoothMax(float a, float b, float width)
C1 polynomial maximum for blending two height fields.