Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: C/C++ CI

on:
push:
branches: [ "exp" ]
pull_request:
branches: [ "exp" ]


jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: configure
run: ./configure
- name: make
run: make
- name: make check
run: make check
- name: make distcheck
run: make distcheck
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*.sln
*.vcx*
/imgui
<<<<<<< HEAD
/packages
/Cadera
shaders/compile.bat
Expand All @@ -16,8 +15,9 @@ imgui.ini
build/
.vscode/
*.spv
doc/
doc/Doxyfile
doc/html
*.code-workspace
=======
/Cadera
>>>>>>> master
doc/visuals/**/media/
doc/visuals/**/__pycache__/

6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0.0)
set(CMAKE_TOOLCHAIN_FILE "C:\\vcpkg\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake" )
project(Cadera VERSION 0.1.0)
project(Cadera VERSION 0.0.1)

include(CTest)
enable_testing()
Expand All @@ -27,8 +27,10 @@ add_executable(Cadera src/Cadera.cpp


)


add_executable(tester test/tester.cpp)
add_test(tester tester)

target_precompile_headers(Cadera PRIVATE include/pch.hpp)
target_include_directories(Cadera PRIVATE include/)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Open Source Cad Program
## About
A work in progress 3D CAD Program

[Project Plan](doc/pages/ProjectPlan.md)

## Dependencies

Vulkan 1.2.154
Expand Down
87 changes: 87 additions & 0 deletions doc/pages/ProjectPlan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Project Plan

