#include <WObject.hpp>
|
| WObjectManager (class Wasabi *const app) |
|
WError | Load () |
|
WObject * | CreateObject (uint32_t ID=0) const |
|
WObject * | CreateObject (class WEffect *fx, uint32_t bindingSet, uint32_t ID=0) const |
|
WObject * | PickObject (double x, double y, bool bAnyHit, uint32_t iObjStartID=0, uint32_t iObjEndID=0, WVector3 *pt=nullptr, WVector2 *uv=nullptr, uint32_t *faceIndex=nullptr) const |
|
| WManager (class Wasabi *const a) |
|
bool | RegisterChangeCallback (std::string name, std::function< void(WObject *, bool)> callback) |
|
void | RemoveChangeCallback (std::string name) |
|
void | AddEntity (WObject *entity) |
|
bool | RemoveEntity (WObject *entity) |
|
void | OnEntityNameChanged (WObject *entity, std::string oldName) |
|
virtual void | Init () |
|
WObject * | GetEntity (uint32_t ID) const |
|
WObject * | GetEntity (std::string name) const |
|
WObject * | GetEntityByIndex (uint32_t index) const |
|
uint32_t | GetEntitiesCount (void) const |
|
Manager class for WObject.
◆ CreateObject() [1/2]
WObject* WObjectManager::CreateObject |
( |
class WEffect * |
fx, |
|
|
uint32_t |
bindingSet, |
|
|
uint32_t |
ID = 0 |
|
) |
| const |
Allocates and initializes a new object.
- Parameters
-
fx | An effect to use. If nullptr, a default effect will be assigned |
bindingSet | Binding set to use for the material of the given fx |
ID | Id of the new object |
- Returns
- New object
◆ CreateObject() [2/2]
WObject* WObjectManager::CreateObject |
( |
uint32_t |
ID = 0 | ) |
const |
Allocates and initializes a new object.
- Parameters
-
- Returns
- New object
◆ Load()
WError WObjectManager::Load |
( |
| ) |
|
Loads the manager.
- Returns
- Error code, see WError.h
◆ PickObject()
WObject* WObjectManager::PickObject |
( |
double |
x, |
|
|
double |
y, |
|
|
bool |
bAnyHit, |
|
|
uint32_t |
iObjStartID = 0 , |
|
|
uint32_t |
iObjEndID = 0 , |
|
|
WVector3 * |
pt = nullptr , |
|
|
WVector2 * |
uv = nullptr , |
|
|
uint32_t * |
faceIndex = nullptr |
|
) |
| const |
Checks if an object is in the view in the default renderer's camera and and part of that object is at the given (x,y) coordinates on the screen. If multiple objects are under the (x,y) coordinate, the one with the closest hit will be returned.
- Parameters
-
x | Screen x coordinate to check for a hit |
y | Screen y coordinate to check for a hit |
bAnyHit | If set to true, the first hit will be returned, otherwise the closest one will be returned |
iObjStartID | If both iObjStartID and iObjEndID are non-zero, then only objects whose ID is between iObjStartID and iObjEndID (inclusive) are considered for picking |
iObjEndID | If both iObjStartID and iObjEndID are non-zero, then only objects whose ID is between iObjStartID and iObjEndID (inclusive) are considered for picking |
pt | Optional pointer to a 3D vector which will be populated with the 3D coordinate at which the hit occurred, if a hit was found |
uv | Optional pointer to a 2D vector which will be populated with the UV coordinates returned by WGeometry::Intersect(), if a hit was found |
faceIndex | Optional pointer to an integer which will be populated with the index of the triangle into the buffer of the geometry of the object that was hit, if a hit was found |
- Returns
- Object that was picked, nullptr if no Object was was picked
The documentation for this class was generated from the following file: