00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #pragma once
00014
00015 #include "coreexp.h"
00016 #include "point2.h"
00017 #include "point3.h"
00018 #include "acolor.h"
00019
00020
00021
00022
00023
00024
00025 CoreExport float bias(float a, float b);
00026 CoreExport float gain(float a, float b);
00027 CoreExport float clamp(float x, float a, float b);
00028
00029 CoreExport float boxstep(float a, float b, float x);
00030 CoreExport float smoothstep(float a, float b, float x);
00031 CoreExport float mod(float x, float m);
00032 CoreExport int mod(int x, int m);
00033
00034
00035
00036
00037
00038
00039
00040
00041 CoreExport float sramp(float x,float a, float b, float d);
00042
00043
00044 CoreExport float threshold(float x,float a, float b);
00045
00046 CoreExport void setdebug(int i);
00047 CoreExport float noise1(float arg);
00048 CoreExport float noise2(Point2 p);
00049 CoreExport float noise3(Point3 p);
00050 CoreExport float noise4(Point3 p,float time);
00051
00052
00053
00054 CoreExport float noise3DS(Point3 p);
00055
00056 CoreExport float turbulence(Point3& p, float freq);
00057
00058 CoreExport int Perm(int v);
00059
00060 #define MAX_OCTAVES 50
00061 CoreExport float fBm1(float point, float H, float lacunarity, float octaves);
00062 CoreExport float fBm1(Point2 point, float H, float lacunarity, float octaves);
00063 CoreExport float fBm1(Point3 point, float H, float lacunarity, float octaves);
00064
00065 CoreExport float spline(float x, int nknots, float *knot);
00066
00067 CoreExport Color color_spline(float x, int nknots, Color *knot);
00068
00069
00070
00071 inline int FLOOR( float x) { return ((int)(x) - ((int)(x)>(x)? 1:0)); }
00072
00073 inline float frac(float x) { return x - (float)FLOOR(x); }
00074 inline float fmax(float x, float y) { return x>y?x:y; }
00075 inline float fmin(float x, float y) { return x<y?x:y; }
00076
00077
00078 #define NOISE(p) ((1.0f+noise3DS(p))*.5f)
00079
00080
00081 inline AColor AComp(AColor cbot, AColor ctop) {
00082 float ia = 1.0f - ctop.a;
00083 return (ctop + ia*cbot);
00084 }
00085
00086
00087
00088
00089
00090
00091
00092
00093 #define MAX_CELL_LEVELS 20
00094
00095 CoreExport void CellFunction(Point3 v,int n,float *dist,int *celIDs=NULL,Point3 *grads=NULL,float gradSmooth=0.0f);
00096 CoreExport void FractalCellFunction(Point3 v,float iterations, float lacunarity,int n,float *dist,int *celIDs=NULL,Point3 *grads=NULL,float gradSmooth=0.0f);
00097 CoreExport float RandFromCellID(int id);
00098