diff options
Diffstat (limited to 'Runtime')
-rw-r--r-- | Runtime/FileSystem/FileWatcher.cpp | 3 | ||||
-rw-r--r-- | Runtime/FileSystem/FileWatcher.h | 16 | ||||
-rw-r--r-- | Runtime/Graphics/GfxDevice.cpp | 2 | ||||
-rw-r--r-- | Runtime/Scripting/Rendering/Shader.bind.cpp | 48 | ||||
-rw-r--r-- | Runtime/Utilities/Callback.h | 0 | ||||
-rw-r--r-- | Runtime/Utilities/IncrementalTask.h | 13 |
6 files changed, 58 insertions, 24 deletions
diff --git a/Runtime/FileSystem/FileWatcher.cpp b/Runtime/FileSystem/FileWatcher.cpp new file mode 100644 index 0000000..7095253 --- /dev/null +++ b/Runtime/FileSystem/FileWatcher.cpp @@ -0,0 +1,3 @@ +#include "FileWatcher.h"
+
+
diff --git a/Runtime/FileSystem/FileWatcher.h b/Runtime/FileSystem/FileWatcher.h new file mode 100644 index 0000000..4626c0a --- /dev/null +++ b/Runtime/FileSystem/FileWatcher.h @@ -0,0 +1,16 @@ +#pragma once
+
+#include <string>
+#include "Runtime/Threading/Thread.h"
+
+// 检查某个指定文件夹中的文件或子文件夹是否被变动过。
+class FileWatcher : public Thread
+{
+public:
+
+
+private:
+ std::string m_WorkingDirectory;
+
+
+};
\ No newline at end of file diff --git a/Runtime/Graphics/GfxDevice.cpp b/Runtime/Graphics/GfxDevice.cpp index bd8dd9d..d466eb9 100644 --- a/Runtime/Graphics/GfxDevice.cpp +++ b/Runtime/Graphics/GfxDevice.cpp @@ -132,10 +132,12 @@ void GfxDevice::SetUniformTexture(const char* name, Texture* texture) log_error("No available texture unit. Too many textures or forget invoke ResetUniformsState()"); return; } + int texUnit = s_AvailableTextureUnit.back(); s_AvailableTextureUnit.pop_back(); glActiveTexture(GL_TEXTURE0 + texUnit);
glBindTexture(GL_TEXTURE_2D, texture->GetGpuID());
+
GLint loc = glGetUniformLocation(m_Shader.GetID(), name); glUniform1i(loc, texUnit); } diff --git a/Runtime/Scripting/Rendering/Shader.bind.cpp b/Runtime/Scripting/Rendering/Shader.bind.cpp index 83f8477..0137447 100644 --- a/Runtime/Scripting/Rendering/Shader.bind.cpp +++ b/Runtime/Scripting/Rendering/Shader.bind.cpp @@ -107,70 +107,70 @@ LUA_BIND_IMPL_METHOD(Shader, _UnUse) return 1; } -// shader:SetVector2(name, vec2) -// shader:SetVector2(name, {}) +// shader.SetVector2(name, vec2) +// shader.SetVector2(name, {}) LUA_BIND_IMPL_METHOD(Shader, _SetVector2) { LUA_BIND_PREPARE(L, Shader); - LUA_BIND_CHECK(L, "UST"); + LUA_BIND_CHECK(L, "ST"); - cc8* name = state.GetValue(2, ""); - Internal::Vector2 v2 = state.GetValue<Internal::Vector2>(3, Internal::Vector2::zero); + cc8* name = state.GetValue(1, ""); + Internal::Vector2 v2 = state.GetValue<Internal::Vector2>(2, Internal::Vector2::zero); g_GfxDevice.SetUniformVec2(name, v2); return 1; } -// shader:SetVector3(name, vec3) -// shader:SetVector3(name, {}) +// shader.SetVector3(name, vec3) +// shader.SetVector3(name, {}) LUA_BIND_IMPL_METHOD(Shader, _SetVector3) { LUA_BIND_PREPARE(L, Shader); - LUA_BIND_CHECK(L, "UST"); + LUA_BIND_CHECK(L, "ST"); - cc8* name = state.GetValue(2, ""); - Internal::Vector3 v3 = state.GetValue<Internal::Vector3>(3, Internal::Vector3::zero); + cc8* name = state.GetValue(1, ""); + Internal::Vector3 v3 = state.GetValue<Internal::Vector3>(2, Internal::Vector3::zero); g_GfxDevice.SetUniformVec3(name, v3); return 1; } -// shader:SetVector4(name, vec4) -// shader:SetVector4(name, {}) +// shader.SetVector4(name, vec4) +// shader.SetVector4(name, {}) LUA_BIND_IMPL_METHOD(Shader, _SetVector4) { LUA_BIND_PREPARE(L, Shader); - LUA_BIND_CHECK(L, "UST"); + LUA_BIND_CHECK(L, "ST"); - cc8* name = state.GetValue(2, ""); - Internal::Vector4 v4 = state.GetValue<Internal::Vector4>(3, Internal::Vector4::zero); + cc8* name = state.GetValue(1, ""); + Internal::Vector4 v4 = state.GetValue<Internal::Vector4>(2, Internal::Vector4::zero); g_GfxDevice.SetUniformVec4(name, v4); return 1; } -// shader:SetMatrix4(name, mat4) -// shader:SetMatrix4(name, {}) +// shader.SetMatrix4(name, mat4) +// shader.SetMatrix4(name, {}) LUA_BIND_IMPL_METHOD(Shader, _SetMatrix4) { LUA_BIND_PREPARE(L, Shader); - LUA_BIND_CHECK(L, "UST"); + LUA_BIND_CHECK(L, "ST"); - cc8* name = state.GetValue(2, ""); - Internal::Matrix44 m4 = state.GetValue<Internal::Matrix44>(3, Internal::Matrix44::identity); + cc8* name = state.GetValue(1, ""); + Internal::Matrix44 m4 = state.GetValue<Internal::Matrix44>(2, Internal::Matrix44::identity); g_GfxDevice.SetUniformMat4(name, m4); return 1; } -// shader:SetTexture(name,texture) +// shader.SetTexture(name,texture) LUA_BIND_IMPL_METHOD(Shader, _SetTexture) { LUA_BIND_PREPARE(L, Shader); - LUA_BIND_CHECK(L, "USU"); + LUA_BIND_CHECK(L, "SU"); - cc8* name = state.GetValue(2, ""); - Texture* tex = state.GetUserdata<Texture>(); + cc8* name = state.GetValue(1, ""); + Texture* tex = state.GetUserdata<Texture>(2); g_GfxDevice.SetUniformTexture(name, tex); diff --git a/Runtime/Utilities/Callback.h b/Runtime/Utilities/Callback.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Runtime/Utilities/Callback.h diff --git a/Runtime/Utilities/IncrementalTask.h b/Runtime/Utilities/IncrementalTask.h new file mode 100644 index 0000000..29163d9 --- /dev/null +++ b/Runtime/Utilities/IncrementalTask.h @@ -0,0 +1,13 @@ +#pragma once
+
+// 增量式多任务处理
+class IncrementalTask
+{
+public:
+ IncrementalTask() {};
+ virtual ~IncrementalTask() {};
+
+ virtual void OnStep() = 0;
+ virtual bool IsDone() = 0;
+
+};
|