• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ s_curve函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中s_curve函数的典型用法代码示例。如果您正苦于以下问题:C++ s_curve函数的具体用法?C++ s_curve怎么用?C++ s_curve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了s_curve函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: setup

	float PerlinNoise::noise2(float x, float y) {
		float vec[2] = { x, y };
		int 			bx0, bx1, by0, by1, b00, b10, b01, b11;
		float 			rx0, rx1, ry0, ry1, sx, sy, a, b, t, u, v;
		const float* q;
		register int i, j;

		setup(0, bx0,bx1, rx0,rx1);
		setup(1, by0,by1, ry0,ry1);

		i = p[ bx0 ];
		j = p[ bx1 ];

		b00 = p[ i + by0 ];
		b10 = p[ j + by0 ];
		b01 = p[ i + by1 ];
		b11 = p[ j + by1 ];

		sx = s_curve(rx0);
		sy = s_curve(ry0);

#define at2(rx,ry) (rx * q[0] + ry * q[1])

		q = g2[ b00 ] ; u = at2(rx0,ry0);
		q = g2[ b10 ] ; v = at2(rx1,ry0);
		a = lerp(sx, u, v);

		q = g2[ b01 ] ; u = at2(rx0,ry1);
		q = g2[ b11 ] ; v = at2(rx1,ry1);
		b = lerp(sx, u, v);

		return lerp(sy, a, b);
	}
开发者ID:CharlieCraft,项目名称:axonengine,代码行数:33,代码来源:perlinnoise.cpp


示例2: srand

