Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

CAD DTM Rendering #186

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f098335
DTM setup
Przemog1 Feb 26, 2025
8058cff
Simple triangle draw
Przemog1 Feb 27, 2025
03faeed
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla-…
Przemog1 Mar 7, 2025
2b07a42
Barycentrics
Przemog1 Mar 8, 2025
0232ee8
Drawing triangle sdf
Przemog1 Mar 13, 2025
83d8de4
Added dtmSettingsBuff
Przemog1 Mar 14, 2025
d4647d5
Added `finalizeDTMSettingsCopiesToGPU` function
Przemog1 Mar 14, 2025
16951a3
Stippled outline
Przemog1 Mar 19, 2025
a215f45
Contour drawing setup
Przemog1 Mar 20, 2025
8900f9c
Implemented height shading
Przemog1 Mar 26, 2025
5a87097
Fixes
Przemog1 Mar 26, 2025
3237e4b
Implemented transparent height shading
Przemog1 Mar 26, 2025
78c716c
Fixes
Przemog1 Mar 27, 2025
10791e9
Implemented anty aliasing between height shading sections
Przemog1 Mar 29, 2025
1d9e6d0
switch from dtm to good'ol linework
Erfan-Ahmadi Mar 30, 2025
ad43e20
[WIP] putting all data into a single buffer and addressing with BDA
Erfan-Ahmadi Mar 31, 2025
cf63282
[WIP] save work
Erfan-Ahmadi Mar 31, 2025
d776d24
[WIP] add getMinimumRequiredResourcesBufferSize function, still not c…
Erfan-Ahmadi Mar 31, 2025
4dc28d5
[WIP] more drawResource auto-submission logic fixes
Erfan-Ahmadi Apr 1, 2025
2abd6b9
compiles but probably has runtime errors
Erfan-Ahmadi Apr 1, 2025
ab8f303
[62.CAD] compile error fix
Erfan-Ahmadi Apr 1, 2025
8f2ae9c
small shader fixes
Erfan-Ahmadi Apr 1, 2025
97b1693
more fixes
Erfan-Ahmadi Apr 1, 2025
7636062
fixes to cad example
Erfan-Ahmadi Apr 2, 2025
eec41cb
fixed hatches and polyline connector's auto submission logic
Erfan-Ahmadi Apr 2, 2025
692df5f
fix glyph and image auto-submission logic
Erfan-Ahmadi Apr 2, 2025
cf05dca
Fix ClipProjectionIndices reset
Erfan-Ahmadi Apr 2, 2025
3304cde
auto-submission more mature, corrects resource references on the go b…
Erfan-Ahmadi Apr 2, 2025
e7b63ee
small fix
Erfan-Ahmadi Apr 2, 2025
468dab1
another small fix
Erfan-Ahmadi Apr 2, 2025
bb793be
[temp] lower mem to test auto-submit
Erfan-Ahmadi Apr 2, 2025
bcb5fa3
fixed linestyle index fetching
Erfan-Ahmadi Apr 2, 2025
da76699
fixed acquireMainObjectIndex
Erfan-Ahmadi Apr 2, 2025
ed920b0
Fix DTM Rendering
Erfan-Ahmadi Apr 2, 2025
9d23afd
Fixed auto-submission bug with self-blending in a beautiful and simpl…
Erfan-Ahmadi Apr 3, 2025
126afa8
updates to comments regarding auto-submit
Erfan-Ahmadi Apr 3, 2025
6830c08
update TODO, need to handle it, after figuring out compute stages and…
Erfan-Ahmadi Apr 3, 2025
416d7b3
Saving work
Przemog1 Apr 4, 2025
b4f941a
Merge pull request #189 from Devsh-Graphics-Programming/gpu_driven_cad
Przemog1 Apr 4, 2025
06f72c5
Fixed anti aliasing
Przemog1 Apr 8, 2025
e4e7f1e
multiple draw calls to allow dtms and linework simultaneously.
Erfan-Ahmadi Apr 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 62_CAD/CTriangleMesh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "CTriangleMesh.h"
105 changes: 105 additions & 0 deletions 62_CAD/CTriangleMesh.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#pragma once

#include <nabla.h>
#include <nbl/builtin/hlsl/cpp_compat.hlsl>
#include "shaders/globals.hlsl"

using namespace nbl;

struct DTMSettingsInfo
{
enum E_HEIGHT_SHADING_MODE
{
DISCRETE_VARIABLE_LENGTH_INTERVALS,
DISCRETE_FIXED_LENGTH_INTERVALS,
CONTINOUS_INTERVALS
};

LineStyleInfo outlineLineStyleInfo;
LineStyleInfo contourLineStyleInfo;

float contourLinesStartHeight;
float contourLinesEndHeight;
float contourLinesHeightInterval;

float intervalWidth;
E_HEIGHT_SHADING_MODE heightShadingMode;

void addHeightColorMapEntry(float height, float32_t4 color)
{
heightColorSet.emplace(height, color);
}

bool fillShaderDTMSettingsHeightColorMap(DTMSettings& dtmSettings) const
{
const uint32_t mapSize = heightColorSet.size();
if (mapSize > DTMSettings::HeightColorMapMaxEntries)
return false;
dtmSettings.heightColorEntryCount = mapSize;

int index = 0;
for (auto it = heightColorSet.begin(); it != heightColorSet.end(); ++it)
{
dtmSettings.heightColorMapHeights[index] = it->height;
dtmSettings.heightColorMapColors[index] = it->color;
++index;
}

return true;
}

private:
struct HeightColor
{
float height;
float32_t4 color;

bool operator<(const HeightColor& other) const
{
return height < other.height;
}
};

std::set<HeightColor> heightColorSet;
};

class CTriangleMesh final
{
public:
using index_t = uint32_t;
using vertex_t = TriangleMeshVertex;

inline void setVertices(core::vector<vertex_t>&& vertices)
{
m_vertices = std::move(vertices);
}
inline void setIndices(core::vector<uint32_t>&& indices)
{
m_indices = std::move(indices);
}

inline const core::vector<vertex_t>& getVertices() const
{
return m_vertices;
}
inline const core::vector<uint32_t>& getIndices() const
{
return m_indices;
}

inline size_t getVertexBuffByteSize() const
{
return sizeof(vertex_t) * m_vertices.size();
}
inline size_t getIndexBuffByteSize() const
{
return sizeof(index_t) * m_indices.size();
}
inline size_t getIndexCount() const
{
return m_indices.size();
}

core::vector<vertex_t> m_vertices;
core::vector<index_t> m_indices;
};
Loading