Added License Brief to Source Files
This commit is contained in:
parent
ac317f1213
commit
80b428ad14
@ -33,8 +33,6 @@ endif()
|
|||||||
include_directories(Include)
|
include_directories(Include)
|
||||||
include_directories(External)
|
include_directories(External)
|
||||||
|
|
||||||
add_subdirectory(External/imnodes-master)
|
|
||||||
|
|
||||||
add_executable(OpenShaderDesigner
|
add_executable(OpenShaderDesigner
|
||||||
Source/Entry.cpp
|
Source/Entry.cpp
|
||||||
|
|
||||||
@ -67,8 +65,7 @@ add_executable(OpenShaderDesigner
|
|||||||
External/imgui-docking/backends/imgui_impl_opengl3.cpp
|
External/imgui-docking/backends/imgui_impl_opengl3.cpp
|
||||||
External/imgui-docking/misc/cpp/imgui_stdlib.cpp
|
External/imgui-docking/misc/cpp/imgui_stdlib.cpp
|
||||||
External/imgui-docking/misc/freetype/imgui_freetype.cpp
|
External/imgui-docking/misc/freetype/imgui_freetype.cpp
|
||||||
Include/Utility/DirectedGraph.h
|
Include/OpenGL/BufferObject.h
|
||||||
Include/Utility/Optional.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -77,5 +74,4 @@ target_link_libraries(OpenShaderDesigner PRIVATE
|
|||||||
GLEW::GLEW
|
GLEW::GLEW
|
||||||
OpenGL::GL
|
OpenGL::GL
|
||||||
${SDL2_LIBRARIES}
|
${SDL2_LIBRARIES}
|
||||||
imnodes
|
|
||||||
)
|
)
|
@ -1,6 +1,18 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/18/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
|
||||||
#ifndef CONSOLE_H
|
#ifndef CONSOLE_H
|
||||||
#define CONSOLE_H
|
#define CONSOLE_H
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/20/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
|
||||||
#ifndef ENGINE_H
|
#ifndef ENGINE_H
|
||||||
#define ENGINE_H
|
#define ENGINE_H
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 7/1/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
|
||||||
#ifndef RENDERER_H
|
#ifndef RENDERER_H
|
||||||
#define RENDERER_H
|
#define RENDERER_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/18/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef WINDOW_H
|
#ifndef WINDOW_H
|
||||||
#define WINDOW_H
|
#define WINDOW_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/21/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef CONSOLEWINDOW_H
|
#ifndef CONSOLEWINDOW_H
|
||||||
#define CONSOLEWINDOW_H
|
#define CONSOLEWINDOW_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/20/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef EDITORSYSTEM_H
|
#ifndef EDITORSYSTEM_H
|
||||||
#define EDITORSYSTEM_H
|
#define EDITORSYSTEM_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/20/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef EDITORWINDOW_H
|
#ifndef EDITORWINDOW_H
|
||||||
#define EDITORWINDOW_H
|
#define EDITORWINDOW_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 7/1/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef PROFILER_H
|
#ifndef PROFILER_H
|
||||||
#define PROFILER_H
|
#define PROFILER_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 7/11/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef MATH_H
|
#ifndef MATH_H
|
||||||
#define MATH_H
|
#define MATH_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 7/1/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef SHADERGRAPH_H
|
#ifndef SHADERGRAPH_H
|
||||||
#define SHADERGRAPH_H
|
#define SHADERGRAPH_H
|
||||||
@ -183,8 +194,9 @@ namespace OpenShaderDesigner
|
|||||||
|
|
||||||
static void Register(const std::filesystem::path& path, ConstructorPtr constructor);
|
static void Register(const std::filesystem::path& path, ConstructorPtr constructor);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_set<NodeId> Selected;
|
|
||||||
std::vector<Node*> Nodes;
|
std::vector<Node*> Nodes;
|
||||||
std::unordered_set<PinId> Erased;
|
std::unordered_set<PinId> Erased;
|
||||||
ConnectionMap Connections;
|
ConnectionMap Connections;
|
||||||
@ -250,6 +262,7 @@ namespace OpenShaderDesigner
|
|||||||
std::unordered_set<NodeId> DragSelect;
|
std::unordered_set<NodeId> DragSelect;
|
||||||
bool LocksDragged, NodeHovered;
|
bool LocksDragged, NodeHovered;
|
||||||
Optional<PinPtr> NewConnection;
|
Optional<PinPtr> NewConnection;
|
||||||
|
std::unordered_set<NodeId> Selected;
|
||||||
} Mouse;
|
} Mouse;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
164
Include/OpenGL/BufferObject.h
Normal file
164
Include/OpenGL/BufferObject.h
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
#ifndef BUFFEROBJECT_H
|
||||||
|
#define BUFFEROBJECT_H
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
#define NULL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "Enum.h"
|
||||||
|
#include "Type.h"
|
||||||
|
|
||||||
|
namespace GLW
|
||||||
|
{
|
||||||
|
// Definition ==========================================================================================================
|
||||||
|
|
||||||
|
template<BufferType T, BufferUsage U, BufferStorage S = GPU>
|
||||||
|
class BufferObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static constexpr BufferType Type = T;
|
||||||
|
static constexpr BufferUsage Usage = U;
|
||||||
|
static constexpr BufferStorage Storage = S;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief BufferObject constructor
|
||||||
|
* \param size Size in bytes of the Buffer
|
||||||
|
* \param data Data to be used as the initial contents of the Buffer
|
||||||
|
*/
|
||||||
|
BufferObject(SizeT size, void* data = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Move Constructor
|
||||||
|
*/
|
||||||
|
BufferObject(BufferObject&& other);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Copy Constructor
|
||||||
|
*/
|
||||||
|
BufferObject(const BufferObject& other);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Destructor
|
||||||
|
*/
|
||||||
|
~BufferObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Validity test
|
||||||
|
*/
|
||||||
|
[[nodiscard]] operator bool() const { return Handle != 0; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Copy Assignment
|
||||||
|
*/
|
||||||
|
BufferObject& operator=(const BufferObject& other);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Move Assignment
|
||||||
|
*/
|
||||||
|
BufferObject& operator=(BufferObject&& other) noexcept;
|
||||||
|
|
||||||
|
[[nodiscard]] SizeT Size() const { return Size; }
|
||||||
|
void Resize(SizeT size);
|
||||||
|
|
||||||
|
private:
|
||||||
|
HandleT Handle;
|
||||||
|
SizeT Size;
|
||||||
|
void* Mapping;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Constructors ========================================================================================================
|
||||||
|
|
||||||
|
template <BufferType T, BufferUsage U, BufferStorage S>
|
||||||
|
BufferObject<T, U, S>::BufferObject(SizeT size, void* data)
|
||||||
|
: Handle(NULL)
|
||||||
|
, Size(size)
|
||||||
|
, Mapping(nullptr)
|
||||||
|
{
|
||||||
|
glGenBuffers(1, &Handle);
|
||||||
|
|
||||||
|
if(!*this) return;
|
||||||
|
|
||||||
|
glBindBuffer(Type, Handle);
|
||||||
|
glBufferStorage(Type, Size, data, Usage);
|
||||||
|
glBindBuffer(Type, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <BufferType T, BufferUsage U, BufferStorage S>
|
||||||
|
BufferObject<T, U, S>::BufferObject(BufferObject&& other)
|
||||||
|
: Handle(other.Handle)
|
||||||
|
, Size(other.Size)
|
||||||
|
, Mapping(other.Size)
|
||||||
|
{
|
||||||
|
other.Handle = NULL;
|
||||||
|
other.Size = 0;
|
||||||
|
other.Mapping = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <BufferType T, BufferUsage U, BufferStorage S>
|
||||||
|
BufferObject<T, U, S>::BufferObject(const BufferObject& other)
|
||||||
|
: BufferObject(other.Size)
|
||||||
|
{
|
||||||
|
if(Handle == NULL) return;
|
||||||
|
if(other.Handle == NULL) return;
|
||||||
|
|
||||||
|
glCopyNamedBufferSubData(other.Handle, Handle, 0, 0, Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <BufferType T, BufferUsage U, BufferStorage S>
|
||||||
|
BufferObject<T, U, S>::~BufferObject()
|
||||||
|
{
|
||||||
|
glDeleteBuffers(1, &Handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assignment Operators ================================================================================================
|
||||||
|
|
||||||
|
template <BufferType T, BufferUsage U, BufferStorage S>
|
||||||
|
BufferObject<T, U, S>& BufferObject<T, U, S>::operator=(const BufferObject& other)
|
||||||
|
{
|
||||||
|
BufferObject temp(other);
|
||||||
|
return (*this = std::move(temp)); // NOLINT(*-unconventional-assign-operator)
|
||||||
|
}
|
||||||
|
|
||||||
|
template <BufferType T, BufferUsage U, BufferStorage S>
|
||||||
|
BufferObject<T, U, S>& BufferObject<T, U, S>::operator=(BufferObject&& other) noexcept
|
||||||
|
{
|
||||||
|
glDeleteBuffers(1, &Handle);
|
||||||
|
|
||||||
|
Handle = other.Handle;
|
||||||
|
Size = other.Size;
|
||||||
|
Mapping = other.Mapping;
|
||||||
|
|
||||||
|
other.Handle = NULL;
|
||||||
|
other.Size = 0;
|
||||||
|
other.Mapping = nullptr;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <BufferType T, BufferUsage U, BufferStorage S>
|
||||||
|
void BufferObject<T, U, S>::Resize(SizeT size)
|
||||||
|
{
|
||||||
|
BufferObject temp(size);
|
||||||
|
glCopyNamedBufferSubData(Handle, temp.Handle, 0, 0, Size);
|
||||||
|
*this = std::move(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //BUFFEROBJECT_H
|
88
Include/OpenGL/Enum.h
Normal file
88
Include/OpenGL/Enum.h
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
#ifndef ENUM_H
|
||||||
|
#define ENUM_H
|
||||||
|
|
||||||
|
#include <gl/glew.h>
|
||||||
|
|
||||||
|
namespace GLW
|
||||||
|
{
|
||||||
|
enum Primitive : GLenum
|
||||||
|
{
|
||||||
|
TRIANGLES = GL_TRIANGLES
|
||||||
|
, LINES = GL_LINES
|
||||||
|
, POINTS = GL_POINTS
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BufferType : GLenum
|
||||||
|
{
|
||||||
|
AtomicCounter = GL_ATOMIC_COUNTER_BUFFER
|
||||||
|
, ElementArray = GL_ELEMENT_ARRAY_BUFFER
|
||||||
|
, IndirectCompute = GL_DISPATCH_INDIRECT_BUFFER
|
||||||
|
, IndirectDraw = GL_DRAW_INDIRECT_BUFFER
|
||||||
|
, PixelPack = GL_PIXEL_PACK_BUFFER
|
||||||
|
, PixelUnpack = GL_PIXEL_UNPACK_BUFFER
|
||||||
|
, ShaderStorage = GL_SHADER_STORAGE_BUFFER
|
||||||
|
, TransformFeedback = GL_TRANSFORM_FEEDBACK
|
||||||
|
, Uniform = GL_UNIFORM_BUFFER
|
||||||
|
, VertexArray = GL_ARRAY_BUFFER
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BufferUsage : GLenum
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* \brief Buffer cannot be read or modified by the CPU after creation
|
||||||
|
*/
|
||||||
|
STATIC = GL_NONE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Buffer can be mapped for Read, Write, or Both
|
||||||
|
*/
|
||||||
|
, READ = GL_MAP_READ_BIT
|
||||||
|
, WRITE = GL_MAP_WRITE_BIT
|
||||||
|
, READ_WRITE = READ | WRITE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Buffer can be written to using glBufferSubData
|
||||||
|
*/
|
||||||
|
, DYNAMIC = GL_DYNAMIC_STORAGE_BIT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Buffer may be used while mapped
|
||||||
|
*/
|
||||||
|
, PERSISTENT = GL_MAP_PERSISTENT_BIT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Allows buffer to remain coherent without an explicit barrier
|
||||||
|
*/
|
||||||
|
, COHERENT = GL_MAP_PERSISTENT_BIT | PERSISTENT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BufferStorage : GLenum
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* \brief Buffer memory will come from the GPU
|
||||||
|
*/
|
||||||
|
GPU = GL_NONE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Buffer memory will come from the CPU
|
||||||
|
*/
|
||||||
|
, CPU = GL_CLIENT_STORAGE_BIT
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //ENUM_H
|
30
Include/OpenGL/Type.h
Normal file
30
Include/OpenGL/Type.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
#ifndef TYPE_H
|
||||||
|
#define TYPE_H
|
||||||
|
|
||||||
|
#include <gl/glew.h>
|
||||||
|
|
||||||
|
namespace GLW
|
||||||
|
{
|
||||||
|
using OffsetT = GLintptr;
|
||||||
|
using SizeT = GLsizeiptr;
|
||||||
|
using IndexT = GLuint;
|
||||||
|
using FlagT = GLbitfield;
|
||||||
|
using HandleT = GLuint;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //TYPE_H
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 7/11/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef DIRECTEDGRAPH_H
|
#ifndef DIRECTEDGRAPH_H
|
||||||
#define DIRECTEDGRAPH_H
|
#define DIRECTEDGRAPH_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 7/12/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef OPTIONAL_H
|
#ifndef OPTIONAL_H
|
||||||
#define OPTIONAL_H
|
#define OPTIONAL_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/21/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef STARTUP_H
|
#ifndef STARTUP_H
|
||||||
#define STARTUP_H
|
#define STARTUP_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/20/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef TIMER_H
|
#ifndef TIMER_H
|
||||||
#define TIMER_H
|
#define TIMER_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/18/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef ENGINE_UNIQUEID_H
|
#ifndef ENGINE_UNIQUEID_H
|
||||||
#define ENGINE_UNIQUEID_H
|
#define ENGINE_UNIQUEID_H
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/18/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#include <Core/Console.h>
|
#include <Core/Console.h>
|
||||||
#include <imgui-docking/misc/cpp/imgui_stdlib.h>
|
#include <imgui-docking/misc/cpp/imgui_stdlib.h>
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/20/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#include <Core/Console.h>
|
#include <Core/Console.h>
|
||||||
#include <Core/Engine.h>
|
#include <Core/Engine.h>
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/18/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#include <Core/EventSystem.h>
|
#include <Core/EventSystem.h>
|
||||||
#include <Core/Console.h>
|
#include <Core/Console.h>
|
||||||
|
@ -1,5 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 7/1/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
|
||||||
#include <Core/Renderer.h>
|
#include <Core/Renderer.h>
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/18/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#include <Core/Window.h>
|
#include <Core/Window.h>
|
||||||
#include <Core/Console.h>
|
#include <Core/Console.h>
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/21/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#include <Core/Console.h>
|
#include <Core/Console.h>
|
||||||
#include <Editor/ConsoleWindow.h>
|
#include <Editor/ConsoleWindow.h>
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/20/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#include <Core/Console.h>
|
#include <Core/Console.h>
|
||||||
#include <Editor/EditorSystem.h>
|
#include <Editor/EditorSystem.h>
|
||||||
@ -10,8 +21,6 @@
|
|||||||
#include <imgui-docking/backends/imgui_impl_opengl3.h>
|
#include <imgui-docking/backends/imgui_impl_opengl3.h>
|
||||||
#include <imgui-docking/misc/freetype/imgui_freetype.h>
|
#include <imgui-docking/misc/freetype/imgui_freetype.h>
|
||||||
|
|
||||||
#include <imnodes-master/imnodes.h>
|
|
||||||
|
|
||||||
using namespace OpenShaderDesigner;
|
using namespace OpenShaderDesigner;
|
||||||
|
|
||||||
void EditorSystem::Initialize()
|
void EditorSystem::Initialize()
|
||||||
@ -21,7 +30,6 @@ void EditorSystem::Initialize()
|
|||||||
Console::Log(Console::Severity::ALERT, "Initializing Dear ImGUI");
|
Console::Log(Console::Severity::ALERT, "Initializing Dear ImGUI");
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImNodes::CreateContext();
|
|
||||||
|
|
||||||
|
|
||||||
// https://github.com/ocornut/imgui/issues/707#issuecomment-917151020
|
// https://github.com/ocornut/imgui/issues/707#issuecomment-917151020
|
||||||
@ -162,7 +170,6 @@ void EditorSystem::Shutdown()
|
|||||||
// Shutdown ImGui
|
// Shutdown ImGui
|
||||||
ImGui_ImplSDL2_Shutdown();
|
ImGui_ImplSDL2_Shutdown();
|
||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
ImNodes::DestroyContext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorSystem::HandleEvents(SDL_Event* event)
|
void EditorSystem::HandleEvents(SDL_Event* event)
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/20/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#include <Editor/EditorWindow.h>
|
#include <Editor/EditorWindow.h>
|
||||||
|
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 7/1/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#include <Editor/Profiler.h>
|
#include <Editor/Profiler.h>
|
||||||
|
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 6/18/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <Core/Engine.h>
|
#include <Core/Engine.h>
|
||||||
|
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 7/11/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
#include <Graph/Nodes/Math.h>
|
#include <Graph/Nodes/Math.h>
|
||||||
|
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// Copyright 2024 Medusa Slockbower
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// Created by Maddie on 7/1/2024.
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
@ -195,7 +207,7 @@ void ShaderGraph::DrawWindow()
|
|||||||
{
|
{
|
||||||
if(Drag.x == 0 && Drag.y == 0 && !Mouse.NodeHovered && !(Ctrl || Shift))
|
if(Drag.x == 0 && Drag.y == 0 && !Mouse.NodeHovered && !(Ctrl || Shift))
|
||||||
{
|
{
|
||||||
Selected.clear();
|
Mouse.Selected.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Mouse.Locks.clear();
|
Mouse.Locks.clear();
|
||||||
@ -373,7 +385,7 @@ void ShaderGraph::DrawNode(Node& node, NodeId id)
|
|||||||
Mouse.FocusedNode = id;
|
Mouse.FocusedNode = id;
|
||||||
Mouse.LocksDragged = false;
|
Mouse.LocksDragged = false;
|
||||||
|
|
||||||
for(NodeId selected : Selected)
|
for(NodeId selected : Mouse.Selected)
|
||||||
{
|
{
|
||||||
Mouse.Locks.emplace(selected, Mouse.Location - Nodes[selected]->Position);
|
Mouse.Locks.emplace(selected, Mouse.Location - Nodes[selected]->Position);
|
||||||
}
|
}
|
||||||
@ -385,22 +397,22 @@ void ShaderGraph::DrawNode(Node& node, NodeId id)
|
|||||||
if(ImGui::IsMouseDragging(ImGuiMouseButton_Left) && !Mouse.NewConnection() && Focused)
|
if(ImGui::IsMouseDragging(ImGuiMouseButton_Left) && !Mouse.NewConnection() && Focused)
|
||||||
{
|
{
|
||||||
// Reset When Dragging a New Node
|
// Reset When Dragging a New Node
|
||||||
if(Mouse.FocusedNode() && Mouse.FocusedNode == id && !Selected.contains(id))
|
if(Mouse.FocusedNode() && Mouse.FocusedNode == id && !Mouse.Selected.contains(id))
|
||||||
{
|
{
|
||||||
if(!(Ctrl || Shift))
|
if(!(Ctrl || Shift))
|
||||||
{
|
{
|
||||||
Selected.clear();
|
Mouse.Selected.clear();
|
||||||
Mouse.Locks.clear();
|
Mouse.Locks.clear();
|
||||||
}
|
}
|
||||||
Selected.insert(id);
|
Mouse.Selected.insert(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Begin selection
|
// Begin selection
|
||||||
if(Mouse.FocusedNode() && Selected.contains(id) && !(Ctrl || Shift))
|
if(Mouse.FocusedNode() && Mouse.Selected.contains(id) && !(Ctrl || Shift))
|
||||||
{
|
{
|
||||||
Mouse.LocksDragged = true;
|
Mouse.LocksDragged = true;
|
||||||
|
|
||||||
for(NodeId selected : Selected)
|
for(NodeId selected : Mouse.Selected)
|
||||||
{
|
{
|
||||||
Mouse.Locks.emplace(selected, Mouse.Location - Nodes[selected]->Position);
|
Mouse.Locks.emplace(selected, Mouse.Location - Nodes[selected]->Position);
|
||||||
}
|
}
|
||||||
@ -420,7 +432,7 @@ void ShaderGraph::DrawNode(Node& node, NodeId id)
|
|||||||
// Clear selection for new selection
|
// Clear selection for new selection
|
||||||
if(Mouse.DragSelect.empty() && !Shift && !Ctrl && !Mouse.FocusedNode())
|
if(Mouse.DragSelect.empty() && !Shift && !Ctrl && !Mouse.FocusedNode())
|
||||||
{
|
{
|
||||||
Selected.clear();
|
Mouse.Selected.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select nodes
|
// Select nodes
|
||||||
@ -428,16 +440,16 @@ void ShaderGraph::DrawNode(Node& node, NodeId id)
|
|||||||
{
|
{
|
||||||
if(!Ctrl)
|
if(!Ctrl)
|
||||||
{
|
{
|
||||||
if(!Selected.contains(id))
|
if(!Mouse.Selected.contains(id))
|
||||||
{
|
{
|
||||||
Selected.insert(id);
|
Mouse.Selected.insert(id);
|
||||||
Mouse.DragSelect.insert(id);
|
Mouse.DragSelect.insert(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(Selected.contains(id)) Selected.erase(id);
|
if(Mouse.Selected.contains(id)) Mouse.Selected.erase(id);
|
||||||
else Selected.insert(id);
|
else Mouse.Selected.insert(id);
|
||||||
|
|
||||||
Mouse.DragSelect.insert(id);
|
Mouse.DragSelect.insert(id);
|
||||||
}
|
}
|
||||||
@ -450,12 +462,12 @@ void ShaderGraph::DrawNode(Node& node, NodeId id)
|
|||||||
|
|
||||||
if(!Ctrl)
|
if(!Ctrl)
|
||||||
{
|
{
|
||||||
Selected.erase(id);
|
Mouse.Selected.erase(id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(Selected.contains(id)) Selected.erase(id);
|
if(Mouse.Selected.contains(id)) Mouse.Selected.erase(id);
|
||||||
else Selected.insert(id);
|
else Mouse.Selected.insert(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -463,20 +475,20 @@ void ShaderGraph::DrawNode(Node& node, NodeId id)
|
|||||||
|
|
||||||
if(ImGui::IsMouseReleased(ImGuiMouseButton_Left) && HeaderHovered)
|
if(ImGui::IsMouseReleased(ImGuiMouseButton_Left) && HeaderHovered)
|
||||||
{
|
{
|
||||||
if(Selected.contains(id))
|
if(Mouse.Selected.contains(id))
|
||||||
{
|
{
|
||||||
if(Ctrl) Selected.erase(id);
|
if(Ctrl) Mouse.Selected.erase(id);
|
||||||
else if(!Shift && !Mouse.LocksDragged)
|
else if(!Shift && !Mouse.LocksDragged)
|
||||||
{
|
{
|
||||||
Selected.clear();
|
Mouse.Selected.clear();
|
||||||
Selected.insert(id);
|
Mouse.Selected.insert(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!(Ctrl || Shift))
|
if(!(Ctrl || Shift))
|
||||||
Selected.clear();
|
Mouse.Selected.clear();
|
||||||
Selected.insert(id);
|
Mouse.Selected.insert(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +516,7 @@ void ShaderGraph::DrawNode(Node& node, NodeId id)
|
|||||||
|
|
||||||
// Border ==========================================================================================================
|
// Border ==========================================================================================================
|
||||||
|
|
||||||
if(Selected.contains(id)) DrawList.AddRect(NodeRoot, NodeEdge, Style.Nodes.SelectedBorder.Color, Rounding, 0, Style.Nodes.SelectedBorder.Thickness / Camera.Zoom);
|
if(Mouse.Selected.contains(id)) DrawList.AddRect(NodeRoot, NodeEdge, Style.Nodes.SelectedBorder.Color, Rounding, 0, Style.Nodes.SelectedBorder.Thickness / Camera.Zoom);
|
||||||
else DrawList.AddRect(NodeRoot, NodeEdge, Style.Nodes.Border.Color, Rounding, 0, BorderThickness);
|
else DrawList.AddRect(NodeRoot, NodeEdge, Style.Nodes.Border.Color, Rounding, 0, BorderThickness);
|
||||||
|
|
||||||
// Pins ============================================================================================================
|
// Pins ============================================================================================================
|
||||||
@ -587,8 +599,8 @@ void ShaderGraph::DrawContextMenu()
|
|||||||
|
|
||||||
if(ImGui::BeginPopupContextWindow())
|
if(ImGui::BeginPopupContextWindow())
|
||||||
{
|
{
|
||||||
if(ImGui::MenuItem("Copy", "Ctrl+C", false, !Selected.empty())) Copy();
|
if(ImGui::MenuItem("Copy", "Ctrl+C", false, !Mouse.Selected.empty())) Copy();
|
||||||
if(ImGui::MenuItem("Cut", "Ctrl+X", false, !Selected.empty()))
|
if(ImGui::MenuItem("Cut", "Ctrl+X", false, !Mouse.Selected.empty()))
|
||||||
{
|
{
|
||||||
Copy();
|
Copy();
|
||||||
EraseSelection();
|
EraseSelection();
|
||||||
@ -849,7 +861,7 @@ NodeId ShaderGraph::AddNode(Node* node)
|
|||||||
if(Erased.empty())
|
if(Erased.empty())
|
||||||
{
|
{
|
||||||
Nodes.push_back(node);
|
Nodes.push_back(node);
|
||||||
return Nodes.size() - 1;
|
return static_cast<NodeId>(Nodes.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeId id = *Erased.begin();
|
NodeId id = *Erased.begin();
|
||||||
@ -883,21 +895,21 @@ void ShaderGraph::ClearClipboard()
|
|||||||
|
|
||||||
void ShaderGraph::Copy()
|
void ShaderGraph::Copy()
|
||||||
{
|
{
|
||||||
if(Selected.empty()) return;
|
if(Mouse.Selected.empty()) return;
|
||||||
|
|
||||||
// Helper for connections
|
// Helper for connections
|
||||||
std::unordered_map<NodeId, NodeId> clipboardTransform;
|
std::unordered_map<NodeId, NodeId> clipboardTransform;
|
||||||
ImVec2 min = Nodes[*Selected.begin()]->Position;
|
ImVec2 min = Nodes[*Mouse.Selected.begin()]->Position;
|
||||||
|
|
||||||
// Reset Clipboard
|
// Reset Clipboard
|
||||||
ClearClipboard();
|
ClearClipboard();
|
||||||
Clipboard.Nodes.reserve(Selected.size());
|
Clipboard.Nodes.reserve(Mouse.Selected.size());
|
||||||
|
|
||||||
// Copy nodes
|
// Copy nodes
|
||||||
for(auto id : Selected)
|
for(auto id : Mouse.Selected)
|
||||||
{
|
{
|
||||||
Node* node = Nodes[id];
|
Node* node = Nodes[id];
|
||||||
clipboardTransform[id] = Clipboard.Nodes.size();
|
clipboardTransform[id] = static_cast<NodeId>(Clipboard.Nodes.size());
|
||||||
Clipboard.Nodes.push_back(node->Copy(*this));
|
Clipboard.Nodes.push_back(node->Copy(*this));
|
||||||
min = ImMin(node->Position, min);
|
min = ImMin(node->Position, min);
|
||||||
}
|
}
|
||||||
@ -911,7 +923,7 @@ void ShaderGraph::Copy()
|
|||||||
// Copy connections
|
// Copy connections
|
||||||
for(const Connection& connection : Connections)
|
for(const Connection& connection : Connections)
|
||||||
{
|
{
|
||||||
if(!(Selected.contains(connection.first.Node) && Selected.contains(connection.second.Node))) continue;
|
if(!(Mouse.Selected.contains(connection.first.Node) && Mouse.Selected.contains(connection.second.Node))) continue;
|
||||||
|
|
||||||
Connection copy = {
|
Connection copy = {
|
||||||
{ clipboardTransform[connection.first.Node], connection.first.Pin, connection.first.Input }
|
{ clipboardTransform[connection.first.Node], connection.first.Pin, connection.first.Input }
|
||||||
@ -928,7 +940,7 @@ void ShaderGraph::Paste(const ImVec2& location)
|
|||||||
const float GridSize = (Style.FontSize + Style.Grid.Lines.Padding);
|
const float GridSize = (Style.FontSize + Style.Grid.Lines.Padding);
|
||||||
std::unordered_map<NodeId, NodeId> clipboardTransform;
|
std::unordered_map<NodeId, NodeId> clipboardTransform;
|
||||||
ImVec2 root = ImFloor(location / GridSize + ImVec2(0.5f, 0.5f)) * GridSize;
|
ImVec2 root = ImFloor(location / GridSize + ImVec2(0.5f, 0.5f)) * GridSize;
|
||||||
Selected.clear();
|
Mouse.Selected.clear();
|
||||||
|
|
||||||
// Paste the nodes
|
// Paste the nodes
|
||||||
NodeId id = 0;
|
NodeId id = 0;
|
||||||
@ -936,7 +948,7 @@ void ShaderGraph::Paste(const ImVec2& location)
|
|||||||
{
|
{
|
||||||
NodeId index = clipboardTransform[id++] = AddNode(node->Copy(*this));
|
NodeId index = clipboardTransform[id++] = AddNode(node->Copy(*this));
|
||||||
Nodes[index]->Position += root;
|
Nodes[index]->Position += root;
|
||||||
Selected.insert(index);
|
Mouse.Selected.insert(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paste the connections
|
// Paste the connections
|
||||||
@ -951,11 +963,11 @@ void ShaderGraph::Paste(const ImVec2& location)
|
|||||||
|
|
||||||
void ShaderGraph::EraseSelection()
|
void ShaderGraph::EraseSelection()
|
||||||
{
|
{
|
||||||
for(auto node : Selected)
|
for(auto node : Mouse.Selected)
|
||||||
{
|
{
|
||||||
RemoveNode(node);
|
RemoveNode(node);
|
||||||
}
|
}
|
||||||
Selected.clear();
|
Mouse.Selected.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
float ShaderGraph::BezierOffset(const ImVec2& out, const ImVec2& in)
|
float ShaderGraph::BezierOffset(const ImVec2& out, const ImVec2& in)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user