Commit graph

60 commits

Author SHA1 Message Date
sabrina-shanman
4ffe164569 Address Mac/Linux build warnings 2018-08-08 08:56:35 -07:00
sabrina-shanman
4ca9899000 Use SHAPE_TYPE_NONE instead of (ShapeType)0 in ShapeInfo.cpp 2018-07-24 11:37:52 -07:00
sabrina-shanman
f33ee55f9e Create CollisionPick API 2018-07-19 10:33:21 -07:00
David Rowe
67cfe783be Entity properties JSDoc 2018-02-19 12:17:31 +13:00
Andrew Meadows
45e571dd02 cleanup ShapeInfo::getHash() 2017-10-27 07:52:51 -07:00
Andrew Meadows
c14bbb76e6 fix compile errors after merge 2017-10-25 11:57:44 -07:00
Andrew Meadows
2d0b94817c Merge pull request #11336 from 1P-Cusack/21389_PR2
WL21389 PR2: Representation of collision shapes need updating (details below).
2017-10-25 10:41:21 -07:00
Andrew Meadows
996b71fa9a avoid incorrect ShapeManager dupes for compound shapes 2017-10-24 13:23:46 -07:00
LaShonda Hopper
d3e4d22ce1 [WL21389] Resolve ShapeInfo todos (details below).
* Added remaining cylinder/capsule shapes to computeVolume
* Point lists are generated during computeShapeInfo, so shouldn't
  need to be cleared within setParams.
** setSphere/setBox appear to be clear as they're used in tests or
   in local scopes without using point data.

Reviewed-by: Leander Hasty <leander@1stplayable.com>

Changes Committed:
    modified:   libraries/shared/src/ShapeInfo.cpp
2017-10-24 14:16:25 -04:00
LaShonda Hopper
5c8e73bb54 [WL21389] Minor: Fix size_t vs int comparison warning.
Changes Committed:
    modified:   libraries/shared/src/ShapeInfo.cpp
2017-10-24 14:16:24 -04:00
LaShonda Hopper
e74ebd53c6 [WL21389] Add SHAPE_TYPE_SIMPLE_HULL case to ShapeInfo::getHash (details below).
Generates hashes for Simple Hull instances by incorporating their
point list into the hash as opposed to the extents.

Reviewed-by: Leander Hasty <leander@1stplayable.com>

Changes Committed:
    modified:   libraries/shared/src/ShapeInfo.cpp
2017-10-24 14:16:24 -04:00
LaShonda Hopper
9d64a3b991 [WL21389] Fixes warnings from last commit (details below).
* Fixes int vs size_t comparison warning within ShapeInfo.
* Fixes unused var warning for shapeVerts local var within GeometryCache.

This should fix the mac & ubuntu builds.

Changes Committed:
    modified:   libraries/render-utils/src/GeometryCache.cpp
    modified:   libraries/shared/src/ShapeInfo.cpp
2017-10-24 14:16:24 -04:00
LaShonda Hopper
dbd1a80046 [WL21389] Set Simulation::DIRTY_SHAPE flag when entity::Shape changes (details below).
* Fixes an issue where ShapeEntityItem's collisionShapeType wasn't updated when its
  entity::Shape type was changed.
* Adds getNameForShapeType static method to ShapeInfo.
** Moves shapeTypeNames[] from EntityItemProperties.cpp to ShapeInfo.cpp
* Adds collisionShapeType to ShapeEntityItem::debugDump

* Tested creating shapes within the Creation Menu:
** Create Menu -> (Box/Sphere)
*** Observe Properties tab auto-focus
** From Properties tab elect alternate shape type from the Shape Dropdown list.

NOTE:  While this fixes an issue with the collision shape, it doesn't completely
       resolve the issues seen with the polyhedra or polygonal shapes noticed on
       RELEASE-7130 rebase.

Reviewed-by: Leander Hasty <leander@1stplayable.com>

