mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-25 14:14:08 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into temp1
This commit is contained in:
commit
334e032c17
12 changed files with 80 additions and 19 deletions
|
@ -16,8 +16,11 @@
|
|||
#
|
||||
|
||||
if (WIN32)
|
||||
find_library(ATL_LIBRARY_RELEASE atls PATH_SUFFIXES "7600.16385.1/lib/ATL/i386" HINTS "C:\\WinDDK")
|
||||
find_library(ATL_LIBRARY_DEBUG atlsd PATH_SUFFIXES "7600.16385.1/lib/ATL/i386" HINTS "C:\\WinDDK")
|
||||
set(ATL_SEARCH_DIRS "C:\\WinDDK")
|
||||
find_path(ATL_INCLUDE_DIRS atlbase.h PATH_SUFFIXES "7600.16385.1/inc/atl71" HINTS ${ATL_SEARCH_DIRS})
|
||||
|
||||
find_library(ATL_LIBRARY_RELEASE atls PATH_SUFFIXES "7600.16385.1/lib/ATL/i386" HINTS ${ATL_SEARCH_DIRS})
|
||||
find_library(ATL_LIBRARY_DEBUG atlsd PATH_SUFFIXES "7600.16385.1/lib/ATL/i386" HINTS ${ATL_SEARCH_DIRS})
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(ATL)
|
||||
|
@ -26,4 +29,4 @@ endif ()
|
|||
set(ATL_LIBRARIES "${ATL_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ATL DEFAULT_MSG ATL_LIBRARIES)
|
||||
find_package_handle_standard_args(ATL DEFAULT_MSG ATL_INCLUDE_DIRS ATL_LIBRARIES)
|
47
examples/guidedTour.js
Normal file
47
examples/guidedTour.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
//
|
||||
// TourGuide.js
|
||||
//
|
||||
// This script will follow another person, if their display name is "Tour Guide"
|
||||
//
|
||||
var leaderName = "Tour Guide";
|
||||
|
||||
var guide;
|
||||
var isGuide = false;
|
||||
var lastGuidePosition = { x:0, y:0, z:0 };
|
||||
var MIN_CHANGE = 2.0;
|
||||
var LANDING_DISTANCE = 2.0;
|
||||
var LANDING_RANDOM = 0.2;
|
||||
|
||||
function update(deltaTime) {
|
||||
|
||||
if (Math.random() < deltaTime) {
|
||||
guide = AvatarList.avatarWithDisplayName(leaderName);
|
||||
if (guide && !isGuide) {
|
||||
print("found a guide!");
|
||||
isGuide = true;
|
||||
} else if (!isGuide) {
|
||||
print("Lost My Guide");
|
||||
isguide = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (guide) {
|
||||
// Check whether guide has moved, update if so
|
||||
if (Vec3.length(lastGuidePosition) == 0.0) {
|
||||
lastGuidePosition = guide.position;
|
||||
} else {
|
||||
if (Vec3.length(Vec3.subtract(lastGuidePosition, guide.position)) > MIN_CHANGE) {
|
||||
var meToGuide = Vec3.multiply(Vec3.normalize(Vec3.subtract(guide.position, MyAvatar.position)), LANDING_DISTANCE);
|
||||
var newPosition = Vec3.subtract(guide.position, meToGuide);
|
||||
newPosition = Vec3.sum(newPosition, { x: Math.random() * LANDING_RANDOM - LANDING_RANDOM / 2.0,
|
||||
y: 0,
|
||||
z: Math.random() * LANDING_RANDOM - LANDING_RANDOM / 2.0 });
|
||||
MyAvatar.position = newPosition;
|
||||
|
||||
lastGuidePosition = guide.position;
|
||||
MyAvatar.orientation = guide.orientation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Script.update.connect(update);
|
|
@ -142,7 +142,7 @@ function update(deltaTime) {
|
|||
}
|
||||
|
||||
Controller.keyPressEvent.connect(function(event) {
|
||||
if (event.text == "SPACE" && !movingWithHead) {
|
||||
if (event.text == "SPACE" && !event.isAutoRepeat && !movingWithHead) {
|
||||
keyDownTime = 0.0;
|
||||
movingWithHead = true;
|
||||
headStartPosition = MyAvatar.getTrackedHeadPosition();
|
||||
|
@ -161,7 +161,7 @@ var TIME_FOR_TURN = 0.25;
|
|||
var TURN_AROUND = 180.0;
|
||||
|
||||
Controller.keyReleaseEvent.connect(function(event) {
|
||||
if (event.text == "SPACE") {
|
||||
if (event.text == "SPACE" && !event.isAutoRepeat) {
|
||||
movingWithHead = false;
|
||||
if (keyDownTime < TIME_FOR_TURN_AROUND) {
|
||||
if (keyDownTime < TIME_FOR_TURN) {
|
||||
|
|
|
@ -38,7 +38,7 @@ Hair::Hair(int strands,
|
|||
_acceleration(0.0f),
|
||||
_angularVelocity(0.0f),
|
||||
_angularAcceleration(0.0f),
|
||||
_gravity(0.0f),
|
||||
_gravity(DEFAULT_GRAVITY),
|
||||
_loudness(0.0f)
|
||||
{
|
||||
_hairPosition = new glm::vec3[_strands * _links];
|
||||
|
@ -53,7 +53,7 @@ Hair::Hair(int strands,
|
|||
for (int strand = 0; strand < _strands; strand++) {
|
||||
float strandAngle = randFloat() * PI;
|
||||
float azimuth;
|
||||
float elevation = PI_OVER_TWO - (randFloat() * 0.10f * PI);
|
||||
float elevation = - (randFloat() * PI);
|
||||
azimuth = PI_OVER_TWO;
|
||||
if (randFloat() < 0.5f) {
|
||||
azimuth *= -1.0f;
|
||||
|
@ -127,7 +127,7 @@ void Hair::simulate(float deltaTime) {
|
|||
_hairPosition[vertexIndex] += randVector() * (QUIESCENT_LOUDNESS + loudnessFactor) * ((float)link / (float)_links);
|
||||
|
||||
// Add gravity
|
||||
const float SCALE_GRAVITY = 0.13f;
|
||||
const float SCALE_GRAVITY = 0.001f;
|
||||
_hairPosition[vertexIndex] += _gravity * deltaTime * SCALE_GRAVITY;
|
||||
|
||||
// Add linear acceleration
|
||||
|
|
|
@ -25,9 +25,10 @@ const int HAIR_CONSTRAINTS = 2;
|
|||
|
||||
const int DEFAULT_HAIR_STRANDS = 20;
|
||||
const int DEFAULT_HAIR_LINKS = 10;
|
||||
const float DEFAULT_HAIR_RADIUS = 0.15f;
|
||||
const float DEFAULT_HAIR_RADIUS = 0.075f;
|
||||
const float DEFAULT_HAIR_LINK_LENGTH = 0.06f;
|
||||
const float DEFAULT_HAIR_THICKNESS = 0.025f;
|
||||
const glm::vec3 DEFAULT_GRAVITY(0.0f, -9.8f, 0.0f);
|
||||
|
||||
class Hair {
|
||||
public:
|
||||
|
@ -41,7 +42,6 @@ public:
|
|||
void setAcceleration(const glm::vec3& acceleration) { _acceleration = acceleration; }
|
||||
void setAngularVelocity(const glm::vec3& angularVelocity) { _angularVelocity = angularVelocity; }
|
||||
void setAngularAcceleration(const glm::vec3& angularAcceleration) { _angularAcceleration = angularAcceleration; }
|
||||
void setGravity(const glm::vec3& gravity) { _gravity = gravity; }
|
||||
void setLoudness(const float loudness) { _loudness = loudness; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -110,11 +110,9 @@ int SimulateVisitor::visit(MetavoxelInfo& info) {
|
|||
void MetavoxelSystem::simulate(float deltaTime) {
|
||||
// update the lod
|
||||
{
|
||||
// the LOD threshold is temporarily tied to the avatar LOD parameter
|
||||
QWriteLocker locker(&_lodLock);
|
||||
const float BASE_LOD_THRESHOLD = 0.01f;
|
||||
_lod = MetavoxelLOD(Application::getInstance()->getCamera()->getPosition(),
|
||||
BASE_LOD_THRESHOLD * Menu::getInstance()->getAvatarLODDistanceMultiplier());
|
||||
const float DEFAULT_LOD_THRESHOLD = 0.01f;
|
||||
_lod = MetavoxelLOD(Application::getInstance()->getCamera()->getPosition(), DEFAULT_LOD_THRESHOLD);
|
||||
}
|
||||
|
||||
SimulateVisitor simulateVisitor(deltaTime, getLOD());
|
||||
|
|
|
@ -191,7 +191,6 @@ void Avatar::simulate(float deltaTime) {
|
|||
_hair.setAcceleration(getAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularVelocity((getAngularVelocity() + getHead()->getAngularVelocity()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularAcceleration(getAngularAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setGravity(Application::getInstance()->getEnvironment()->getGravity(getPosition()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setLoudness((float) getHeadData()->getAudioLoudness());
|
||||
_hair.simulate(deltaTime);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@ Head::Head(Avatar* owningAvatar) :
|
|||
_longTermAverageLoudness(-1.0f),
|
||||
_audioAttack(0.0f),
|
||||
_audioJawOpen(0.0f),
|
||||
_mouth2(0.0f),
|
||||
_mouth3(0.0f),
|
||||
_mouth4(0.0f),
|
||||
_angularVelocity(0,0,0),
|
||||
_renderLookatVectors(false),
|
||||
_saccade(0.0f, 0.0f, 0.0f),
|
||||
|
|
|
@ -217,7 +217,6 @@ void MyAvatar::simulate(float deltaTime) {
|
|||
_hair.setAcceleration(getAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularVelocity((getAngularVelocity() + getHead()->getAngularVelocity()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularAcceleration(getAngularAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setGravity(Application::getInstance()->getEnvironment()->getGravity(getPosition()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setLoudness((float)getHeadData()->getAudioLoudness());
|
||||
_hair.simulate(deltaTime);
|
||||
}
|
||||
|
|
|
@ -45,9 +45,14 @@ void Joystick::closeJoystick() {
|
|||
|
||||
#ifdef HAVE_SDL2
|
||||
void Joystick::handleAxisEvent(const SDL_ControllerAxisEvent& event) {
|
||||
if (_axes.size() <= event.axis) {
|
||||
_axes.resize(event.axis + 1);
|
||||
}
|
||||
|
||||
float oldValue = _axes[event.axis];
|
||||
float newValue = event.value / MAX_AXIS;
|
||||
_axes[event.axis] = newValue;
|
||||
|
||||
emit axisValueChanged(event.axis, newValue, oldValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ KeyEvent::KeyEvent() :
|
|||
isMeta(false),
|
||||
isAlt(false),
|
||||
isKeypad(false),
|
||||
isValid(false)
|
||||
isValid(false),
|
||||
isAutoRepeat(false)
|
||||
{
|
||||
};
|
||||
|
||||
|
@ -44,6 +45,7 @@ KeyEvent::KeyEvent(const QKeyEvent& event) {
|
|||
isAlt = event.modifiers().testFlag(Qt::AltModifier);
|
||||
isKeypad = event.modifiers().testFlag(Qt::KeypadModifier);
|
||||
isValid = true;
|
||||
isAutoRepeat = event.isAutoRepeat();
|
||||
|
||||
// handle special text for special characters...
|
||||
if (key == Qt::Key_F1) {
|
||||
|
@ -127,7 +129,8 @@ bool KeyEvent::operator==(const KeyEvent& other) const {
|
|||
&& other.isControl == isControl
|
||||
&& other.isMeta == isMeta
|
||||
&& other.isAlt == isAlt
|
||||
&& other.isKeypad == isKeypad;
|
||||
&& other.isKeypad == isKeypad
|
||||
&& other.isAutoRepeat == isAutoRepeat;
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,6 +166,7 @@ QScriptValue keyEventToScriptValue(QScriptEngine* engine, const KeyEvent& event)
|
|||
obj.setProperty("isControl", event.isControl);
|
||||
obj.setProperty("isAlt", event.isAlt);
|
||||
obj.setProperty("isKeypad", event.isKeypad);
|
||||
obj.setProperty("isAutoRepeat", event.isAutoRepeat);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -173,6 +177,7 @@ void keyEventFromScriptValue(const QScriptValue& object, KeyEvent& event) {
|
|||
event.isControl = object.property("isControl").toVariant().toBool();
|
||||
event.isAlt = object.property("isAlt").toVariant().toBool();
|
||||
event.isKeypad = object.property("isKeypad").toVariant().toBool();
|
||||
event.isAutoRepeat = object.property("isAutoRepeat").toVariant().toBool();
|
||||
|
||||
QScriptValue key = object.property("key");
|
||||
if (key.isValid()) {
|
||||
|
@ -286,7 +291,8 @@ void keyEventFromScriptValue(const QScriptValue& object, KeyEvent& event) {
|
|||
<< " event.isControl=" << event.isControl
|
||||
<< " event.isMeta=" << event.isMeta
|
||||
<< " event.isAlt=" << event.isAlt
|
||||
<< " event.isKeypad=" << event.isKeypad;
|
||||
<< " event.isKeypad=" << event.isKeypad
|
||||
<< " event.isAutoRepeat=" << event.isAutoRepeat;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
bool isAlt;
|
||||
bool isKeypad;
|
||||
bool isValid;
|
||||
bool isAutoRepeat;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue