本文整理汇总了C++中Geometry::SetNormOutOf方法的典型用法代码示例。如果您正苦于以下问题:C++ Geometry::SetNormOutOf方法的具体用法?C++ Geometry::SetNormOutOf怎么用?C++ Geometry::SetNormOutOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry::SetNormOutOf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddBox
void AddBox(Geometry*g, vec3 a,vec3 b,ivec3 br)
{
Geometry tmp;
if(a.x>b.x)swap(a.x,b.x);
if(a.y>b.y)swap(a.y,b.y);
if(a.z>b.z)swap(a.z,b.z);
vec3 s = b - a;
vec3 a_x(s.x/br.x,0,0);
vec3 a_y(0,s.y/br.x,0);
vec3 a_z(0,0,s.z/br.x);
/*
for(int i=0;i<=br.x;i++)
for(int j=0;j<=br.x;j++)
{
AddQuad(&tmp,a,a+a_y,a+a_x+a_y,a+a_x);
AddQuad(&tmp,b,b-a_x,b-a_x-a_y,b-a_y);
AddQuad(&tmp,a,a+a_x,a+a_x+a_z,a+a_z);
AddQuad(&tmp,b,b-a_z,b-a_x-a_z,b-a_x);
AddQuad(&tmp,b,b-a_y,b-a_z-a_y,b-a_z);
AddQuad(&tmp,a,a+a_z,a+a_z+a_y,a+a_y);
}*/
tmp.SetNormOutOf((a+b)*0.5f);
g->Add(tmp);
}
示例2: AddArmDetail
void AddArmDetail(Geometry*g,float w,float r, int sides)
{
Geometry tmp;
float ang=(float)(PI/sides);
float sina=sin(ang),cosa=cos(ang);
int i;
vec3 t1(0,0,r),t0(0,0,r),hh(w/2,0,0),hh0(0,0,0);
for(i=0; i<sides; i++)
{
t1.RotateOij(sina,cosa,1,2);
AddQuad(&tmp,t0,t1,t1+hh,t0+hh);
tmp.AddTriangle(t0,t1,hh0);
tmp.AddTriangle(t1+hh,t0+hh,hh);
t0=t1;
}
tmp.SetNormOutOf(vec3((w)/4,0,0));
g->Add(tmp);
//tmp.renull();
//AddQuad(&tmp,);
AddBox(g,vec3(0,0,r),vec3(w/2,r,-r));
AddBox(g,vec3(-w/2,2*r,r),vec3(w/2,r,-r));
}
示例3: AddSphere
void AddSphere(Geometry*g,float r, int sides_a, int sides_b)
{
Geometry tmp;
float ang=(float)(PI/sides_a);
float sina=sin(ang),cosa=cos(ang);
float ang2=(float)(PI*2.0/sides_b);
float sinb=sin(ang2),cosb=cos(ang2);
int i,j;
vec3 v0(0,r,0),u0,u1,w0,w1;
vec3 v1(v0);
for(i=0; i<sides_a; i++)
{
v1.RotateOij(sina,cosa,0,1);
u0 = v0;
w0 = v1;
u1 = v0;
w1 = v1;
for(j=0; j<sides_b; j++)
{
u1.RotateOij(sinb,cosb,0,2);
w1.RotateOij(sinb,cosb,0,2);
if(i==sides_b-1)
tmp.AddTriangle(u0,u1,w0);
else if(!i)
tmp.AddTriangle(u1,w1,w0);
else
AddQuad(&tmp,u0,u1,w1,w0);
u0=u1;
w0=w1;
}
v0=v1;
}
tmp.SetNormOutOf(vec3(0,0,0));
g->Add(tmp);
}
示例4: AddCylinder
void AddCylinder(Geometry*g,float h,float r, int sides)
{
Geometry tmp;
float ang=(float)(PI*2.0/sides);
float sina=sin(ang),cosa=cos(ang);
int i;
vec3 t1(r,0,0),t0(r,0,0),hh(0,h,0),hh0(0,0,0);
for(i=0; i<sides; i++)
{
t1.RotateOij(sina,cosa,0,2);
AddQuad(&tmp,t0,t1,t1+hh,t0+hh);
tmp.AddTriangle(t0,t1,hh0);
tmp.AddTriangle(t1+hh,t0+hh,hh);
t0=t1;
}
tmp.SetNormOutOf(vec3(0,h/2,0));
g->Add(tmp);
}