Audio API first pass

This commit is contained in:
2023-01-17 10:13:08 -08:00
parent 2950bc9184
commit 9168348e6b
27 changed files with 513 additions and 95 deletions

View File

@ -89,6 +89,7 @@ void Transform::setLocalPosition(glm::vec3 position) {
this->localPosition = position;
this->updateLocalTransformFromLocalValues();
this->updateChildrenTransforms();
this->eventTransformUpdated.invoke();
}
glm::vec3 Transform::getLocalScale() {
@ -99,6 +100,7 @@ void Transform::setLocalScale(glm::vec3 scale) {
this->localScale = scale;
this->updateLocalTransformFromLocalValues();
this->updateChildrenTransforms();
this->eventTransformUpdated.invoke();
}
glm::quat Transform::getLocalRotation() {
@ -109,6 +111,7 @@ void Transform::setLocalRotation(glm::quat rotation) {
this->localRotation = rotation;
this->updateLocalTransformFromLocalValues();
this->updateChildrenTransforms();
this->eventTransformUpdated.invoke();
}
@ -121,6 +124,11 @@ void Transform::setLocalTransform(glm::mat4 transform) {
this->updateLocalValuesFromLocalTransform();
this->updateChildrenTransforms();
this->eventTransformUpdated.invoke();
}
glm::vec3 Transform::getWorldPosition() {
return glm::vec3(this->transformWorld[3]);
}
glm::mat4 Transform::getWorldTransform() {
@ -131,6 +139,7 @@ void Transform::setWorldTransform(glm::mat4 transform) {
this->transformWorld = transform;
this->updateLocalTransformFromWorldTransform();
this->updateChildrenTransforms();
this->eventTransformUpdated.invoke();
}
@ -156,6 +165,7 @@ void Transform::setParent(Transform *parent) {
this->updateLocalTransformFromWorldTransform();
this->updateChildrenTransforms();
this->eventTransformUpdated.invoke();
}
Transform * Transform::getParent() {

View File

@ -7,6 +7,7 @@
#include "dawnlibs.hpp"
#include "assert/assert.hpp"
#include "util/flag.hpp"
#include "event/Event.hpp"
namespace Dawn {
class SceneItem;
@ -38,6 +39,8 @@ namespace Dawn {
void updateChildrenTransforms();
public:
// I have no idea if I'm keeping this
Event<> eventTransformUpdated;
SceneItem *item;
/**
@ -123,6 +126,13 @@ namespace Dawn {
*/
void setLocalTransform(glm::mat4 transform);
/**
* Returns the position of the origin of this transform in world-space.
*
* @return Transform origin in world-space.
*/
glm::vec3 getWorldPosition();
/**
* Returns the transformation matrix for this transform, in world-space.
* @return The transform origin in world-space.