Commit graph

6 commits

Author SHA1 Message Date
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
Triplelexx
a964edee91 change all references of Quat.getFront to Quat.getForward in scripts directory 2017-03-21 22:25:30 +00:00
Andrew Meadows
e87b06657c remove whitespace and fix formatting 2016-04-26 11:24:38 -07:00
Andrew Meadows
0cc12fdaa6 move from examples/ to scripts/developer/ 2016-04-25 17:36:35 -07:00