Changes Committed:
    modified:   libraries/entities/src/EntityItemProperties.cpp
    modified:   libraries/entities/src/ShapeEntityItem.cpp
    modified:   libraries/shared/src/ShapeInfo.cpp
    modified:   libraries/shared/src/ShapeInfo.h
2017-10-24 14:16:24 -04:00
LaShonda Hopper
5b50b362f1 [WL21389] WL21389 PR2: Representation of collision shapes need updating (details below).
This commit adds support for the polyhedrons and polygons sans
Torus and Quad which aren't currently supported within GeometryCache.

* Moves GeometryCache::_shapes from public to private scope
    * Nothing aside from the class should be directly altering this, only querying
    * Updated instances of direct referencing which looks to have been limited to prior
      testing of instancing and shapes.
* Adds an accessor function for ShapeData to GeometryCache
* Consolidates point list generation to helper function
    * GeometryCache::computeSimpleHullPointListForShape
* Moves GeometryCache::Shape to entity::Shape mapping to GeometryCache from
  RenderableShapeEntityItem
    * Adds conversion accessor to GeometryCache, GeometryCache::Shape getShapeForEntityShape
* Sets ShapeEntityItem::ShapeInfoCalculator callback committed earlier.
    * This helps circumvent the issue with library inclusion.  entity-render knows about
      entity; however, entity doesn't know about entity-renderer; however, GeometryCache
      data is needed within entity::ShapeEntityItem to compose the ShapeInfo point list data.
    * This callback is set up within Application::init of the Interface as it knows about
      both halves of the equation, and the callback needs to be setup prior to any entities
      collision data getting generated.
* Removes _type reset within ShapeInfo::setPointCollection
    * This should avoid any issues due to subversively setting the type or
      incorrectly setting the type as a tangential operation.
        * Audited instances of ShapeInfo::setPointCollection and all seemed to be
          calling the function immediately after having set the type via
          ShapeInfo::setParams
* Adds new ShapeType: SHAPE_TYPE_CIRCLE
    * This type is reserved for the circle which is now treated as a special
      type of Cylinder_Y with regard to collision as opposed to a simple hull.
    * Fixes the issue where jumping on a circle, at times, would
      result in the avatar sliding off towards an edge as if atop a
      squished cone.
* Also updates ShapeInfo::getType() to return ShapeType as opposed to int
    * Auditing calls showed that majority of places were comparing against ShapeType
    * ShapeType::_type is a ShapeType so returning the type explicitly
      is more consistent.
        * ShapeInfo file houses ShapeType enum so any file aware of ShapeInfo is aware of
          ShapeType enumeration.
* entity::Quad defaults to SHAPE_TYPE_ELLIPSOID
    * Like entity::Shape::Torus, entity::Shape::Quad is currently unsupported within
      GeometryCache::buildShapes.
    * Also it appears that a Quad shape can't be created within world via the creation menu.
        * There's no explicit option at present to create one.
        * Trying subvert the Cube/Box creation option to generate one results in an enforced
          stubby box as opposed to a quad.
    * Given the aforementioned points, entity::Shape::Quad will default to
      SHAPE_TYPE_ELLIPSOID as opposed to SHAPE_TYPE_BOX.
        * Added Todo regarding the shape being unsupported along with a notation to create
          a special ShapeType, SHAPE_TYPE_QUAD, for it should it be added in the future.
* Adds some comments and has some minor clean up.

Reviewed-by: Leander Hasty <leander@1stplayable.com>

Changes Committed:
	modified:   interface/src/Application.cpp
	modified:   interface/src/Util.cpp
	modified:   interface/src/Util.h
	modified:   libraries/entities-renderer/src/RenderableShapeEntityItem.cpp
	modified:   libraries/entities/src/ShapeEntityItem.cpp
	modified:   libraries/entities/src/ShapeEntityItem.h
	modified:   libraries/physics/src/ShapeFactory.cpp
	modified:   libraries/render-utils/src/GeometryCache.cpp
	modified:   libraries/render-utils/src/GeometryCache.h
	modified:   libraries/shared/src/ShapeInfo.cpp
	modified:   libraries/shared/src/ShapeInfo.h
	modified:   tests/gpu-test/src/TestInstancedShapes.cpp
