Skip to content

Commit

Permalink
Prepared fix for issue #1037.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsschmidt1337 committed Jun 15, 2024
1 parent 6629462 commit 61df47c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 25 deletions.
3 changes: 3 additions & 0 deletions src/org/nschmidt/ldparteditor/composite/Composite3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ public Vector4f getScreenXY() {
this.setClassicPerspective(true);
this.setOriginShown(true);
this.setGridShown(true);
this.setGridShown3D(false);
setShowingAxis(true);
setShowingLabels(true);
this.setLightOn(true);
Expand Down Expand Up @@ -2426,6 +2427,7 @@ public void loadState(Composite3DState state) {
setShowingLabels(state.isShowLabel());
setSmoothShading(state.isSmooth());
setGridShown(state.isShowGrid());
setGridShown3D(state.isShowGrid3D());
setLightOn(state.isLights());
setMeshLines(state.isMeshlines());
setSubMeshLines(state.isSubfileMeshlines());
Expand All @@ -2452,6 +2454,7 @@ public void loadState(Composite3DState state) {
getMntmShowOrigin().setSelection(state.isShowOrigin());
getMntmLabel().setSelection(state.isShowLabel());
getMntmShowGrid().setSelection(state.isShowGrid());
getMntmShowGrid3D().setSelection(state.isShowGrid3D());
getMntmShowScale().setSelection(state.hasScales());
getMntmSwitchLights().setSelection(state.isLights());
getMntmMeshLines().setSelection(state.isMeshlines());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void showGrid(boolean shown) {
*/
public void showGrid3D(boolean shown) {
NLogger.debug(Composite3DModifier.class, "[Show grid (3D)]"); //$NON-NLS-1$
c3d.setGridShown(shown);
c3d.setGridShown3D(shown);
}

/**
Expand Down
59 changes: 35 additions & 24 deletions src/org/nschmidt/ldparteditor/opengl/OpenGLRenderer20.java
Original file line number Diff line number Diff line change
Expand Up @@ -1745,39 +1745,50 @@ else if (zoom > 1.0E-2)
GL11.glBegin(GL11.GL_LINES);
final float gridSize = c3d.getGridScale() * 1000f;
final float gridSize10 = gridSize * 10f;

float offsetXX = -gridSize10;
float offsetXY = 0f;
float offsetXZ = 0f;
float offsetYX = 0f;
float offsetYY = gridSize10;
float offsetYZ = 0f;
float offsetZX = 0f;
float offsetZY = 0f;
float offsetZZ = gridSize10;

float y = -gridSize10;
for (int i = 0; i < 20; i++) {
float x = -gridSize10;
for (int j = 0; j < 20; j++) {
GL11.glColor3f(Colour.manipulatorXAxisColourR, Colour.manipulatorXAxisColourG, Colour.manipulatorXAxisColourG);
GL11.glVertex3f(0f, x, y);
GL11.glVertex3f(0f, x, y + gridSize);
GL11.glVertex3f(0f, x, y + gridSize);
GL11.glVertex3f(0f, x + gridSize, y + gridSize);
GL11.glVertex3f(0f, x + gridSize, y + gridSize);
GL11.glVertex3f(0f, x + gridSize, y);
GL11.glVertex3f(0f, x + gridSize, y);
GL11.glVertex3f(0f, x, y);
GL11.glVertex3f(offsetXX, offsetXY + x, offsetXZ + y);
GL11.glVertex3f(offsetXX, offsetXY + x, offsetXZ + y + gridSize);
GL11.glVertex3f(offsetXX, offsetXY + x, offsetXZ + y + gridSize);
GL11.glVertex3f(offsetXX, offsetXY + x + gridSize, offsetXZ + y + gridSize);
GL11.glVertex3f(offsetXX, offsetXY + x + gridSize, offsetXZ + y + gridSize);
GL11.glVertex3f(offsetXX, offsetXY + x + gridSize, offsetXZ + y);
GL11.glVertex3f(offsetXX, offsetXY + x + gridSize, offsetXZ + y);
GL11.glVertex3f(offsetXX, offsetXY + x, offsetXZ + y);

GL11.glColor3f(Colour.manipulatorYAxisColourR, Colour.manipulatorYAxisColourG, Colour.manipulatorYAxisColourG);
GL11.glVertex3f(x, 0f, y);
GL11.glVertex3f(x, 0f, y + gridSize);
GL11.glVertex3f(x, 0f, y + gridSize);
GL11.glVertex3f(x + gridSize, 0f, y + gridSize);
GL11.glVertex3f(x + gridSize, 0f, y + gridSize);
GL11.glVertex3f(x + gridSize, 0f, y);
GL11.glVertex3f(x + gridSize, 0f, y);
GL11.glVertex3f(x, 0f, y);
GL11.glVertex3f(offsetYX + x, offsetYY, offsetYZ + y);
GL11.glVertex3f(offsetYX + x, offsetYY, offsetYZ + y + gridSize);
GL11.glVertex3f(offsetYX + x, offsetYY, offsetYZ + y + gridSize);
GL11.glVertex3f(offsetYX + x + gridSize, offsetYY, offsetYZ + y + gridSize);
GL11.glVertex3f(offsetYX + x + gridSize, offsetYY, offsetYZ + y + gridSize);
GL11.glVertex3f(offsetYX + x + gridSize, offsetYY, offsetYZ + y);
GL11.glVertex3f(offsetYX + x + gridSize, offsetYY, offsetYZ + y);
GL11.glVertex3f(offsetYX + x, offsetYY, offsetYZ + y);

GL11.glColor3f(Colour.manipulatorZAxisColourR, Colour.manipulatorZAxisColourG, Colour.manipulatorZAxisColourG);
GL11.glVertex3f(x, y, 0f);
GL11.glVertex3f(x, y + gridSize, 0f);
GL11.glVertex3f(x, y + gridSize, 0f);
GL11.glVertex3f(x + gridSize, y + gridSize, 0f);
GL11.glVertex3f(x + gridSize, y + gridSize, 0f);
GL11.glVertex3f(x + gridSize, y, 0f);
GL11.glVertex3f(x + gridSize, y, 0f);
GL11.glVertex3f(x, y, 0f);
GL11.glVertex3f(offsetZX + x, offsetZY + y, offsetZZ);
GL11.glVertex3f(offsetZX + x, offsetZY + y + gridSize, offsetZZ);
GL11.glVertex3f(offsetZX + x, offsetZY + y + gridSize, offsetZZ);
GL11.glVertex3f(offsetZX + x + gridSize, offsetZY + y + gridSize, offsetZZ);
GL11.glVertex3f(offsetZX + x + gridSize, offsetZY + y + gridSize, offsetZZ);
GL11.glVertex3f(offsetZX + x + gridSize, offsetZY + y, offsetZZ);
GL11.glVertex3f(offsetZX + x + gridSize, offsetZY + y, offsetZZ);
GL11.glVertex3f(offsetZX + x, offsetZY + y, offsetZZ);
x = x + gridSize;
}
y = y + gridSize;
Expand Down

0 comments on commit 61df47c

Please sign in to comment.