- [Project Plan](#project-plan)
- [Version 0.1 Sketch Tooling](#version-01-sketch-tooling)
- [Version 0.0.2 Points/Lines/Rectangles](#version-002-pointslinesrectangles)
- [Points](#points)
- [Lines](#lines)
- [Rectangles](#rectangles)
- [Version 0.0.3 Rounds](#version-003-rounds)
- [Circles](#circles)
- [Arcs](#arcs)
- [Version 0.0.4 Notes](#version-004-notes)
- [Text](#text)
- [History](#history)
- [Version 0.0.1 Grids](#version-001-grids)
- [Sketch](#sketch)
- [Grid](#grid)


## Version 0.1 Sketch Tooling

- [x] 0.0.1
- [ ] 0.0.2
- [ ] 0.0.3
- [ ] 0.0.4
- [ ] 0.0.5
- [ ] 0.0.6



## Version 0.0.2 Points/Lines/Rectangles

### Points

- [ ] Movable
- [ ] Table (Debug)

### Lines

- [ ] Line Tool
- [ ] Add
- [ ] Delete
- [ ] Selection
- [ ] Movable
- [ ] Debug

### Rectangles
- [ ] Rectangle Tool


## Version 0.0.3 Rounds

### Circles

- [ ] Circle Tool
- [ ] Selection

### Arcs

- [ ] Arc Tool (3 pt)
- [ ] Selection


## Version 0.0.4 Notes

### Text

- [ ] Font Size
- [ ] Selection
- [ ] Bounding Box
- [ ] Return
- [ ] Tabs


# History


## Version 0.0.1 Grids

### Sketch

- [x] Create a sketch on any 3 base planes (x/y, z/x, y/z)

### Grid

- [x] Resize
- [x] Works on any plane
33 changes: 33 additions & 0 deletions doc/visuals/grid/grid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from manim import *


class CreateCircle(Scene):
def construct(self):
circle = Circle()
circle.set_fill(PINK, opacity=0.5)
self.play(Create(circle))

class CreateGrid(Scene):

def construct(self):

line = Line()
line.set_length(2)
line.set_color(WHITE)
line.set_angle(-PI/2)
#line.shift(LEFT * .2)


line2 = Line()
line2.set_length(2)
line2.set_color(WHITE)
line2.set_angle(0)
#line2.shift(UP)

self.play(Create(line))
#self.play(Rotate(line,-PI/2, about_point=ORIGIN))
self.play(Create(line2))
self.play(FadeOut(line))
self.play(FadeOut(line2))


16 changes: 14 additions & 2 deletions include/Camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ namespace cam {
/// The length of the cameraVec vector
float camDistance;

/// Up direction of Camera
glm::vec3 up;

/// Direction to move Camera to the side, for panning
glm::vec3 cross;

// Ortho view
float left;

Expand All @@ -49,9 +55,15 @@ namespace cam {
double xpos;
double ypos;

void update();
void setXYView();

void setYZView();

void setZXView();

void update();

/**
/**
* @brief
*
* @param yoffset
Expand Down
2 changes: 1 addition & 1 deletion include/Selection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace sel {

void setActiveSketch(sketch::Sketch* pSketch);

void select(glm::vec3 mouseRay, glm::vec3 origin, glm::vec3 normal, glm::vec3 pos, bool isOrtho);
void select(glm::vec3 mouseRay, glm::vec3 origin, glm::vec3 normal, glm::vec3 pos, glm::vec3 cross, bool isOrtho);

static int selectPoint(glm::vec3 pointToAdd, std::map<int, Point> &points, float skScale);

Expand Down
10 changes: 9 additions & 1 deletion include/grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@ class Grid {


Grid();


void setGridOrientation(glm::vec3 normal, glm::vec3 up, glm::vec3 cross);



/// @brief To generate the values needed to instance each grid line from the base line
/// @return Vector to be used for rendering the instances
std::vector<GridRotationAxis> createGridInstanceAxii();

Vertex p1;
Vertex p2;

glm::vec3 gNormal;
glm::vec3 gUp;
glm::vec3 gCross;

/// @brief The container for rendering the base line
std::vector<Vertex> line;

Expand Down
8 changes: 5 additions & 3 deletions src/CADRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,6 @@ void CADRender::createSwapChain()
mCommandBuffers[i].bindVertexBuffers(0, 1, &mBuffers[BUF_SKETCH_GRID_LINE].mBuffer, offsets);
mCommandBuffers[i].bindVertexBuffers(1, 1, &mBuffers[BUF_SKETCH_GRID_AXII].mBuffer, offsets);
mCommandBuffers[i].draw(2, mBuffers[BUF_SKETCH_GRID_AXII].mPointSize, 0, 0);
//mCommandBuffers[i].draw(2, 4, 0, 0);
}

// Text
Expand Down Expand Up @@ -1599,8 +1598,11 @@ void CADRender::createSwapChain()

void CADRender::updateUniformBuffer(uint32_t currentImage) {

u.model = glm::rotate(glm::mat4(1.0f), glm::radians(0.0f), glm::vec3(0.0f, 1.0f, 0.0f));
u.view = glm::lookAt(Cam.pos, Cam.focus, glm::vec3(0.0f, 1.0f, 0.0f));
//u.model = glm::rotate(glm::mat4(1.0f), glm::radians(0.0f), glm::vec3(0.0f, 1.0f, 0.0f));
// u.view = glm::lookAt(Cam.pos, Cam.focus, glm::vec3(0.0f, 1.0f, 0.0f));
u.model = glm::rotate(glm::mat4(1.0f), glm::radians(0.0f), Cam.up);
u.view = glm::lookAt(Cam.pos, Cam.focus, Cam.up);



if (Cam.flags.test(cam::ortho)) {
Expand Down
54 changes: 48 additions & 6 deletions src/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,57 @@ namespace cam {

Camera::Camera()
{
pos = { -20.0f, 0.0f, 0.0f };
pos = { 0.0f, 0.0f, 20.0f };
focus = { 0.0f, 0.0f, 0.0f };
cameraVec = { 1.0f, 0.0f, 0.0f };
cameraVec = { 0.0f, 0.0f, -1.0f };
xpos = 0.0;
ypos = 0.0;
mouseRay = { 0.0f, 0.0f, 0.0f };
left = -10.0f;
camDistance = 0.0f;

up = {0.0f, 1.0f, 0.0f};

cross = glm::cross(cameraVec, up);

}


void Camera::setXYView() {

pos = { 0.0f, 0.0f, 20.0f };
focus = { 0.0f, 0.0f, 0.0f };
cameraVec = { 0.0f, 0.0f, -1.0f };

up = {0.0f, 1.0f, 0.0f};
cross = glm::cross(cameraVec, up);

}

void Camera::setYZView() {

pos = { 20.0f, 0.0f, 0.0f };
focus = { 0.0f, 0.0f, 0.0f };
cameraVec = { -1.0f, 0.0f, 0.0f };

up = {0.0f, 0.0f, 1.0f};
cross = glm::cross(cameraVec, up);

}

void Camera::setZXView() {

pos = { 0.0f, 20.0f, 0.0f };
focus = { 0.0f, 0.0f, 0.0f };
cameraVec = { 0.0f, -1.0f, 0.0f };

up = {1.0f, 0.0f, 0.0f};
cross = glm::cross(cameraVec, up);

}



void Camera::update() {

camDistance = glm::length(pos - focus);
Expand Down Expand Up @@ -88,10 +128,12 @@ namespace cam {

diff = mouseRay - prevMouseRay;

pos.y -= diff.y;
pos.z -= diff.x;
focus.y -= diff.y;
focus.z -= diff.x;


pos -= diff.y * up;
pos -= diff.x * cross;
focus -= diff.y * up;
focus -= diff.x * cross;

}
else {
Expand Down
12 changes: 8 additions & 4 deletions src/Selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,16 @@ namespace sel {

}

void Selector::select(glm::vec3 mouseRay, glm::vec3 origin, glm::vec3 normal, glm::vec3 pos, bool isOrtho) {
void Selector::select(glm::vec3 mouseRay, glm::vec3 origin, glm::vec3 normal, glm::vec3 pos, glm::vec3 cross, bool isOrtho) {

if (isOrtho) {
point.x = 0.0f;
point.y = mouseRay.y + pos.y;
point.z = mouseRay.x + pos.z;
glm::vec3 up = glm::cross(cross, normal);

glm::vec3 x = mouseRay.x * cross;
glm::vec3 y = mouseRay.y * up;

glm::vec3 posOnPlane = origin + ( up + cross) * pos;
point = posOnPlane + x + y;
}
else {
point = calcPOnPlane(mouseRay, origin, normal, pos);
Expand Down
Loading