2017-10-24 14:16:17 -04:00
LaShonda Hopper
cc4fbc97cd [WL21389] PR1 Update based on code review discussion & feedback (details below).
* Removed some left overs from prior approach.
* Moved _collisionShapeType & getShapeType override from ShapeEntityItem to
  RenderableShapeEntityItem (see thread: https://github.com/highfidelity/hifi/pull/11048#discussion_r130154903)
* Switched _collisionShapeType default from SHAPE_TYPE_NONE to SHAPE_TYPE_ELLIPSOID
** see thread: https://github.com/highfidelity/hifi/pull/11048#discussion_r129982909

Note(s):
* Retested and the cylinder behaves as expected along with the Box & Sphere shapes
  save from the previously mentioned caveats in the PR notes (https://github.com/highfidelity/hifi/pull/11048)
* Confirmed that currently unsupported shapes (hedrons, polygons, & cone) fallback to
  ellipsoid behavior given default change.

Changes Committed:
	modified:   libraries/entities-renderer/src/RenderableShapeEntityItem.cpp
	modified:   libraries/entities-renderer/src/RenderableShapeEntityItem.h
	modified:   libraries/entities/src/ShapeEntityItem.cpp
	modified:   libraries/entities/src/ShapeEntityItem.h
	modified:   libraries/shared/src/ShapeInfo.cpp
2017-07-28 15:59:17 -04:00
LaShonda Hopper
ef1e426273 [WL21389] Some code and todo cleanup in prep for PR1.
Changes to be committed:
	modified:   libraries/entities-renderer/src/RenderableShapeEntityItem.cpp
	modified:   libraries/entities/src/ShapeEntityItem.cpp
	modified:   libraries/physics/src/ShapeFactory.cpp
	modified:   libraries/shared/src/ShapeInfo.cpp
2017-07-25 15:27:02 -04:00
Leander Hasty
d155c02640 [WL21389] wip and modifications based on comments
https://github.com/highfidelity/hifi/pull/11024#pullrequestreview-51611518

Cleans up tabs, moves new functionality out of ShapeFactory directly to
RenderableShapeEntityItem's computeShapeInfo override, begins to break down
where we will need pointlists.

Still need to determine how rotation is handled for pointlists, and check
for axis alignment on cylinders before deciding on a shape.

Changes to be committed:
	modified:   libraries/entities-renderer/src/RenderableShapeEntityItem.cpp
	modified:   libraries/entities-renderer/src/RenderableShapeEntityItem.h
	modified:   libraries/entities/CMakeLists.txt
	modified:   libraries/entities/src/ShapeEntityItem.cpp
	modified:   libraries/entities/src/ShapeEntityItem.h
	modified:   libraries/physics/src/ShapeFactory.cpp
	modified:   libraries/physics/src/ShapeFactory.h
	modified:   libraries/shared/src/ShapeInfo.cpp
	modified:   scripts/developer/tests/basicEntityTest/entitySpawner.js
2017-07-25 15:20:35 -04:00
LaShonda Hopper
75403124b6 [WL21389] Addresses physics library dependency and has some other fixes (details below).
* Addresses physics library dependency by moving computeShapeInfo override from
ShapeEntityItem (which is within Entities Library) to RenderableShapeEntityItem
(which is in Entities-Renderer Library).
** Entities-Renderer library already links against the physic library.
** Per discussion with Andrew Meadows: In order to ShapeEntityItem to be
utilized the library dependency between the Entity and Physics library
would need to be resolved to avoid the cyclical reliance which isn't in
the scope of this ticket.
* Updates shapeSpawner test script from the default clone of basicEntityTest\entitySpawner.js
** Objects now have a finite lifetime
** Script now cleans up the objects created when the script ends
** Also moved some adjustable properties out into var aliases at the top of the
file for easier/less error prone tweaking. Should probably add one for the shapeType.
* Fixes some issues with validateShapeType helper function
* Removed naive attempt at including physics library within entities library.
* Transferred some todos from notes
* Fixed some formatting

NOTE(s):
  This compiles and runs.  Cylinder is spawned and treated as CYLINDER_Y.

TODO(s):
* Add tweakable var for shapeType within shapeSpawner.js
* Vet and verify other shapes.
* Add in edge case handling.
* Add in support for other shapes to ShapeInfo infrastructure.

Changes to be committed:
	modified:   libraries/entities-renderer/src/RenderableShapeEntityItem.cpp
	modified:   libraries/entities-renderer/src/RenderableShapeEntityItem.h
	modified:   libraries/entities/CMakeLists.txt
	modified:   libraries/entities/src/ShapeEntityItem.cpp
	modified:   libraries/entities/src/ShapeEntityItem.h
	modified:   libraries/physics/src/ShapeFactory.cpp
	modified:   libraries/shared/src/ShapeInfo.cpp
	modified:   scripts/developer/tests/basicEntityTest/shapeSpawner.js
2017-07-25 14:43:39 -04:00
LaShonda Hopper
5bc38bd7f0 [WL21389] Collision Shapes need to be updated (details below).
Revised approach involves creating a helper function within ShapeFactory to aid
in devising the ShapeType to be used by an ShapeEntityItem for collision.  The
ShapeFactory is currently doing this for creating the actual Bullet Library
collision shapes.

ShapeEntityItem overrides its virtually inherited computeShapeInfo which
in turn calls the new ShapeFactory helper function.

ShapeEntityItem has a new memvar _collisionShapeType to cache its actual
ShapeType used by the physics system.  This memvar is returned via the getShapeType
accessor which is expected to return an object's ShapeType.

Note(s):
    This is similar to the original approach save translation between entity::Shape and ShapeType
    isn't tied to the EntityItemProperties shapeTypeNames or shapeType. This approach more
    directly solves the issue of getting the actual ShapeType used by the time it's needed
    to determine the bullet collision object type created when initializing the physic information.

    Translation of the ShapeEntityItem's entity::Shape to its ShapeType is handled by
    ShapeFactory which handles creating the bullet collision objects when setting up
    physics on the ShapeEntityItems.

Known Issue(s):
    This doesn't compile.  It appears that the Entity Library needs to know about
    the Physics Library.  The naive attempt at providing that link failed to resolve
    all compilation issues.

    Current Error:
    C1083: Cannot open include file: btBulletDynamicsCommon.h:
    No such file or directory (C:\projects\cusack\libraries\entities\src\ShapeEntityItem.cpp)
       C:\projects\cusack\libraries\physics\src\ShapeFactory.h	15	1	entities

	modified:   libraries/entities-renderer/src/RenderableShapeEntityItem.cpp
	modified:   libraries/entities/CMakeLists.txt
	modified:   libraries/entities/src/ShapeEntityItem.cpp
	modified:   libraries/entities/src/ShapeEntityItem.h
	modified:   libraries/physics/src/ShapeFactory.cpp
	modified:   libraries/physics/src/ShapeFactory.h
	modified:   libraries/physics/src/ShapeInfo.cpp
	modified:   scripts/developer/tests/basicEntityTest/entitySpawner.js
	new file:   scripts/developer/tests/basicEntityTest/shapeSpawner.js
2017-07-25 14:43:07 -04:00
Andrew Meadows
2299bb7718 supply minimum shape rather than null 2017-07-06 10:37:44 -07:00
Andrew Meadows
a31a861e19 fix typo: physcis --> physics 2017-05-05 09:33:50 -07:00
Anthony J. Thibault
89ae3b3d6e Revert "Merge pull request #8691 from highfidelity/out-of-body-experience"
This reverts commit efe9571ab8, reversing
changes made to 333e9ec7f4.
2016-12-05 15:18:03 -08:00
Andrew Meadows
2bbe2be516 fix spelling: physcis --> physics 2016-12-01 10:50:10 -08:00
Andrew Meadows
4b623f72c3 compute correct volume for ellipsoid 2016-11-03 18:05:50 -07:00
Andrew Meadows
0d2cec290d use convexHull for ellipsoidal "spheres" 2016-11-03 17:56:38 -07:00
Andrew Meadows
5659d57ac3 fix shape generation for SIMPLE_COMPOUND 2016-07-06 13:00:57 -07:00
Andrew Meadows
937bd0c1be SHAPE_TYPE_MESH --> SHAPE_TYPE_STATIC_MESH 2016-06-21 13:54:21 -07:00
Andrew Meadows
2f6e5ab2ee remove fall-through in switch/case logic 2016-06-20 17:29:20 -07:00
Andrew Meadows
a519b77ae7 add SHAPE_TYPE_MESH and build mesh shapes 2016-06-20 17:29:20 -07:00
Andrew Meadows
d64729372a ShapeInfo name changes 2016-06-20 17:29:20 -07:00
Andrew Meadows
9dc0fa7796 don't automatically clear ShapeInfo points 2016-06-03 10:47:54 -07:00
Andrew Meadows
211bbb88e6 purge SHAPE_TYPE_ELLIPSOID which wasn't used 2016-06-03 10:47:54 -07:00
Andrew Meadows
7866fcf78c trim high-point convex hulls 2016-05-20 09:41:26 -07:00
Andrew Meadows
466af03fa9 support for ShapeInfo::offset 2015-05-21 16:25:05 -07:00
Andrew Meadows
67f5d0773d some list management of AvatarMotionStates 2015-05-21 14:40:47 -07:00
Stephen Birarda
94739cf8d3 move number constants out of SharedUtil to NumericalConstants 2015-05-01 10:26:53 -07:00
Atlante45
b340cd06bf Fix volume formula for capsules 2015-04-23 19:14:07 +02:00
Atlante45
83490051d9 Move shape related contains() to ShapeInfo 2015-04-23 18:55:20 +02:00
Andrew Meadows
da9091a99d remove SHAPE_TYPE_CONVEX_HULL from libs and tests 2015-04-14 14:54:43 -07:00
Seth Alves
dd9290bd59 clear points for non-hull shapes 2015-03-25 15:21:28 -07:00
Seth Alves
c8ad82917e clean up some debugging spew. take dimensions into account when scaling points used for collision hull creation 2015-03-23 16:54:36 -07:00
Seth Alves
bfc5cf99d6 more code for compound hull collisions 2015-03-21 16:11:47 -07:00
Seth Alves
769194f046 first stab at compound hull collisions 2015-03-20 13:41:14 -07:00
Andrew Meadows
c032b29633 proper shape management for ConvexHull shapes 2015-03-18 16:29:57 -07:00
Seth Alves
222c3f01eb minor cleanups, diff minimization 2015-03-17 14:24:46 -07:00
Seth Alves
b815c365eb formatting 2015-03-13 18:57:27 -07:00
Seth Alves
87cc710efc more merge madness, calculate 2nd PhysicsEngine hash with qChecksum if url is set 2015-03-13 18:43:24 -07:00
Seth Alves
2368e6e5b7 collision with a hull sort of works. there is a new memory corruption problem 2015-03-13 15:41:57 -07:00
Seth Alves
3a3e723f4e trying to figureo out where to download hull models 2015-03-11 14:26:30 -07:00
Seth Alves
1c73f50dbc started to hook up geometry downloader to ShapeInfo 2015-03-11 07:17:13 -07:00