mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 23:03:12 +02:00
Merge branch 'master' of ssh://github.com/highfidelity/hifi into zero-length-penetrations
This commit is contained in:
commit
631c1d2c1b
9 changed files with 38 additions and 31 deletions
|
@ -18,8 +18,8 @@ function vMinus(a, b) {
|
||||||
|
|
||||||
// First, load two percussion sounds to be used on the sticks
|
// First, load two percussion sounds to be used on the sticks
|
||||||
|
|
||||||
var drum1 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/MusicalInstruments/drums/snare.raw");
|
var drum1 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Drums/RackTomHi.raw");
|
||||||
var drum2 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/MusicalInstruments/drums/snare.raw");
|
var drum2 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Drums/RackTomLo.raw");
|
||||||
|
|
||||||
// State Machine:
|
// State Machine:
|
||||||
// 0 = not triggered
|
// 0 = not triggered
|
||||||
|
|
|
@ -42,7 +42,7 @@ Voxels.setVoxel(position.x, 0, position.z, 0.5, 0, 0, 255);
|
||||||
|
|
||||||
var totalParticles = 0;
|
var totalParticles = 0;
|
||||||
function makeFountain() {
|
function makeFountain() {
|
||||||
if (Math.random() < 0.06) {
|
if (Math.random() < 0.10) {
|
||||||
//print("Made particle!\n");
|
//print("Made particle!\n");
|
||||||
var properties = {
|
var properties = {
|
||||||
position: position,
|
position: position,
|
||||||
|
@ -51,9 +51,9 @@ function makeFountain() {
|
||||||
velocity: { x: (Math.random() * 1.0 - 0.5),
|
velocity: { x: (Math.random() * 1.0 - 0.5),
|
||||||
y: (1.0 + (Math.random() * 2.0)),
|
y: (1.0 + (Math.random() * 2.0)),
|
||||||
z: (Math.random() * 1.0 - 0.5) },
|
z: (Math.random() * 1.0 - 0.5) },
|
||||||
gravity: { x: 0, y: -0.5, z: 0 },
|
gravity: { x: 0, y: -0.1, z: 0 },
|
||||||
damping: 0.25,
|
damping: 0.25,
|
||||||
lifetime: 2
|
lifetime: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Particles.addParticle(properties);
|
Particles.addParticle(properties);
|
||||||
|
|
|
@ -134,8 +134,10 @@ function checkControllerSide(whichSide) {
|
||||||
gravity: { x: 0, y: 0, z: 0},
|
gravity: { x: 0, y: 0, z: 0},
|
||||||
inHand: true,
|
inHand: true,
|
||||||
radius: 0.05,
|
radius: 0.05,
|
||||||
|
damping: 0.999,
|
||||||
color: { red: 255, green: 0, blue: 0 },
|
color: { red: 255, green: 0, blue: 0 },
|
||||||
lifetime: 10 // 10 seconds
|
|
||||||
|
lifetime: 10 // 10 seconds - same as default, not needed but here as an example
|
||||||
};
|
};
|
||||||
|
|
||||||
newParticle = Particles.addParticle(properties);
|
newParticle = Particles.addParticle(properties);
|
||||||
|
|
|
@ -2008,15 +2008,9 @@ void Application::updateMyAvatarLookAtPosition(glm::vec3& lookAtSpot, glm::vec3&
|
||||||
_viewFrustum.computePickRay(0.5f, 0.5f, rayOrigin, rayDirection);
|
_viewFrustum.computePickRay(0.5f, 0.5f, rayOrigin, rayDirection);
|
||||||
lookAtSpot = rayOrigin + rayDirection * FAR_AWAY_STARE;
|
lookAtSpot = rayOrigin + rayDirection * FAR_AWAY_STARE;
|
||||||
|
|
||||||
} else if (!_lookatTargetAvatar) {
|
} else {
|
||||||
if (_isHoverVoxel) {
|
// just look in direction of the mouse ray
|
||||||
// Look at the hovered voxel
|
lookAtSpot = lookAtRayOrigin + lookAtRayDirection * FAR_AWAY_STARE;
|
||||||
lookAtSpot = getMouseVoxelWorldCoordinates(_hoverVoxel);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Just look in direction of the mouse ray
|
|
||||||
lookAtSpot = lookAtRayOrigin + lookAtRayDirection * FAR_AWAY_STARE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (_faceshift.isActive()) {
|
if (_faceshift.isActive()) {
|
||||||
// deflect using Faceshift gaze data
|
// deflect using Faceshift gaze data
|
||||||
|
@ -2872,10 +2866,10 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
|
||||||
|
|
||||||
if (!selfAvatarOnly) {
|
if (!selfAvatarOnly) {
|
||||||
// draw a red sphere
|
// draw a red sphere
|
||||||
float sphereRadius = 0.25f;
|
float originSphereRadius = 0.05f;
|
||||||
glColor3f(1,0,0);
|
glColor3f(1,0,0);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glutSolidSphere(sphereRadius, 15, 15);
|
glutSolidSphere(originSphereRadius, 15, 15);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
// disable specular lighting for ground and voxels
|
// disable specular lighting for ground and voxels
|
||||||
|
|
|
@ -332,27 +332,29 @@ void renderWorldBox() {
|
||||||
glVertex3f(TREE_SCALE, 0, TREE_SCALE);
|
glVertex3f(TREE_SCALE, 0, TREE_SCALE);
|
||||||
glVertex3f(TREE_SCALE, 0, 0);
|
glVertex3f(TREE_SCALE, 0, 0);
|
||||||
glEnd();
|
glEnd();
|
||||||
// Draw marker dots at very end
|
// Draw meter markers along the 3 axis to help with measuring things
|
||||||
|
const float MARKER_DISTANCE = 1.f;
|
||||||
|
const float MARKER_RADIUS = 0.05f;
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(TREE_SCALE, 0, 0);
|
glTranslatef(MARKER_DISTANCE, 0, 0);
|
||||||
glColor3fv(red);
|
glColor3fv(red);
|
||||||
glutSolidSphere(0.125, 10, 10);
|
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(0, TREE_SCALE, 0);
|
glTranslatef(0, MARKER_DISTANCE, 0);
|
||||||
glColor3fv(green);
|
glColor3fv(green);
|
||||||
glutSolidSphere(0.125, 10, 10);
|
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(0, 0, TREE_SCALE);
|
glTranslatef(0, 0, MARKER_DISTANCE);
|
||||||
glColor3fv(blue);
|
glColor3fv(blue);
|
||||||
glutSolidSphere(0.125, 10, 10);
|
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor3fv(gray);
|
glColor3fv(gray);
|
||||||
glTranslatef(TREE_SCALE, 0, TREE_SCALE);
|
glTranslatef(MARKER_DISTANCE, 0, MARKER_DISTANCE);
|
||||||
glutSolidSphere(0.125, 10, 10);
|
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -682,7 +682,7 @@ void Particle::update(const uint64_t& now) {
|
||||||
const uint64_t REALLY_OLD = 30 * USECS_PER_SECOND; // 30 seconds
|
const uint64_t REALLY_OLD = 30 * USECS_PER_SECOND; // 30 seconds
|
||||||
bool isReallyOld = ((now - _created) > REALLY_OLD);
|
bool isReallyOld = ((now - _created) > REALLY_OLD);
|
||||||
bool isInHand = getInHand();
|
bool isInHand = getInHand();
|
||||||
bool shouldDie = getShouldDie() || (!isInHand && isStopped && isReallyOld);
|
bool shouldDie = (getAge() > getLifetime()) || getShouldDie() || (!isInHand && isStopped && isReallyOld);
|
||||||
setShouldDie(shouldDie);
|
setShouldDie(shouldDie);
|
||||||
|
|
||||||
runUpdateScript(); // allow the javascript to alter our state
|
runUpdateScript(); // allow the javascript to alter our state
|
||||||
|
|
|
@ -42,7 +42,7 @@ const uint16_t PACKET_CONTAINS_INHAND = 128;
|
||||||
const uint16_t PACKET_CONTAINS_SCRIPT = 256;
|
const uint16_t PACKET_CONTAINS_SCRIPT = 256;
|
||||||
const uint16_t PACKET_CONTAINS_SHOULDDIE = 512;
|
const uint16_t PACKET_CONTAINS_SHOULDDIE = 512;
|
||||||
|
|
||||||
const float DEFAULT_LIFETIME = 60.0f * 60.0f * 24.0f; // particles live for 1 day by default
|
const float DEFAULT_LIFETIME = 10.0f; // particles live for 10 seconds by default
|
||||||
const float DEFAULT_DAMPING = 0.99f;
|
const float DEFAULT_DAMPING = 0.99f;
|
||||||
const float DEFAULT_RADIUS = 0.1f / TREE_SCALE;
|
const float DEFAULT_RADIUS = 0.1f / TREE_SCALE;
|
||||||
const float MINIMUM_PARTICLE_ELEMENT_SIZE = (1.0f / 100000.0f) / TREE_SCALE; // smallest size container
|
const float MINIMUM_PARTICLE_ELEMENT_SIZE = (1.0f / 100000.0f) / TREE_SCALE; // smallest size container
|
||||||
|
|
|
@ -275,7 +275,7 @@ void ParticleCollisionSystem::applyHardCollision(Particle* particle, float elast
|
||||||
void ParticleCollisionSystem::updateCollisionSound(Particle* particle, const glm::vec3 &penetration, float frequency) {
|
void ParticleCollisionSystem::updateCollisionSound(Particle* particle, const glm::vec3 &penetration, float frequency) {
|
||||||
|
|
||||||
// consider whether to have the collision make a sound
|
// consider whether to have the collision make a sound
|
||||||
const float AUDIBLE_COLLISION_THRESHOLD = 0.1f;
|
const float AUDIBLE_COLLISION_THRESHOLD = 0.3f;
|
||||||
const float COLLISION_LOUDNESS = 1.f;
|
const float COLLISION_LOUDNESS = 1.f;
|
||||||
const float DURATION_SCALING = 0.004f;
|
const float DURATION_SCALING = 0.004f;
|
||||||
const float NOISE_SCALING = 0.1f;
|
const float NOISE_SCALING = 0.1f;
|
||||||
|
|
|
@ -391,17 +391,26 @@ bool ParticleTree::encodeParticlesDeletedSince(uint64_t& sinceTime, unsigned cha
|
||||||
// called by the server when it knows all nodes have been sent deleted packets
|
// called by the server when it knows all nodes have been sent deleted packets
|
||||||
void ParticleTree::forgetParticlesDeletedBefore(uint64_t sinceTime) {
|
void ParticleTree::forgetParticlesDeletedBefore(uint64_t sinceTime) {
|
||||||
//qDebug() << "forgetParticlesDeletedBefore()";
|
//qDebug() << "forgetParticlesDeletedBefore()";
|
||||||
|
QSet<uint64_t> keysToRemove;
|
||||||
|
|
||||||
_recentlyDeletedParticlesLock.lockForWrite();
|
_recentlyDeletedParticlesLock.lockForWrite();
|
||||||
QMultiMap<uint64_t, uint32_t>::iterator iterator = _recentlyDeletedParticleIDs.begin();
|
QMultiMap<uint64_t, uint32_t>::iterator iterator = _recentlyDeletedParticleIDs.begin();
|
||||||
|
// First find all the keys in the map that are older and need to be deleted
|
||||||
while (iterator != _recentlyDeletedParticleIDs.end()) {
|
while (iterator != _recentlyDeletedParticleIDs.end()) {
|
||||||
//qDebug() << "considering... time/key:" << iterator.key();
|
//qDebug() << "considering... time/key:" << iterator.key();
|
||||||
if (iterator.key() <= sinceTime) {
|
if (iterator.key() <= sinceTime) {
|
||||||
//qDebug() << "YES older... time/key:" << iterator.key();
|
//qDebug() << "YES older... time/key:" << iterator.key();
|
||||||
_recentlyDeletedParticleIDs.remove(iterator.key());
|
keysToRemove << iterator.key();
|
||||||
}
|
}
|
||||||
//qDebug() << "about to ++iterator";
|
|
||||||
++iterator;
|
++iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now run through the keysToRemove and remove them
|
||||||
|
foreach (uint64_t value, keysToRemove) {
|
||||||
|
//qDebug() << "removing the key, _recentlyDeletedParticleIDs.remove(value); time/key:" << value;
|
||||||
|
_recentlyDeletedParticleIDs.remove(value);
|
||||||
|
}
|
||||||
|
|
||||||
_recentlyDeletedParticlesLock.unlock();
|
_recentlyDeletedParticlesLock.unlock();
|
||||||
//qDebug() << "DONE forgetParticlesDeletedBefore()";
|
//qDebug() << "DONE forgetParticlesDeletedBefore()";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue