本文整理汇总了C++中Point3F::dot方法的典型用法代码示例。如果您正苦于以下问题:C++ Point3F::dot方法的具体用法?C++ Point3F::dot怎么用?C++ Point3F::dot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3F
的用法示例。
在下文中一共展示了Point3F::dot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loop
void Scene::loop() {
//Basic movement
glm::mat4x4 delta = glm::mat4x4(1);
if (movement[4]) pitch -= keyCameraSpeed;
if (movement[5]) pitch += keyCameraSpeed;
if (movement[6]) yaw -= keyCameraSpeed;
if (movement[7]) yaw += keyCameraSpeed;
delta = glm::rotate(delta, -yaw, glm::vec3(0, 0, 1));
float speed = movementSpeed;
if (mouseButtons[1])
speed *= 2.f;
Point2F move = Point2F();
if (movement[0]) move.x -= speed;
if (movement[1]) move.x += speed;
if (movement[2]) move.y -= speed;
if (movement[3]) move.y += speed;
#ifdef BUILD_PHYSICS
glm::vec3 torque = glm::vec3(glm::translate(delta, glm::vec3(move.x, move.y, 0))[3]);
delta = glm::rotate(delta, -pitch, glm::vec3(1, 0, 0));
sphere->applyTorque(Point3F(torque.x, torque.y, torque.z) * 20);
if (sphere->getColliding()) {
Point3F normal = sphere->getCollisionNormal();
if (movement[8] && normal.dot(Point3F(0, 0, 1)) > 0.1)
sphere->applyImpulse((normal + Point3F(0, 0, 1)) / 2.f, Point3F(0, 0, -1));
} else {
sphere->applyImpulse(Point3F(torque.y, -torque.x, torque.z) / 4.f, Point3F(0, 0, 0));
}
Point3F pos = sphere->getPosition();
cameraPosition = glm::vec3(pos.x, pos.y, pos.z);
cameraPosition += glm::vec3(glm::translate(delta, glm::vec3(0, -2.5, 0))[3]);
if (sphere->getPosition().z < difs[0]->interior[0]->boundingBox.getMin().x) {
sphere->setPosition(Point3F(0, 30, 60));
}
#else /* BUILD_PHYSICS */
move *= 3;
if (movement[8])
move *= 2;
delta = glm::rotate(delta, -pitch, glm::vec3(1, 0, 0));
delta = glm::translate(delta, glm::vec3(move.y, -move.x, 0));
cameraPosition += glm::vec3(delta[3]);
#endif /* BUILD_PHYSICS */
}