double Perlin::noise2(double vec[2])
{
	int bx0, bx1, by0, by1, b00, b10, b01, b11;
	double rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
	int i, j;
	if (mStart)
	{
		srand(mSeed);
		mStart = false;
		init();
	}
	setup(0,bx0,bx1,rx0,rx1);
	setup(1,by0,by1,ry0,ry1);	i = p[bx0];
	j = p[bx1];	b00 = p[i + by0];
	b10 = p[j + by0];
	b01 = p[i + by1];
	b11 = p[j + by1];	
	sx = s_curve(rx0);
	sy = s_curve(ry0);  
	#define at2(rx,ry) ( rx * q[0] + ry * q[1] )
	q = g2[b00];
	u = at2(rx0,ry0);
	q = g2[b10];
	v = at2(rx1,ry0);
	a = lerp(sx, u, v);	q = g2[b01];
	u = at2(rx0,ry1);
	q = g2[b11];
	v = at2(rx1,ry1);
	b = lerp(sx, u, v);	
	return lerp(sy, a, b);
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:31,代码来源:GlGener.cpp


示例3: noise2

                T
        noise2 (
                T		 vec[2])
        {
                int		 bx0, bx1, by0, by1, b00, b10, b01, b11;
                T		 rx0, rx1, ry0, ry1, sx, sy, a, b, u, v;
                int		 i, j;

                setup(vec[0],bx0,bx1,rx0,rx1);
                setup(vec[1],by0,by1,ry0,ry1);

                i = p[bx0];
                j = p[bx1];

                b00 = p[i + by0];
                b10 = p[j + by0];
                b01 = p[i + by1];
                b11 = p[j + by1];

                sx = s_curve(rx0);
                sy = s_curve(ry0);

                u = at2(rx0,ry0,b00);
                v = at2(rx1,ry0,b10);
                a = lerp(sx, u, v);

                u = at2(rx0,ry1,b01);
                v = at2(rx1,ry1,b11);
                b = lerp(sx, u, v);

                return lerp(sy, a, b);
        }
开发者ID:kioku-systemk,项目名称:mrzExporter,代码行数:32,代码来源:lxu_math.hpp


示例4: setup

float PerlinNoise::Noise2(float x, float y)
{
  int bx0, bx1, by0, by1, b00, b10, b01, b11;
  float rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
  int i, j;

  setup(x, bx0,bx1, rx0,rx1);
  setup(y, by0,by1, ry0,ry1);

  i = p[ bx0 ];
  j = p[ bx1 ];

  b00 = p[ i + by0 ];
  b10 = p[ j + by0 ];
  b01 = p[ i + by1 ];
  b11 = p[ j + by1 ];

  sx = s_curve(rx0);
  sy = s_curve(ry0);

#define at2(rx,ry) ( rx * q[0] + ry * q[1] )

  q = g2[ b00 ] ; u = at2(rx0,ry0);
  q = g2[ b10 ] ; v = at2(rx1,ry0);
  a = lerp(sx, u, v);

  q = g2[ b01 ] ; u = at2(rx0,ry1);
  q = g2[ b11 ] ; v = at2(rx1,ry1);
  b = lerp(sx, u, v);

  return lerp(sy, a, b);
}
开发者ID:denesik,项目名称:World,代码行数:32,代码来源:PerlinNoise.cpp


示例5: noise2

double noise2(double vec[2])
{
   int bx0, bx1, by0, by1, b00, b10, b01, b11;
   double rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
   int i, j;

   if (start) {
      start = 0;
      noiseinit();
   }

   setup(0, bx0,bx1, rx0,rx1);
   setup(1, by0,by1, ry0,ry1);

   i = p[ bx0 ];
   j = p[ bx1 ];

   b00 = p[ i + by0 ];
   b10 = p[ j + by0 ];
   b01 = p[ i + by1 ];
   b11 = p[ j + by1 ];

   sx = s_curve(rx0);
   sy = s_curve(ry0);

   q = g2[ b00 ] ; u = at2(rx0,ry0);
   q = g2[ b10 ] ; v = at2(rx1,ry0);
   a = lerp(sx, u, v);

   q = g2[ b01 ] ; u = at2(rx0,ry1);
   q = g2[ b11 ] ; v = at2(rx1,ry1);
   b = lerp(sx, u, v);

   return lerp(sy, a, b);
}
开发者ID:nbingham1,项目名称:Effects,代码行数:35,代码来源:mathdef.cpp


示例6: noise2

float noise2(float vec[2])
{
	int bx0, bx1, by0, by1, b00, b10, b01, b11;
	float rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
	register int i, j;
	if (start) {
		start = 0;
		init();
	}
	setup(0, bx0,bx1, rx0,rx1);
	setup(1, by0,by1, ry0,ry1);
	i = p[ bx0 ];
	j = p[ bx1 ];
	b00 = p[ i + by0 ];
	b10 = p[ j + by0 ];
	b01 = p[ i + by1 ];
	b11 = p[ j + by1 ];
	sx = s_curve(rx0);
	sy = s_curve(ry0);
#define at2(rx,ry) ( rx * q[0] + ry * q[1] )
	q = g2[ b00 ] ; u = at2(rx0,ry0);
	q = g2[ b10 ] ; v = at2(rx1,ry0);
	a = lerp(sx, u, v);
	q = g2[ b01 ] ; u = at2(rx0,ry1);
	q = g2[ b11 ] ; v = at2(rx1,ry1);
	b = lerp(sx, u, v);
	return lerp(sy, a, b);
}
开发者ID:rawritsjoann,项目名称:cs371_project,代码行数:28,代码来源:perlin.cpp


示例7: noise2

float noise2(const float x, const float y){
	int bx0, bx1, by0, by1, b00, b10, b01, b11;
	float rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
	int i, j;

	setup(x, bx0,bx1, rx0,rx1);
	setup(y, by0,by1, ry0,ry1);

	i = p[bx0];
	j = p[bx1];

	b00 = p[i + by0];
	b10 = p[j + by0];
	b01 = p[i + by1];
	b11 = p[j + by1];

	sx = s_curve(rx0);
	sy = s_curve(ry0);


	q = g2[b00]; u = at2(rx0,ry0);
	q = g2[b10]; v = at2(rx1,ry0);
	a = lerp(sx, u, v);

	q = g2[b01]; u = at2(rx0,ry1);
	q = g2[b11]; v = at2(rx1,ry1);
	b = lerp(sx, u, v);

	return lerp(sy, a, b);
}
开发者ID:dtrebilco,项目名称:PreMulAlpha,代码行数:30,代码来源:Noise.cpp


示例8: setup

double PerlinGenerator::noise2(double vec[2])
{
  int bx0, bx1, by0, by1, b00, b10, b01, b11;
  double rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
  int i, j;

  setup(0, t,vec, bx0,bx1, rx0,rx1);
  setup(1, t,vec, by0,by1, ry0,ry1);

  i = p[ bx0 ];
  j = p[ bx1 ];

  b00 = p[ i + by0 ];
  b10 = p[ j + by0 ];
  b01 = p[ i + by1 ];
  b11 = p[ j + by1 ];

  sx = s_curve(rx0);
  sy = s_curve(ry0);

  q = g2[ b00 ] ; u = at2(rx0,ry0);
  q = g2[ b10 ] ; v = at2(rx1,ry0);
  a = perlin_lerp(sx, u, v);

  q = g2[ b01 ] ; u = at2(rx0,ry1);
  q = g2[ b11 ] ; v = at2(rx1,ry1);
  b = perlin_lerp(sx, u, v);

  return perlin_lerp(sy, a, b);
}
开发者ID:sdp0et,项目名称:gtp,代码行数:30,代码来源:perlin.cpp


示例9: setup

 I noisetest::noise2(I vec[2])
 {
   int bx0, bx1, by0, by1, b00, b10, b01, b11;
   I rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
   int i, j;
   
   setup(0, bx0,bx1, rx0,rx1);
   setup(1, by0,by1, ry0,ry1);
   
   i = p[ bx0 ];
   j = p[ bx1 ];
   
   b00 = p[ i + by0 ];
   b10 = p[ j + by0 ];
   b01 = p[ i + by1 ];
   b11 = p[ j + by1 ];
   
   sx = s_curve(rx0);
   sy = s_curve(ry0);
   
   q = g2[ b00 ] ; u = at2(rx0,ry0);
   q = g2[ b10 ] ; v = at2(rx1,ry0);
   a = lerp(sx, u, v);
   
   q = g2[ b01 ] ; u = at2(rx0,ry1);
   q = g2[ b11 ] ; v = at2(rx1,ry1);
   b = lerp(sx, u, v);
   
   return lerp(sy, a, b);
 }
开发者ID:cuugi,项目名称:yapat,代码行数:30,代码来源:noisetest.cpp


示例10: Init

//----------------------------------------------------------------------------
float FvPerlinNoise::Noise2(const FvVector2& vec)
{
	int bx0, bx1, by0, by1, b00, b10, b01, b11;
	float rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
	register int i, j;

	if (start) {
		start = false;
		Init();
	}

	setup(0, bx0,bx1, rx0,rx1);
	setup(1, by0,by1, ry0,ry1);

	i = p[ bx0 ];
	j = p[ bx1 ];

	b00 = p[ i + by0 ];
	b10 = p[ j + by0 ];
	b01 = p[ i + by1 ];
	b11 = p[ j + by1 ];

	sx = s_curve(rx0);
	sy = s_curve(ry0);

	q = g2[ b00 ] ; u = at2(rx0,ry0);
	q = g2[ b10 ] ; v = at2(rx1,ry0);
	a = FV_LERP(sx, u, v);

	q = g2[ b01 ] ; u = at2(rx0,ry1);
	q = g2[ b11 ] ; v = at2(rx1,ry1);
	b = FV_LERP(sx, u, v);

	return FV_LERP(sy, a, b);
}
开发者ID:Kiddinglife,项目名称:geco-game-engine,代码行数:36,代码来源:FvPerlinNoise.cpp


示例11: init

double PerlinNoise::noise3(double f1, double f2, double f3)
{
  int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
  double rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
  register int i, j;

  double vec[3];  

  vec[0] = f1;
  vec[1] = f2;
  vec[2] = f3;
  
  if (start) {
    start = 0;
    init();
  }
  
  setup(0, bx0,bx1, rx0,rx1);
  setup(1, by0,by1, ry0,ry1);
  setup(2, bz0,bz1, rz0,rz1);
  
  i = p[ bx0 ];
  j = p[ bx1 ];
  
  b00 = p[ i + by0 ];
  b10 = p[ j + by0 ];
  b01 = p[ i + by1 ];
  b11 = p[ j + by1 ];
  
  t  = s_curve(rx0);
  sy = s_curve(ry0);
  sz = s_curve(rz0);
  
#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )
  
  q = g3[ b00 + bz0 ] ; u = at3(rx0,ry0,rz0);
  q = g3[ b10 + bz0 ] ; v = at3(rx1,ry0,rz0);
  a = lerp(t, u, v);
  
  q = g3[ b01 + bz0 ] ; u = at3(rx0,ry1,rz0);
  q = g3[ b11 + bz0 ] ; v = at3(rx1,ry1,rz0);
  b = lerp(t, u, v);
  
  c = lerp(sy, a, b);
  
  q = g3[ b00 + bz1 ] ; u = at3(rx0,ry0,rz1);
  q = g3[ b10 + bz1 ] ; v = at3(rx1,ry0,rz1);
  a = lerp(t, u, v);
  
  q = g3[ b01 + bz1 ] ; u = at3(rx0,ry1,rz1);
  q = g3[ b11 + bz1 ] ; v = at3(rx1,ry1,rz1);
  b = lerp(t, u, v);
  
  d = lerp(sy, a, b);
  
  return lerp(sz, c, d);
}
开发者ID:barakianc,项目名称:CS174C_PhysicsAnimation,代码行数:57,代码来源:noise.cpp


示例12: noise3

scalar_t noise3(scalar_t x, scalar_t y, scalar_t z)
{
	int i, j;
	int bx0, bx1, by0, by1, bz0, bz1;
	int b00, b10, b01, b11;
	scalar_t rx0, rx1, ry0, ry1, rz0, rz1;
	scalar_t sx, sy, sz;
	scalar_t u, v, a, b, c, d;

	if(!tables_valid) {
		init_noise();
		tables_valid = 1;
	}

	setup(x, bx0, bx1, rx0, rx1);
	setup(y, by0, by1, ry0, ry1);
	setup(z, bz0, bz1, rz0, rz1);

	i = perm[bx0];
	j = perm[bx1];

	b00 = perm[i + by0];
	b10 = perm[j + by0];
	b01 = perm[i + by1];
	b11 = perm[j + by1];

	/* calculate hermite interpolating factors */
	sx = s_curve(rx0);
	sy = s_curve(ry0);
	sz = s_curve(rz0);

	/* interpolate along the top slice of the cell */
	u = v3_dot(grad3[b00 + bz0], v3_cons(rx0, ry0, rz0));
	v = v3_dot(grad3[b10 + bz0], v3_cons(rx1, ry0, rz0));
	a = lerp(u, v, sx);

	u = v3_dot(grad3[b01 + bz0], v3_cons(rx0, ry1, rz0));
	v = v3_dot(grad3[b11 + bz0], v3_cons(rx1, ry1, rz0));
	b = lerp(u, v, sx);

	c = lerp(a, b, sy);

	/* interpolate along the bottom slice of the cell */
	u = v3_dot(grad3[b00 + bz0], v3_cons(rx0, ry0, rz1));
	v = v3_dot(grad3[b10 + bz0], v3_cons(rx1, ry0, rz1));
	a = lerp(u, v, sx);

	u = v3_dot(grad3[b01 + bz0], v3_cons(rx0, ry1, rz1));
	v = v3_dot(grad3[b11 + bz0], v3_cons(rx1, ry1, rz1));
	b = lerp(u, v, sx);

	d = lerp(a, b, sy);

	/* interpolate between slices */
	return lerp(c, d, sz);
}
开发者ID:MutantStargoat,项目名称:calacirya,代码行数:56,代码来源:vmath.c


示例13: init

F32 LLPerlinNoise::noise3(F32 x, F32 y, F32 z)
{
	U8 bx0, bx1, by0, by1, bz0, bz1;
	S32 b00, b10, b01, b11;
	F32 rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
	S32 i, j;

	if (!sInitialized)
		init();

	fast_setup(x, bx0,bx1, rx0,rx1);
	fast_setup(y, by0,by1, ry0,ry1);
	fast_setup(z, bz0,bz1, rz0,rz1);

	i = p[ bx0 ];
	j = p[ bx1 ];

	b00 = p[ i + by0 ];
	b10 = p[ j + by0 ];
	b01 = p[ i + by1 ];
	b11 = p[ j + by1 ];

	t  = s_curve(rx0);
	sy = s_curve(ry0);
	sz = s_curve(rz0);

	q = g3[ b00 + bz0 ]; 
	u = fast_at3(rx0,ry0,rz0,q);
	q = g3[ b10 + bz0 ];
	v = fast_at3(rx1,ry0,rz0,q);
	a = lerp_m(t, u, v);

	q = g3[ b01 + bz0 ];
	u = fast_at3(rx0,ry1,rz0,q);
	q = g3[ b11 + bz0 ];
	v = fast_at3(rx1,ry1,rz0,q);
	b = lerp_m(t, u, v);

	c = lerp_m(sy, a, b);

	q = g3[ b00 + bz1 ];
	u = fast_at3(rx0,ry0,rz1,q);
	q = g3[ b10 + bz1 ];
	v = fast_at3(rx1,ry0,rz1,q);
	a = lerp_m(t, u, v);

	q = g3[ b01 + bz1 ];
	u = fast_at3(rx0,ry1,rz1,q);
	q = g3[ b11 + bz1 ];
	v = fast_at3(rx1,ry1,rz1,q);
	b = lerp_m(t, u, v);

	d = lerp_m(sy, a, b);

	return lerp_m(sz, c, d);
}
开发者ID:9skunks,项目名称:imprudence,代码行数:56,代码来源:llperlin.cpp


示例14: perlin_noise2

static double
perlin_noise2(int nColorChannel, double vec[2], StitchInfo *pStitchInfo)
{
  int bx0, bx1, by0, by1, b00, b10, b01, b11;
  double rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
  register int i, j;

  t = vec[0] + (double) PerlinN;
  bx0 = (int)t;
  bx1 = bx0+1;
  rx0 = t - (int)t;
  rx1 = rx0 - 1.0f;
  t = vec[1] + (double) PerlinN;
  by0 = (int)t;
  by1 = by0+1;
  ry0 = t - (int)t;
  ry1 = ry0 - 1.0f;

  /* If stitching, adjust lattice points accordingly. */
  if(pStitchInfo != NULL)
  {
    if(bx0 >= pStitchInfo->nWrapX)
      bx0 -= pStitchInfo->nWidth;
    if(bx1 >= pStitchInfo->nWrapX)
      bx1 -= pStitchInfo->nWidth;
    if(by0 >= pStitchInfo->nWrapY)
      by0 -= pStitchInfo->nHeight;
    if(by1 >= pStitchInfo->nWrapY)
      by1 -= pStitchInfo->nHeight;
  }

  bx0 &= BM;
  bx1 &= BM;
  by0 &= BM;
  by1 &= BM;

  i = perlin_uLatticeSelector[bx0];
  j = perlin_uLatticeSelector[bx1];
  b00 = perlin_uLatticeSelector[i + by0];
  b10 = perlin_uLatticeSelector[j + by0];
  b01 = perlin_uLatticeSelector[i + by1];
  b11 = perlin_uLatticeSelector[j + by1];
  sx = (double) (s_curve(rx0));
  sy = (double) (s_curve(ry0));
  q = perlin_fGradient[nColorChannel][b00]; u = rx0 * q[0] + ry0 * q[1];
  q = perlin_fGradient[nColorChannel][b10]; v = rx1 * q[0] + ry0 * q[1];
  a = lerp(sx, u, v);
  q = perlin_fGradient[nColorChannel][b01]; u = rx0 * q[0] + ry1 * q[1];
  q = perlin_fGradient[nColorChannel][b11]; v = rx1 * q[0] + ry1 * q[1];
  b = lerp(sx, u, v);
  return lerp(sy, a, b);
}
开发者ID:0xD34DC0DE,项目名称:PIL,代码行数:52,代码来源:Effects.c


示例15: init

float noise3::pnoise3(float vx, float vy, float vz) 
{ 
	int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11; 
	float rx0, rx1, ry0, ry1, rz0, rz1, *q, sx, sy, sz, a, b, c, d, t, u, v; 
	register int i, j; 

	if (start) 
	{ 
		start = 0; 
		init(); 
	} 
	setup(vx, bx0,bx1, rx0,rx1); 
	setup(vy, by0,by1, ry0,ry1); 
	setup(vz, bz0,bz1, rz0,rz1); 
	i = p[ bx0 ]; 
	j = p[ bx1 ]; 
	b00 = p[ i + by0 ]; 
	b10 = p[ j + by0 ]; 
	b01 = p[ i + by1 ]; 
	b11 = p[ j + by1 ];

	#define at(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] ) 
	#define s_curve(t) ( t * t * (3.0f - 2.0f * t) ) 
	#define lerp(t, a, b) ( a + t * (b - a) ) 

	sx = s_curve(rx0); 
	sy = s_curve(ry0); 
	sz = s_curve(rz0); 
	q = g[ b00 + bz0 ] ; 
	u = at(rx0,ry0,rz0); 
	q = g[ b10 + bz0 ] ; 
	v = at(rx1,ry0,rz0); 
	a = lerp(sx, u, v); 
	q = g[ b01 + bz0 ] ; 
	u = at(rx0,ry1,rz0); 
	q = g[ b11 + bz0 ] ; 
	v = at(rx1,ry1,rz0); 
	b = lerp(sx, u, v); 
	c = lerp(sy, a, b);						// interpolate in y at lo x
	q = g[ b00 + bz1 ] ; 
	u = at(rx0,ry0,rz1); 
	q = g[ b10 + bz1 ] ; 
	v = at(rx1,ry0,rz1); 
	a = lerp(sx, u, v); 
	q = g[ b01 + bz1 ] ; 
	u = at(rx0,ry1,rz1); 
	q = g[ b11 + bz1 ] ; 
	v = at(rx1,ry1,rz1); 
	b = lerp(sx, u, v); 
	d = lerp(sy, a, b);						// interpolate in y at hi x
	return 1.5f * lerp(sz, c, d);			// interpolate in z
}
开发者ID:DimondTheCat,项目名称:xray,代码行数:52,代码来源:noiseShader.cpp


示例16: Init

// 3차원 노이즈 생성
float GNoise::Noise3(float vec[3])
{
	int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
	float rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
	register int i, j;

	if (m_IsStart) 
	{
		m_IsStart = 0;
		Init();
	}

	Setup( vec[0], bx0, bx1, rx0, rx1 );
	Setup( vec[1], by0, by1, ry0, ry1 );
	Setup( vec[2], bz0, bz1, rz0, rz1 );	

	i = m_iRandomIndex[ bx0 ];
	j = m_iRandomIndex[ bx1 ];

	b00 = m_iRandomIndex[ i + by0 ];
	b10 = m_iRandomIndex[ j + by0 ];
	b01 = m_iRandomIndex[ i + by1 ];
	b11 = m_iRandomIndex[ j + by1 ];

	t  = s_curve(rx0);
	sy = s_curve(ry0);
	sz = s_curve(rz0);

#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )

	q = m_vRandomData[ b00 + bz0 ] ; u = at3(rx0,ry0,rz0);
	q = m_vRandomData[ b10 + bz0 ] ; v = at3(rx1,ry0,rz0);
	a = lerp(t, u, v);

	q = m_vRandomData[ b01 + bz0 ] ; u = at3(rx0,ry1,rz0);
	q = m_vRandomData[ b11 + bz0 ] ; v = at3(rx1,ry1,rz0);
	b = lerp(t, u, v);

	c = lerp(sy, a, b);

	q = m_vRandomData[ b00 + bz1 ] ; u = at3(rx0,ry0,rz1);
	q = m_vRandomData[ b10 + bz1 ] ; v = at3(rx1,ry0,rz1);
	a = lerp(t, u, v);

	q = m_vRandomData[ b01 + bz1 ] ; u = at3(rx0,ry1,rz1);
	q = m_vRandomData[ b11 + bz1 ] ; v = at3(rx1,ry1,rz1);
	b = lerp(t, u, v);

	d = lerp(sy, a, b);

	return lerp(sz, c, d);
}
开发者ID:serialkk,项目名称:cudgel,代码行数:53,代码来源:GNoise.cpp


示例17: noise3

float noise3(float vec[3])
{
	int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
	float rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
    int i;
    int j;
    
	if (start) {
		start = 0;
		init_noise();
	}
    
	setup_noise(0, bx0,bx1, rx0,rx1);
	setup_noise(1, by0,by1, ry0,ry1);
	setup_noise(2, bz0,bz1, rz0,rz1);
    
	i = p[ bx0 ];
	j = p[ bx1 ];
    
	b00 = p[ i + by0 ];
	b10 = p[ j + by0 ];
	b01 = p[ i + by1 ];
	b11 = p[ j + by1 ];
    
	t  = s_curve(rx0);
	sy = s_curve(ry0);
	sz = s_curve(rz0);
    
#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )
    
	q = g3[ b00 + bz0 ] ; u = at3(rx0,ry0,rz0);
	q = g3[ b10 + bz0 ] ; v = at3(rx1,ry0,rz0);
	a = lerp(t, u, v);
    
	q = g3[ b01 + bz0 ] ; u = at3(rx0,ry1,rz0);
	q = g3[ b11 + bz0 ] ; v = at3(rx1,ry1,rz0);
	b = lerp(t, u, v);
    
	c = lerp(sy, a, b);
    
	q = g3[ b00 + bz1 ] ; u = at3(rx0,ry0,rz1);
	q = g3[ b10 + bz1 ] ; v = at3(rx1,ry0,rz1);
	a = lerp(t, u, v);
    
	q = g3[ b01 + bz1 ] ; u = at3(rx0,ry1,rz1);
	q = g3[ b11 + bz1 ] ; v = at3(rx1,ry1,rz1);
	b = lerp(t, u, v);
    
	d = lerp(sy, a, b);
    
	return lerp(sz, c, d);
}
开发者ID:robbykraft,项目名称:World,代码行数:52,代码来源:noise.c


示例18: srand

float CPerlinNoise3D::noise(const Fvector3& vec)
{
	int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
	float rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
	int i, j;

	if (!mReady){ 
		srand(mSeed);
		mReady = true;
		init();
	}

	setup(0, bx0,bx1, rx0,rx1);
	setup(1, by0,by1, ry0,ry1);
	setup(2, bz0,bz1, rz0,rz1);

	i = p[ bx0 ];
	j = p[ bx1 ];

	b00 = p[ i + by0 ];
	b10 = p[ j + by0 ];
	b01 = p[ i + by1 ];
	b11 = p[ j + by1 ];

	t  = s_curve(rx0);
	sy = s_curve(ry0);
	sz = s_curve(rz0);

#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )

	q = g3[ b00 + bz0 ] ; u = at3(rx0,ry0,rz0);
	q = g3[ b10 + bz0 ] ; v = at3(rx1,ry0,rz0);
	a = lerp(t, u, v);

	q = g3[ b01 + bz0 ] ; u = at3(rx0,ry1,rz0);
	q = g3[ b11 + bz0 ] ; v = at3(rx1,ry1,rz0);
	b = lerp(t, u, v);

	c = lerp(sy, a, b);

	q = g3[ b00 + bz1 ] ; u = at3(rx0,ry0,rz1);
	q = g3[ b10 + bz1 ] ; v = at3(rx1,ry0,rz1);
	a = lerp(t, u, v);

	q = g3[ b01 + bz1 ] ; u = at3(rx0,ry1,rz1);
	q = g3[ b11 + bz1 ] ; v = at3(rx1,ry1,rz1);
	b = lerp(t, u, v);

	d = lerp(sy, a, b);

	return lerp(sz, c, d);
}
开发者ID:2asoft,项目名称:xray,代码行数:52,代码来源:perlin.cpp


示例19: noise_value2

float noise_value2(float x, float y)
{
    int flx = floor(x);
    int fly = floor(y);
    float v0 = noise_random2(flx, fly);
    float v1 = noise_random2(flx+1,fly);
    float v2 = noise_random2(flx+1,fly+1);
    float v3 = noise_random2(flx,fly+1);

    float px0 = lerp(s_curve(x-flx),v0,v1);
    float px1 = lerp(s_curve(x-flx),v3,v2);
    return lerp(s_curve(y-fly),px0,px1);
}
开发者ID:bsurmanski,项目名称:SDLDemos,代码行数:13,代码来源:noise.c


示例20: init

float PerlinNoise::noise3( float vec[3] )
{
	int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
	float rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
	register int i, j;

	if (start) {
		start = false;
		init();
	}

	setup(0, bx0,bx1, rx0,rx1);
	setup(1, by0,by1, ry0,ry1);
	setup(2, bz0,bz1, rz0,rz1);

	i = p[ bx0 ];
	j = p[ bx1 ];

	b00 = p[ i + by0 ];
	b10 = p[ j + by0 ];
	b01 = p[ i + by1 ];
	b11 = p[ j + by1 ];

	t  = s_curve(rx0);
	sy = s_curve(ry0);
	sz = s_curve(rz0);

#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )

	q = g3[ b00 + bz0 ] ; u = at3(rx0,ry0,rz0);
	q = g3[ b10 + bz0 ] ; v = at3(rx1,ry0,rz0);
	a = Math::lerp(t, u, v);

	q = g3[ b01 + bz0 ] ; u = at3(rx0,ry1,rz0);
	q = g3[ b11 + bz0 ] ; v = at3(rx1,ry1,rz0);
	b = Math::lerp(t, u, v);

	c = Math::lerp(sy, a, b);

	q = g3[ b00 + bz1 ] ; u = at3(rx0,ry0,rz1);
	q = g3[ b10 + bz1 ] ; v = at3(rx1,ry0,rz1);
	a = Math::lerp(t, u, v);

	q = g3[ b01 + bz1 ] ; u = at3(rx0,ry1,rz1);
	q = g3[ b11 + bz1 ] ; v = at3(rx1,ry1,rz1);
	b = Math::lerp(t, u, v);

	d = Math::lerp(sy, a, b);

	return Math::lerp(sz, c, d);
}
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:51,代码来源:perlin_noise.cpp



注:本文中的s_curve函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ s_free函数代码示例发布时间:2022-05-30
下一篇:
C++ s_copy函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap