本文整理汇总了C++中Pnt3f::subZero方法的典型用法代码示例。如果您正苦于以下问题:C++ Pnt3f::subZero方法的具体用法?C++ Pnt3f::subZero怎么用?C++ Pnt3f::subZero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pnt3f
的用法示例。
在下文中一共展示了Pnt3f::subZero方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeExplosion
void makeExplosion(Pnt3f Location, Real32 Impulse)
{
for(UInt32 i(0) ; i<allPhysicsBodies.size() ; ++i)
{
Vec3f Direction(allPhysicsBodies[i]->getPosition()-Location.subZero());
Real32 Distance(Direction.length());
Direction.normalize();
allPhysicsBodies[i]->addForce(physicsWorld->impulseToForce(physHandler->getStepSize(), Direction*Impulse*(1.0f/Distance)));
//The bodies need to be enabled because they may be auto-disabled when they
//come to rest
//The bodies are not re-enabled untill a new collision is detected
allPhysicsBodies[i]->setEnable(true);
}
}
示例2: affect
bool RandomMovementParticleAffector::affect(ParticleSystemRefPtr System, Int32 ParticleIndex, const Time& elps)
{
//System->setUpdateSecAttribs(false);
Real32 x,
y,
z,
age(System->getAge(ParticleIndex));
if(getAttributeAffected() == VELOCITY_ATTRIBUTE)
{
Vec3f vel = System->getSecVelocity(ParticleIndex);
// grab each value independently , and adjust the phase for each
// axis, since we have a 3D phase and the 1D distribution only takes
// one value
Real32 velSum = vel.x() + vel.y() + vel.z();
getPerlinDistribution()->setPhase(getPhase().x() + velSum);
x = getPerlinDistribution()->generate(vel.x() + age);
getPerlinDistribution()->setPhase(getPhase().y() + velSum);
y = getPerlinDistribution()->generate(vel.y() + age);
getPerlinDistribution()->setPhase(getPhase().z() + velSum);
z = getPerlinDistribution()->generate(vel.z() + age);
System->setVelocity(Vec3f(x,y,z) + vel,ParticleIndex);
}else // affecting position
{
Pnt3f pos = System->getSecPosition(ParticleIndex);
Real32 posSum = pos.x() + pos.y() + pos.z();
getPerlinDistribution()->setPhase(getPhase().x() + posSum);
x = getPerlinDistribution()->generate(pos.x() + age);
getPerlinDistribution()->setPhase(getPhase().y() + posSum);
y = getPerlinDistribution()->generate(pos.y() + age);
getPerlinDistribution()->setPhase(getPhase().z() + posSum);
z = getPerlinDistribution()->generate(pos.z() + age);
System->setPosition(Pnt3f(x,y,z) + pos.subZero(),ParticleIndex);
}
return false;
}
示例3: vec2pnttest
void vec2pnttest(void)
{
Vec3f v (3.f, 3.f, 3.f);
const Vec3f cv(2.f, 2.f, 2.f);
Pnt3f p(5.f, 5.f, 5.f);
const Pnt3f cp(8.f, 8.f, 8.f);
v = p.subZero();
fprintf(stderr, "%f %f %f\n", v[0], v[1], v[2]);
v = cp.subZero();
fprintf(stderr, "%f %f %f\n", v[0], v[1], v[2]);
// p = v;
// p = cv;
}
示例4:
ParticleSystemCore::ParticleSortByViewPosition::ParticleSortByViewPosition(const ParticleSystem* TheSystem, Pnt3f TheCameraPos, bool SortByMinimum)
: _System(TheSystem), _CameraPos(TheCameraPos.subZero()), _SortByMinimum(SortByMinimum)
{
}
示例5: calculatePositions
void SkeletonBlendedGeometry::calculatePositions(void)
{
if(getBaseGeometry() == NULL)
{
//Error
SWARNING << "SkeletonBlendedGeometry::calculatePositions(): Base Geometry is NULL." << std::endl;
return;
if(getPositions() == NULL)
{
//Error
SWARNING << "SkeletonBlendedGeometry::calculatePositions(): Positions is NULL." << std::endl;
return;
}
if(getBaseGeometry()->getPositions() == NULL)
{
//Error
SWARNING << "SkeletonBlendedGeometry::calculatePositions(): Base Geometry Postions is NULL." << std::endl;
return;
}
if(getMFPositionIndexes()->size() != getMFJoints()->size())
{
//Error
SWARNING << "SkeletonBlendedGeometry::calculatePositions(): Positions Indexes size is not the same as the affecting Joints size." << std::endl;
return;
}
}
if(getMFPositionIndexes()->size() != getMFBlendAmounts()->size())
{
//Error
SWARNING << "SkeletonBlendedGeometry::calculatePositions(): Positions Indexes size is not the same as the affecting blend amount size." << std::endl;
return;
}
Pnt3f CalculatedPoint;
Pnt3f PointTemp;
Vec3f CalculatedNormal;
//Set the values of all points to 0
for (int i(0); i < getPositions()->size(); ++i)
{
getPositions()->setValue(Pnt3f(0, 0, 0), i);
}
//Update the Positions and Normals
for(UInt32 i(0) ; i < getMFPositionIndexes()->size() ; ++i)
{
Matrix temp = getJoints(i)->getAbsoluteDifferenceTransformation();
temp.scale(getBlendAmounts(i));
getBaseGeometry()->getPositions()->getValue<Pnt3f>(PointTemp, getPositionIndexes(i));
temp.mult(PointTemp, CalculatedPoint);
//temp.mult(getBaseGeometry()->getNormals()->getValue(getPositionIndexes(i)), CalculatedNormal);
//Add
CalculatedPoint += PointTemp.subZero();
getPositions()->setValue<Pnt3f>(CalculatedPoint, getPositionIndexes(i));
}
for(UInt32 i = 0; i < _mfParents.size(); i++)
{
_mfParents[i]->invalidateVolume();
}
_volumeCache.setValid();
_volumeCache.setEmpty();
}