mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
Merge branch andrew/isentropic
This commit is contained in:
commit
b34189115d
4 changed files with 107 additions and 51 deletions
29
BUILD_WIN.md
29
BUILD_WIN.md
|
@ -132,6 +132,35 @@ This package contains only headers, so there's nothing to add to the PATH.
|
|||
|
||||
Be careful with glm. For the folder other libraries would normally call 'include', the folder containing the headers, glm opts to use 'glm'. You will have a glm folder nested inside the top-level glm folder.
|
||||
|
||||
###Bullet
|
||||
|
||||
Bullet 2.82 source can be downloaded [here](https://code.google.com/p/bullet/downloads/detail?name=bullet-2.82-r2704.zip). Bullet does not come with prebuilt libraries, you need to make those yourself.
|
||||
|
||||
* Download the zip file and extract into a temporary folder
|
||||
* Create a directory named cmakebuild. Bullet comes with a build\ directory by default, however, that directory is intended for use with premake, and considering premake doesn't support VS2013, I prefer to run the cmake build on its own directory.
|
||||
* Make the following modifications to Bullet's source:
|
||||
1. In file: Extras\HACD\hacdICHull.cpp --- in line: 17 --- insert: #include <algorithm>
|
||||
2. In file: src\MiniCL\cl_MiniCL_Defs.h --- comment lines 364 to 372
|
||||
3. In file: CMakeLists.txt set to ON the option USE_MSVC_RUNTIME_LIBRARY_DLL in line 27
|
||||
|
||||
Then create the Visual Studio solution and build the libraries - run the following commands from a Visual Studio 2013 command prompt, from within the cmakebuild directory created before:
|
||||
|
||||
```shell
|
||||
cmake .. -G "Visual Studio 12"
|
||||
msbuild BULLET_PHYSICS.sln /p:Configuration=Debug
|
||||
```
|
||||
|
||||
This will create Debug libraries in cmakebuild\lib\Debug you can replace Debug with Release in the msbuild command and that will generate Release libraries in cmakebuild\lib\Release.
|
||||
|
||||
You now have Bullet libraries compiled, now you need to put them in the right place for hifi to find them:
|
||||
|
||||
* Create a directory named bullet\ inside your %HIFI_LIB_DIR%
|
||||
* Create two directores named lib\ and include\ inside bullet\
|
||||
* Copy all the contents inside src\ from the bullet unzip path into %HIFI_LIB_DIR%\bullet\include\
|
||||
* Copy all the contents inside cmakebuild\lib\ into %HIFI_LIB_DIR\bullet\lib
|
||||
|
||||
_Note that the INSTALL target should handle the copying of files into an install directory automatically, however, without modifications to Cmake, the install target didn't work right for me, please update this instructions if you get that working right - Leo <leo@highfidelity.io>_
|
||||
|
||||
###Build High Fidelity using Visual Studio
|
||||
Follow the same build steps from the CMake section, but pass a different generator to CMake.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ body {
|
|||
background-color: rgb(76, 76, 76);
|
||||
color: rgb(204, 204, 204);
|
||||
font-family: Arial;
|
||||
font-size: 11px;
|
||||
font-size: 8.25pt;
|
||||
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
|
@ -31,25 +31,25 @@ body {
|
|||
|
||||
.color-box {
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 1px solid black;
|
||||
margin: 2px;
|
||||
width: 15pt;
|
||||
height: 15pt;
|
||||
border: 0.75pt solid black;
|
||||
margin: 1.5pt;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.color-box.highlight {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 2px solid black;
|
||||
width: 13.5pt;
|
||||
height: 13.5pt;
|
||||
border: 1.5pt solid black;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
background: #AAA;
|
||||
border-bottom: 1px solid #CCC;
|
||||
border-bottom: 0.75pt solid #CCC;
|
||||
background-color: #333333;
|
||||
color: #999;
|
||||
padding: 4px;
|
||||
padding: 3pt;
|
||||
}
|
||||
|
||||
.section-header label {
|
||||
|
@ -61,7 +61,7 @@ body {
|
|||
.property-section {
|
||||
display: block;
|
||||
margin: 10 10;
|
||||
height: 30px;
|
||||
height: 22.5pt;
|
||||
}
|
||||
|
||||
.property-section label {
|
||||
|
@ -73,7 +73,7 @@ body {
|
|||
}
|
||||
|
||||
.grid-section {
|
||||
border-top: 1px solid #DDD;
|
||||
border-top: 0.75pt solid #DDD;
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
|
@ -81,8 +81,8 @@ input[type=button] {
|
|||
cursor: pointer;
|
||||
background-color: #608e96;
|
||||
border-color: #608e96;
|
||||
border-radius: 5px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 3.75pt;
|
||||
padding: 3.75pt 7.5pt;
|
||||
border: 0;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
|
@ -90,8 +90,8 @@ input[type=button] {
|
|||
|
||||
textarea, input {
|
||||
margin: 0;
|
||||
padding: 2px;
|
||||
border: 1px solid #999;
|
||||
padding: 1.5pt;
|
||||
border: 0.75pt solid #999;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
|
@ -112,13 +112,13 @@ input.coord {
|
|||
table#entity-table {
|
||||
border-collapse: collapse;
|
||||
font-family: Sans-Serif;
|
||||
font-size: 10px;
|
||||
font-size: 7.5pt;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#entity-table tr {
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid rgb(63, 63, 63)
|
||||
border-bottom: 0.75pt solid rgb(63, 63, 63)
|
||||
}
|
||||
|
||||
#entity-table tr.selected {
|
||||
|
@ -128,15 +128,15 @@ table#entity-table {
|
|||
#entity-table th {
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
border: 0px black solid;
|
||||
border: 0pt black solid;
|
||||
text-align: left;
|
||||
word-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#entity-table td {
|
||||
font-size: 11px;
|
||||
border: 0px black solid;
|
||||
font-size: 8.25pt;
|
||||
border: 0pt black solid;
|
||||
word-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
|
@ -148,21 +148,21 @@ table#entity-table {
|
|||
}
|
||||
|
||||
th#entity-type {
|
||||
width: 60px;
|
||||
width: 33.75pt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
div.input-area {
|
||||
display: inline-block;
|
||||
font-size: 10px;
|
||||
font-size: 7.5pt;
|
||||
}
|
||||
|
||||
input {
|
||||
}
|
||||
|
||||
#type {
|
||||
font-size: 14px;
|
||||
font-size: 10.5pt;
|
||||
}
|
||||
|
||||
#type label {
|
||||
|
@ -173,22 +173,22 @@ input {
|
|||
background-color: rgb(102, 102, 102);
|
||||
color: rgb(204, 204, 204);
|
||||
border: none;
|
||||
font-size: 10px;
|
||||
font-size: 7.5pt;
|
||||
}
|
||||
|
||||
#properties-list input[type=button] {
|
||||
cursor: pointer;
|
||||
background-color: rgb(51, 102, 102);
|
||||
border-color: #608e96;
|
||||
border-radius: 5px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 3.75pt;
|
||||
padding: 3.75pt 7.5pt;
|
||||
border: 0;
|
||||
color: rgb(204, 204, 204);
|
||||
}
|
||||
|
||||
#properties-list .property {
|
||||
padding: 8px 8px;
|
||||
border-top: 1px solid rgb(63, 63, 63);
|
||||
padding: 6pt 6pt;
|
||||
border-top: 0.75pt solid rgb(63, 63, 63);
|
||||
min-height: 1em;
|
||||
}
|
||||
|
||||
|
@ -203,11 +203,11 @@ table#properties-list {
|
|||
}
|
||||
|
||||
#properties-list > div {
|
||||
margin: 4px 0;
|
||||
margin: 3pt 0;
|
||||
}
|
||||
|
||||
#properties-list {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
border-bottom: 0.75pt solid #e5e5e5;
|
||||
}
|
||||
|
||||
#properties-list .label {
|
||||
|
@ -221,11 +221,11 @@ table#properties-list {
|
|||
}
|
||||
|
||||
#properties-list .value > div{
|
||||
padding: 4px 0;
|
||||
padding: 3pt 0;
|
||||
}
|
||||
|
||||
col#col-label {
|
||||
width: 130px;
|
||||
width: 97.5pt;
|
||||
}
|
||||
|
||||
div.outer {
|
||||
|
|
|
@ -300,21 +300,23 @@ void PhysicsEngine::stepSimulation() {
|
|||
stepNonPhysicalKinematics(usecTimestampNow());
|
||||
unlock();
|
||||
|
||||
// This is step (3) which is done outside of stepSimulation() so we can lock _entityTree.
|
||||
//
|
||||
// Unfortunately we have to unlock the simulation (above) before we try to lock the _entityTree
|
||||
// to avoid deadlock -- the _entityTree may try to lock its EntitySimulation (from which this
|
||||
// PhysicsEngine derives) when updating/adding/deleting entities so we need to wait for our own
|
||||
// lock on the tree before we re-lock ourselves.
|
||||
//
|
||||
// TODO: untangle these lock sequences.
|
||||
_entityTree->lockForWrite();
|
||||
lock();
|
||||
_dynamicsWorld->synchronizeMotionStates();
|
||||
unlock();
|
||||
_entityTree->unlock();
|
||||
|
||||
computeCollisionEvents();
|
||||
if (numSubsteps > 0) {
|
||||
// This is step (3) which is done outside of stepSimulation() so we can lock _entityTree.
|
||||
//
|
||||
// Unfortunately we have to unlock the simulation (above) before we try to lock the _entityTree
|
||||
// to avoid deadlock -- the _entityTree may try to lock its EntitySimulation (from which this
|
||||
// PhysicsEngine derives) when updating/adding/deleting entities so we need to wait for our own
|
||||
// lock on the tree before we re-lock ourselves.
|
||||
//
|
||||
// TODO: untangle these lock sequences.
|
||||
_entityTree->lockForWrite();
|
||||
lock();
|
||||
_dynamicsWorld->synchronizeMotionStates();
|
||||
unlock();
|
||||
_entityTree->unlock();
|
||||
|
||||
computeCollisionEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void PhysicsEngine::stepNonPhysicalKinematics(const quint64& now) {
|
||||
|
@ -329,23 +331,47 @@ void PhysicsEngine::stepNonPhysicalKinematics(const quint64& now) {
|
|||
// TODO?: need to occasionally scan for stopped non-physical kinematics objects
|
||||
|
||||
void PhysicsEngine::computeCollisionEvents() {
|
||||
// update all contacts
|
||||
// update all contacts every frame
|
||||
int numManifolds = _collisionDispatcher->getNumManifolds();
|
||||
for (int i = 0; i < numManifolds; ++i) {
|
||||
btPersistentManifold* contactManifold = _collisionDispatcher->getManifoldByIndexInternal(i);
|
||||
if (contactManifold->getNumContacts() > 0) {
|
||||
// TODO: require scripts to register interest in callbacks for specific objects
|
||||
// so we can filter out most collision events right here.
|
||||
const btCollisionObject* objectA = static_cast<const btCollisionObject*>(contactManifold->getBody0());
|
||||
const btCollisionObject* objectB = static_cast<const btCollisionObject*>(contactManifold->getBody1());
|
||||
|
||||
if (!(objectA->isActive() || objectB->isActive())) {
|
||||
// both objects are inactive so stop tracking this contact,
|
||||
// which will eventually trigger a CONTACT_EVENT_TYPE_END
|
||||
continue;
|
||||
}
|
||||
|
||||
void* a = objectA->getUserPointer();
|
||||
void* b = objectB->getUserPointer();
|
||||
if (a || b) {
|
||||
// the manifold has up to 4 distinct points, but only extract info from the first
|
||||
_contactMap[ContactKey(a, b)].update(_numSubsteps, contactManifold->getContactPoint(0), _originOffset);
|
||||
_contactMap[ContactKey(a, b)].update(_numContactFrames, contactManifold->getContactPoint(0), _originOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We harvest collision callbacks every few frames, which contributes the following effects:
|
||||
//
|
||||
// (1) There is a maximum collision callback rate per pair: substep_rate / SUBSTEPS_PER_COLLIION_FRAME
|
||||
// (2) END/START cycles shorter than SUBSTEPS_PER_COLLIION_FRAME will be filtered out
|
||||
// (3) There is variable lag between when the contact actually starts and when it is reported,
|
||||
// up to SUBSTEPS_PER_COLLIION_FRAME * time_per_substep
|
||||
//
|
||||
const uint32_t SUBSTEPS_PER_COLLISION_FRAME = 2;
|
||||
if (_numSubsteps - _numContactFrames * SUBSTEPS_PER_COLLISION_FRAME < SUBSTEPS_PER_COLLISION_FRAME) {
|
||||
// we don't harvest collision callbacks every frame
|
||||
// this sets a maximum callback-per-contact rate
|
||||
// and also filters out END/START events that happen on shorter timescales
|
||||
return;
|
||||
}
|
||||
|
||||
++_numContactFrames;
|
||||
// scan known contacts and trigger events
|
||||
ContactMap::iterator contactItr = _contactMap.begin();
|
||||
while (contactItr != _contactMap.end()) {
|
||||
|
@ -369,7 +395,7 @@ void PhysicsEngine::computeCollisionEvents() {
|
|||
}
|
||||
|
||||
// TODO: enable scripts to filter based on contact event type
|
||||
ContactEventType type = contactItr->second.computeType(_numSubsteps);
|
||||
ContactEventType type = contactItr->second.computeType(_numContactFrames);
|
||||
if (type == CONTACT_EVENT_TYPE_END) {
|
||||
ContactMap::iterator iterToDelete = contactItr;
|
||||
++contactItr;
|
||||
|
|
|
@ -113,6 +113,7 @@ private:
|
|||
EntityEditPacketSender* _entityPacketSender = NULL;
|
||||
|
||||
ContactMap _contactMap;
|
||||
uint32_t _numContactFrames = 0;
|
||||
};
|
||||
|
||||
#endif // hifi_PhysicsEngine_h
|
||||
|
|
Loading…
Reference in a new issue