本文整理汇总了C++中cVector3d::copyto方法的典型用法代码示例。如果您正苦于以下问题:C++ cVector3d::copyto方法的具体用法?C++ cVector3d::copyto怎么用?C++ cVector3d::copyto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cVector3d
的用法示例。
在下文中一共展示了cVector3d::copyto方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDir
//===========================================================================
void cLight::setDir(const cVector3d& a_direction)
{
// We arbitrarily point lights along the x axis of the stored
// rotation matrix... this allows matrix transformations
// to apply to lights.
// m_localRot.setCol0(a_direction);
cVector3d c0, c1, c2, t;
a_direction.copyto(c0);
// check vector
if (c0.lengthsq() < 0.0001) { return; }
// normalize direction vector
c0.normalize();
// compute 2 vector perpendicular to a_direction
t.set(a_direction.y, a_direction.z, a_direction.x);
t.crossr(c0, c1);
c1.crossr(c0, c2);
// c0.negate();
c1.negate();
c2.negate();
// update rotation matrix
m_localRot.setCol(c0,c1,c2);
}
示例2: setDir
//===========================================================================
void cDirectionalLight::setDir(const cVector3d& a_direction)
{
// We arbitrarily point lights along the x axis of the stored
// rotation matrix... this allows matrix transformations
// to apply to lights.
// m_localRot.setCol0(a_direction);
cVector3d c0, c1, c2, t0, t1;
a_direction.copyto(c0);
// check vector
if (c0.lengthsq() < 0.0001) {
return;
}
// normalize direction vector
c0.normalize();
// compute 2 vector perpendicular to a_direction
t0.set(0.0, 0.0, 1.0);
t1.set(0.0, 1.0, 0.0);
double a0 = cAngle(c0, t0);
double a1 = cAngle(c0, t1);
if (sin(a0) > sin(a1))
{
c0.crossr(t0, c1);
c0.crossr(c1, c2);
}
else
{
c0.crossr(t1, c1);
c0.crossr(c1, c2);
}
c1.normalize();
c2.normalize();
// update rotation matrix
m_localRot.setCol(c0,c1,c2);
}