Skip to content

Commit

Permalink
sync work
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtleP committed Dec 12, 2023
1 parent b4dd2db commit 336da6a
Show file tree
Hide file tree
Showing 18 changed files with 1,394 additions and 59 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ target_sources(${PROJECT_NAME} PRIVATE
source/common/type.cpp
source/common/variant.cpp
source/common/vector.cpp
source/common/volatile.cpp
source/main.cpp
source/modules/audio/audio.cpp
source/modules/audio/wrap_audio.cpp
Expand Down Expand Up @@ -516,6 +517,7 @@ target_sources(${PROJECT_NAME} PRIVATE
source/utilities/driver/renderer/polyline/types/nonejoin.cpp
source/utilities/driver/renderer/renderstate.cpp
source/utilities/driver/renderer/samplerstate.cpp
source/utilities/driver/renderer/vertex.cpp
source/utilities/formathandler/formathandler.cpp
source/utilities/formathandler/types/astchandler.cpp
source/utilities/formathandler/types/ddshandler.cpp
Expand Down
36 changes: 36 additions & 0 deletions include/common/matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,42 @@ namespace love
}
}

template<typename Vdst, typename Vsrc>
/* transform Vector2 src into Vector2 dst */
void TransformXY(Vdst&& dst, Vsrc&& src, size_t count) const
{
for (size_t i = 0; i < count; i++)
{
float x = (this->matrix[0] * src[i].x) + (this->matrix[4] * src[i].y) + (0) +
(this->matrix[12]);

float y = (this->matrix[1] * src[i].x) + (this->matrix[5] * src[i].y) + (0) +
(this->matrix[13]);

dst[i].x = x;
dst[i].y = y;
}
}

template<typename Vdst, typename Vsrc>
void TransformXY0(Vdst* dst, const Vsrc* src, int size) const
{
for (int i = 0; i < size; i++)
{
// Store in temp variables in case src = dst
float x = (this->matrix[0] * src[i].x) + (this->matrix[4] * src[i].y) + (0) +
(this->matrix[12]);
float y = (this->matrix[1] * src[i].x) + (this->matrix[5] * src[i].y) + (0) +
(this->matrix[13]);
float z = (this->matrix[2] * src[i].x) + (this->matrix[6] * src[i].y) + (0) +
(this->matrix[14]);

dst[i].x = x;
dst[i].y = y;
dst[i].z = z;
}
}

template<Vector3TransformRange Vdst, Vector3TransformRange Vsrc>
/* transform Vector3 src into Vector3 dst */
void TransformXYZ(Vdst&& dst, Vsrc&& src) const
Expand Down
15 changes: 15 additions & 0 deletions include/common/resource.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include <stddef.h>

namespace love
{
class Resource
{
public:
virtual ~Resource()
{}

virtual ptrdiff_t GetHandle() const = 0;
};
} // namespace love
25 changes: 25 additions & 0 deletions include/common/volatile.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once

#include <list>

namespace love
{
class Volatile
{
private:
static std::list<Volatile*> all;

public:
Volatile();

virtual ~Volatile();

virtual bool LoadVolatile() = 0;

virtual void UnloadVolatile() = 0;

static bool LoadAll();

static void UnloadAll();
};
} // namespace love
Loading

0 comments on commit 336da6a

Please sign in to comment.