First attempt to play audio

This commit is contained in:
2023-01-17 00:11:22 -08:00
parent f2a0d3b3bb
commit 2950bc9184
44 changed files with 698 additions and 82 deletions

View File

@ -0,0 +1,60 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "scene/components/display/Material.hpp"
#include "scene/SceneItem.hpp"
namespace Dawn {
template<class T>
class ShaderInterface : public SceneItemComponent {
public:
/**
* ShaderInterface to provide a common interface language for all shaders
* that can be referenced by scene components.
*
* @param i SceneItem this Shader interface belongs to.
*/
ShaderInterface(SceneItem *i) : SceneItemComponent(i) {}
/**
* Sets the shader for this shader interface to use. Will also update the
* underlying material for you.
*
* @param shader Shader to use for this interface.
*/
void setShader(T *shader) {
assertNotNull(shader);
this->getMaterial()->setShader(shader);
}
/**
* Returns the shader, assuming that the material has the correct shader.
*
* @return Pointer to the shader.
*/
T * getShader() {
auto material = dynamic_cast<T*>(this->getMaterial()->getShader());
return material;
}
/**
* Returns the material attached to this scene item.
*
* @return The attached material.
*/
Material * getMaterial() {
auto mat = this->item->getComponent<Material>();
assertNotNull(mat);
return mat;
}
std::vector<SceneItemComponent*> getDependencies() override {
return std::vector<SceneItemComponent*>{
this->item->getComponent<Material>()
};
}
};
}