New folder structure
This commit is contained in:
parent
5767428fd3
commit
a812c60587
@ -1,54 +1,57 @@
|
||||
CXX = /usr/bin/g++
|
||||
CXXFLAGS = -std=c++20 -MMD -MP -Wextra #-O3: optimierungsstufe 3, -MMD .d files, -MP leeres Target, Wextra alle Warnungen
|
||||
# CXXFLAGS += -ftemplate-backtrace-limit=4 #-fno-pretty-templates
|
||||
# most stuff glfw deps
|
||||
CXXFLAGS = -std=c++20 -MMD -MP -Wextra #-include pch.hpp #-O3: optimierungsstufe 3, -MMD .d files, -MP leeres Target, Wextra alle Warnungen
|
||||
LDFLAGS = -lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi -lgzutil -lfreetype
|
||||
IFLAGS = -I/usr/include/freetype2
|
||||
|
||||
OBJECT_DIR = build
|
||||
EXEC = vulkan_test
|
||||
SRCDIRS = $(wildcard */)
|
||||
IFLAGS = $(foreach dir,$(SRCDIRS), -I$(dir))
|
||||
IFLAGS += $(foreach dir,$(SRCDIRS), -I../$(dir))
|
||||
IFLAGS += -I../ -I./
|
||||
IFLAGS += -I/usr/include/freetype2
|
||||
CXXFLAGS += $(IFLAGS)
|
||||
|
||||
SRC = $(wildcard *.cpp)
|
||||
|
||||
OBJECT_DIR = ../build
|
||||
EXEC = ../vulkan_test
|
||||
|
||||
SRC = $(wildcard *.cpp) $(wildcard */*.cpp)
|
||||
# OBJECTS = $(SRC:%.cpp=$(OBJECT_DIR)/%.o)
|
||||
OBJECTS = $($(notdir SRC):%.cpp=$(OBJECT_DIR)/%.o)
|
||||
OBJECT_DIRS = $(foreach dir,$(SRCDIRS), $(OBJECT_DIR)/$(dir))
|
||||
DEPENDS = ${OBJECTS:.o=.d}
|
||||
|
||||
CXXFLAGS += $(IFLAGS)
|
||||
|
||||
|
||||
default: $(EXEC)
|
||||
echo $(OBJECTS)
|
||||
|
||||
# TODO: REMOVE -g!
|
||||
.PHONY: release
|
||||
release: CXXFLAGS += -O3
|
||||
release : default
|
||||
|
||||
# rule for the executable
|
||||
$(EXEC): $(OBJECTS)
|
||||
$(EXEC): $(OBJECT_DIRS) $(OBJECTS)
|
||||
$(CXX) $(OBJECTS) -o $@ $(CXXFLAGS) $(LDFLAGS)
|
||||
# include the makefiles generated by the -M flag
|
||||
-include $(DEPENDS)
|
||||
|
||||
# rule for all ../build/*.o files
|
||||
$(OBJECT_DIR)/%.o: %.cpp $(OBJECT_DIR)/.dirstamp
|
||||
$(OBJECT_DIR)/%.o: $(shell echo $<) %.cpp
|
||||
$(CXX) -c $< -o $@ $(CXXFLAGS) $(LDFLAGS)
|
||||
|
||||
# if build dir does not exist, create and put stamp inside
|
||||
$(OBJECT_DIR)/.dirstamp:
|
||||
mkdir -p $(OBJECT_DIR)
|
||||
touch $@
|
||||
$(OBJECT_DIRS):
|
||||
mkdir -p $@
|
||||
|
||||
#
|
||||
# Extras Options
|
||||
#
|
||||
# with debug flags
|
||||
.PHONY += debug run gdb pch clean docs
|
||||
debug: CXXFLAGS += -g # -DDEBUG
|
||||
debug: default
|
||||
|
||||
# make with debug flags and run afterwards
|
||||
run: CXXFLAGS += -g
|
||||
run: default
|
||||
$(CXX) $(OBJECTS) -o $(EXEC) $(CXXFLAGS) $(LDFLAGS)
|
||||
./$(EXEC)
|
||||
-pwd; cd $(shell dirname $(EXEC)); pwd; ./$(shell basename $(EXEC))
|
||||
|
||||
# with debug flags and run gnu debugger
|
||||
gdb: CXXFLAGS += -g
|
||||
@ -61,6 +64,6 @@ pch:
|
||||
|
||||
# remove all object and dependecy files
|
||||
clean:
|
||||
# -rm -f $(OBJECT_DIR)/*.o
|
||||
# -rm -f $(OBJECT_DIR)/*.d
|
||||
-rm -r $(OBJECT_DIR)
|
||||
docs:
|
||||
doxygen .doxygen_config
|
@ -30,9 +30,9 @@ namespace gz::vk {
|
||||
*/
|
||||
template<GLM_vec2_or_3 PosVec>
|
||||
struct Vertex {
|
||||
PosVec pos;
|
||||
glm::vec3 color;
|
||||
glm::vec2 texCoord;
|
||||
PosVec pos = PosVec(0);
|
||||
glm::vec3 color = { 0, 0, 0 };
|
||||
glm::vec2 texCoord = { 0, 0 };
|
||||
std::string toString() const;
|
||||
bool operator==(const Vertex& other) const;
|
||||
static VkVertexInputBindingDescription getBindingDescription();
|
@ -1881,7 +1881,7 @@ void VulkanInstance::loadModel() {
|
||||
std::unordered_map<Vertex3D, uint32_t> uniqueVertices;
|
||||
for (const auto& shape : shapes) {
|
||||
for (const auto& index : shape.mesh.indices) {
|
||||
Vertex3D vertex{};
|
||||
Vertex3D vertex;
|
||||
vertex.pos = {
|
||||
attrib.vertices[3 * index.vertex_index + 0],
|
||||
attrib.vertices[3 * index.vertex_index + 1],
|
||||
@ -1894,7 +1894,7 @@ void VulkanInstance::loadModel() {
|
||||
};
|
||||
vertex.color = { 1.0f, 1.0f, 1.0f };
|
||||
if (!uniqueVertices.contains(vertex)) {
|
||||
uniqueVertices[vertex] = model.vertices.size();
|
||||
uniqueVertices.insert({ vertex, model.vertices.size() });
|
||||
model.vertices.push_back(vertex);
|
||||
}
|
||||
/* model.vertices.push_back(vertex); */
|
@ -463,12 +463,16 @@ namespace gz::vk {
|
||||
//
|
||||
// UTILITY
|
||||
//
|
||||
/**
|
||||
* @name Debugging
|
||||
*/
|
||||
/// @{
|
||||
/**
|
||||
* @name Handle ownership
|
||||
* @brief Retrieve the owner of a vulkan handle
|
||||
* @see ObjectUsingVulkan
|
||||
* @{
|
||||
*/
|
||||
/// @{
|
||||
static std::vector<ObjectUsingVulkan> objectsUsingVulkan;
|
||||
static void registerObjectUsingVulkan(const ObjectUsingVulkan& obj);
|
||||
static void getHandleOwnerString(std::string_view message);
|
||||
@ -490,6 +494,7 @@ namespace gz::vk {
|
||||
VkDebugUtilsMessageTypeFlagsEXT messageType,
|
||||
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
|
||||
void* pUserData);
|
||||
/// @}
|
||||
|
||||
|
||||
template<typename T, typename... Args>
|
Loading…
Reference in New Issue
Block a user