Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

XCD-176 IPad Cut Mode #1770

Merged
merged 55 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
36335f9
Remove unused highlightBall and highlightPlane materials
MichalDybizbanskiCreoox Dec 27, 2024
6018978
Remove unused _canvasWheelListener
MichalDybizbanskiCreoox Dec 27, 2024
3bd71a1
Remove unnecessary onCameraViewMatrix and onCameraProjMatrix
MichalDybizbanskiCreoox Dec 27, 2024
730e8d6
Remove unused _baseDir
MichalDybizbanskiCreoox Dec 30, 2024
b41697a
Remove unused getTranslationPlane calls arguments
MichalDybizbanskiCreoox Dec 27, 2024
774ba6c
Migrate getClickCoordsWithinElement to getBoundingClientRect
MichalDybizbanskiCreoox Dec 27, 2024
e13a62c
Refactor SectionPlanesPlugin Control's shapes and materials
MichalDybizbanskiCreoox Dec 27, 2024
835c896
Add missing backfaces: true to zCurve and zCurveHandle
MichalDybizbanskiCreoox Dec 27, 2024
e6b6b80
Remove zHoop backfaces: true for consistency with {x,y}Hoop
MichalDybizbanskiCreoox Dec 27, 2024
e3cfdb5
Refactor {x,y,z}Curve* nodes to have similar definitions
MichalDybizbanskiCreoox Dec 27, 2024
2a82314
Normalize rotationMat4v x axis to 1.0 from 0.8
MichalDybizbanskiCreoox Dec 27, 2024
4f8f007
Abstract addCurve
MichalDybizbanskiCreoox Dec 27, 2024
557f86b
Rename {x,z}AxisHandle to {x,z}ShaftHandle for consistency with yShaf…
MichalDybizbanskiCreoox Dec 27, 2024
01714d0
Remove unneeded yAxisArrowHandle opacity: 0.2
MichalDybizbanskiCreoox Dec 27, 2024
fe3fc94
Refactor {x,y,z}Axis* nodes to have similar definitions
MichalDybizbanskiCreoox Dec 27, 2024
3883da0
Abstract addAxis
MichalDybizbanskiCreoox Dec 27, 2024
357d020
Refactor addAxis to accept rotationQuat instead of two matrices
MichalDybizbanskiCreoox Dec 27, 2024
356604b
Incorporate hoops inside addCurve
MichalDybizbanskiCreoox Dec 27, 2024
ae16a73
Incorporate bigArrowHeads inside addAxis
MichalDybizbanskiCreoox Dec 27, 2024
9154565
Remove unused planeFrame affordanceMesh
MichalDybizbanskiCreoox Dec 27, 2024
260a613
Refactor addAxis to use direction
MichalDybizbanskiCreoox Dec 27, 2024
fa704be
Migrate addCurve to use direction
MichalDybizbanskiCreoox Dec 27, 2024
849bee2
Migrate addCurve to use direction for arrows
MichalDybizbanskiCreoox Dec 27, 2024
698287e
Combine addCurve with addAxis
MichalDybizbanskiCreoox Dec 27, 2024
523ebf1
Simplify materials
MichalDybizbanskiCreoox Dec 27, 2024
dc81ffc
Migrate setting event handlers to this._handlers
MichalDybizbanskiCreoox Dec 27, 2024
37a121d
Don't bother with meshesToAdd, as these meshes are not pickable anyway
MichalDybizbanskiCreoox Dec 27, 2024
665d30c
Simplify event handlers
MichalDybizbanskiCreoox Dec 27, 2024
d160af4
Don't rely on grabbed
MichalDybizbanskiCreoox Dec 27, 2024
f201446
Don't disable camera control on non-left button click
MichalDybizbanskiCreoox Dec 27, 2024
f67f0f8
Simplify lastCanvasPos assignments
MichalDybizbanskiCreoox Dec 27, 2024
211d155
Don't rely on down
MichalDybizbanskiCreoox Dec 27, 2024
174d226
Inline rotateSectionPlane
MichalDybizbanskiCreoox Dec 27, 2024
26cdd28
Abstract setRootNodeScale
MichalDybizbanskiCreoox Dec 27, 2024
e5df856
Inline SectionPlanesPlugin::Control _unbindEvents and _destroyNodes
MichalDybizbanskiCreoox Dec 30, 2024
0f2bb13
Inline SectionPlanesPlugin::Control _setSectionPlaneDir
MichalDybizbanskiCreoox Dec 30, 2024
15649b1
Inline SectionPlanesPlugin::Control _setPos and _setDir
MichalDybizbanskiCreoox Dec 30, 2024
7552c15
Only move public methods' definitions around
MichalDybizbanskiCreoox Dec 30, 2024
ceb4201
Inline SectionPlanesPlugin::Control _createNodes and _bindEvents
MichalDybizbanskiCreoox Dec 30, 2024
a7f8161
Inline SectionPlanesPlugin::Control _setSectionPlane and _destroy bodies
MichalDybizbanskiCreoox Dec 30, 2024
30b2eab
Replace some SectionPlanesPlugin::Control properties by local variables
MichalDybizbanskiCreoox Dec 30, 2024
ddba186
Replace SectionPlanesPlugin::Control listeners by local variables
MichalDybizbanskiCreoox Dec 30, 2024
bce0faf
Replace SectionPlanesPlugin::Control sectionPlane listeners by local …
MichalDybizbanskiCreoox Dec 30, 2024
364f11c
Change _displayMeshes to an array from an object
MichalDybizbanskiCreoox Dec 30, 2024
08ec0b2
Simplify event handlers
MichalDybizbanskiCreoox Dec 30, 2024
1dac817
Move dragAction definitions inside addAxis
MichalDybizbanskiCreoox Dec 30, 2024
937e031
Move lastCanvasPos preservation inside handlers
MichalDybizbanskiCreoox Dec 30, 2024
3452c77
Change handlers to objects from arrays
MichalDybizbanskiCreoox Dec 31, 2024
cbbe01a
Use only rootNode.position for the Control coordinates
MichalDybizbanskiCreoox Dec 31, 2024
0433407
XEOK-125 Change the way axis interaction is interpreted - looking for…
MichalDybizbanskiCreoox Dec 31, 2024
a0bee43
Replace affordanceMesh with setActivated
MichalDybizbanskiCreoox Dec 31, 2024
cb83bc7
CHANGE SectionPlanesPlugin::Control to rely only on canvas events, an…
MichalDybizbanskiCreoox Dec 31, 2024
4b85892
Simplify shapes definitions and widen hoop radius (to be easier to pick)
MichalDybizbanskiCreoox Dec 31, 2024
26abe4c
XCD-176 Add SectionPlanesPlugin::Control touch events support
MichalDybizbanskiCreoox Dec 31, 2024
b68bedd
Reintroduce worldToRTCPos decomposition to rootNode origin and positi…
MichalDybizbanskiCreoox Jan 4, 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
Prev Previous commit
Next Next commit
Refactor {x,y,z}Curve* nodes to have similar definitions
MichalDybizbanskiCreoox committed Jan 2, 2025
commit e3cfdb588b93866e43abac2b84762f1c1b304a9f
225 changes: 145 additions & 80 deletions src/plugins/SectionPlanesPlugin/Control.js
Original file line number Diff line number Diff line change
@@ -348,188 +348,253 @@ class Control {
//
//----------------------------------------------------------------------------------------------------------

xCurve: rootNode.addChild(new Mesh(rootNode, { // Red hoop about Y-axis
geometry: shapes.curve,
material: materials.red,
matrix: (function () {
xCurveHandle: (function() {

const material = materials.red;

const matrix = (function () {
const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());
const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
return math.mulMat4(rotate1, rotate2, math.identityMat4());
})(),
})();

const mat1 = (function () {
const translate = math.translateMat4c(0., -0.07, -0.8, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
const rotate = math.rotationMat4v(0 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
})();

const mat2 = (function () {
const translate = math.translateMat4c(0.0, -0.8, -0.07, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
})();

const curve = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.curve,
material: material,
matrix: matrix,
pickable: false,
collidable: true,
clippable: false,
backfaces: true,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

xCurveHandle: rootNode.addChild(new Mesh(rootNode, { // Red hoop about Y-axis
const handle = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.curveHandle,
material: materials.pickable,
matrix: (function () {
const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());
const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
return math.mulMat4(rotate1, rotate2, math.identityMat4());
})(),
matrix: matrix,
pickable: true,
collidable: true,
clippable: false,
backfaces: true,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

xCurveArrow1: rootNode.addChild(new Mesh(rootNode, {
const arrow1 = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.arrowHead,
material: materials.red,
matrix: (function () {
const translate = math.translateMat4c(0., -0.07, -0.8, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
const rotate = math.rotationMat4v(0 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
})(),
material: material,
matrix: mat1,
pickable: true,
collidable: true,
clippable: false,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

xCurveArrow2: rootNode.addChild(new Mesh(rootNode, {
const arrow2 = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.arrowHead,
material: materials.red,
matrix: (function () {
const translate = math.translateMat4c(0.0, -0.8, -0.07, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
})(),
material: material,
matrix: mat2,
pickable: true,
collidable: true,
clippable: false,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

return {
id: handle.id,
set visible(v) {
curve.visible = handle.visible = arrow1.visible = arrow2.visible = v;
},
set culled(c) {
curve.culled = handle.culled = arrow1.culled = arrow2.culle = c;
}
};
})(),

//----------------------------------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------------------------------

yCurve: rootNode.addChild(new Mesh(rootNode, {
yCurveHandle: (function() {

const material = materials.green;

const matrix = (function() {
const q = math.identityQuaternion();
math.eulerToQuaternion([-90, 0, 0], "XYZ", q);
const m = math.mat4();
math.quaternionToMat4(q, m);
return m;
})();

const mat1 = (function () {
const translate = math.translateMat4c(0.07, 0, -0.8, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
})();

const mat2 = (function () {
const translate = math.translateMat4c(0.8, 0.0, -0.07, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
})();

const curve = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.curve,
material: materials.green,
rotation: [-90, 0, 0],
material: material,
matrix: matrix,
pickable: false,
collidable: true,
clippable: false,
backfaces: true,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

yCurveHandle: rootNode.addChild(new Mesh(rootNode, {
const handle = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.curveHandle,
material: materials.pickable,
rotation: [-90, 0, 0],
matrix: matrix,
pickable: true,
collidable: true,
clippable: false,
backfaces: true,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

yCurveArrow1: rootNode.addChild(new Mesh(rootNode, {
const arrow1 = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.arrowHead,
material: materials.green,
matrix: (function () {
const translate = math.translateMat4c(0.07, 0, -0.8, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
})(),
material: material,
matrix: mat1,
pickable: true,
collidable: true,
clippable: false,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

yCurveArrow2: rootNode.addChild(new Mesh(rootNode, {
const arrow2 = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.arrowHead,
material: materials.green,
matrix: (function () {
const translate = math.translateMat4c(0.8, 0.0, -0.07, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
})(),
material: material,
matrix: mat2,
pickable: true,
collidable: true,
clippable: false,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

return {
id: handle.id,
set visible(v) {
curve.visible = handle.visible = arrow1.visible = arrow2.visible = v;
},
set culled(c) {
curve.culled = handle.culled = arrow1.culled = arrow2.culle = c;
}
};
})(),

//----------------------------------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------------------------------

zCurve: rootNode.addChild(new Mesh(rootNode, { // Blue hoop about Z-axis
zCurveHandle: (function() {

const material = materials.blue;

const matrix = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());

const mat1 = (function () {
const translate = math.translateMat4c(.8, -0.07, 0, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
return math.mulMat4(translate, scale, math.identityMat4());
})();

const mat2 = (function () {
const translate = math.translateMat4c(.05, -0.8, 0, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
})();

const curve = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.curve,
material: materials.blue,
matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),
material: material,
matrix: matrix,
pickable: false,
collidable: true,
clippable: false,
backfaces: true,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

zCurveHandle: rootNode.addChild(new Mesh(rootNode, {
const handle = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.curveHandle,
material: materials.pickable,
matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),
matrix: matrix,
pickable: true,
collidable: true,
clippable: false,
backfaces: true,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

zCurveCurveArrow1: rootNode.addChild(new Mesh(rootNode, {
const arrow1 = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.arrowHead,
material: materials.blue,
matrix: (function () {
const translate = math.translateMat4c(.8, -0.07, 0, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
return math.mulMat4(translate, scale, math.identityMat4());
})(),
material: material,
matrix: mat1,
pickable: true,
collidable: true,
clippable: false,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

zCurveArrow2: rootNode.addChild(new Mesh(rootNode, {
const arrow2 = rootNode.addChild(new Mesh(rootNode, {
geometry: shapes.arrowHead,
material: materials.blue,
matrix: (function () {
const translate = math.translateMat4c(.05, -0.8, 0, math.identityMat4());
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
})(),
material: material,
matrix: mat2,
pickable: true,
collidable: true,
clippable: false,
visible: false,
isObject: false
}), NO_STATE_INHERIT),
}), NO_STATE_INHERIT);

return {
id: handle.id,
set visible(v) {
curve.visible = handle.visible = arrow1.visible = arrow2.visible = v;
},
set culled(c) {
curve.culled = handle.culled = arrow1.culled = arrow2.culle = c;
}
};
})(),

//----------------------------------------------------------------------------------------------------------
//