本文整理汇总了C++中Triangle::Blend_norm方法的典型用法代码示例。如果您正苦于以下问题:C++ Triangle::Blend_norm方法的具体用法?C++ Triangle::Blend_norm怎么用?C++ Triangle::Blend_norm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triangle
的用法示例。
在下文中一共展示了Triangle::Blend_norm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Compute_intersect
int Ray::Compute_intersect()
{
Color In;
In.red = 1.0;
In.green = 0.0;
In.blue = 0.0;
ObjCopy* copy = new ObjCopy[objcount];
float t, thit = HUGEREAL, thitTri = HUGEREAL;
int p;
int count = 0;
Vector v1, v2, v3, n1, n2, n3;
Vector blend, Q;
Object *curr_obj, *objecthit;
Triangle *curr_tri, *lastTri;
Triangle* trihit = 0;
Vertex** Vert;
Vector base = this->base;
Vector dir = this->dir;
curr_obj = objectlist.firstptr;
while(curr_obj != 0)
{
t = curr_obj->bound_box(*this);
copy[count].obj = curr_obj;
copy[count].tvalue = t;
count++;
curr_obj = curr_obj->nextptr;
}
QuickSort(copy, 0, objcount-1);
for(count = 0; count < objcount; count++)
{
thit = copy[count].tvalue;
objecthit = copy[count].obj;
if(thit == HUGEREAL)
return 0;
else
{
curr_tri = objecthit->getFirstTri();
lastTri = objecthit->getLastTri();
while(curr_tri != lastTri->nextptr)
{
Vert = curr_tri->getVerts();
v1 = Vert[0]->getVector();
v2 = Vert[1]->getVector();
v3 = Vert[2]->getVector();
t = this->intersect_plane(curr_tri->getnormal(), v1);
if(t > 0.001)
{
Q = base + dir.scale(t);
p = pip(v1, v2, v3, Q, curr_tri->getnormal());
if(p == 1)
{
if(t < thitTri)
{
thitTri = t;
trihit = curr_tri;
}
}
}
curr_tri = curr_tri->nextptr;
}
if(trihit != 0)
{
Q = base + dir.scale(thitTri);
this->hitpoint = Q;
blend = trihit->Blend_norm(Q);
this->triangle = trihit;
this->blend_norm = blend;
this->object = objecthit;
//cout<<blend.x<<" "<<blend.y<<" "<<blend.z<<" "<<blend.mod()<<endl;
return 1;
}
}
}
return 0;
}