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

Gizmo fixes #6763

Merged
merged 11 commits into from
Jun 28, 2024
Merged

Gizmo fixes #6763

merged 11 commits into from
Jun 28, 2024

Conversation

kpal81xd
Copy link
Contributor

Fixes #6671
Fixes #6695

  • Gizmo scale now just dependent on FOV and distance from camera
  • Selection ray fired from near plane instead of a distance of 1 from the camera
  • Added JSDoc to all methods in gizmo classes
  • Used event names instead of raw strings for callbacks and fire methods
  • Used axis constants instead of raw string values
@@ -51,7 +51,7 @@ const SHADER = {
// store z/w for later use in fragment shader
vZW = gl_Position.zw;
// disable depth clipping
gl_Position.z = 0.0;
// gl_Position.z = 0.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks cleaner when clipping with this so would prefer to have it in but the selection area and rendered area do not align

@@ -122,7 +122,8 @@ data.set('camera', {
});
const camera = new pc.Entity('camera');
camera.addComponent('camera', {
clearColor: new pc.Color(0.1, 0.1, 0.1)
clearColor: new pc.Color(0.1, 0.1, 0.1),
farClip: 1000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why won't the example work with the default far clip?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does it you can just see the the axis lines clipping when zooming out

@@ -264,28 +265,40 @@ class RotateGizmo extends TransformGizmo {
return this._shapes.x.tolerance;
}

/**
* @param {string} prop - The property.
* @param {any} value - The value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the type here number?

@@ -315,40 +315,67 @@ class ScaleGizmo extends TransformGizmo {
return this._shapes.xyz.tolerance;
}

/**
* @param {string} prop - The property name.
* @param {any} value - The property value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number?

_setArrowProp(prop, value) {
this._shapes.x[prop] = value;
this._shapes.y[prop] = value;
this._shapes.z[prop] = value;
}

/**
* @param {string} prop - The property name.
* @param {any} value - The property value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number?

_colorSemi(color) {
const clone = color.clone();
clone.a = this._colorAlpha;
return clone;
}

/**
* @param {string} axis - The axis to update.
* @param {any} value - The value to set.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color?

@@ -305,18 +311,31 @@ class TranslateGizmo extends TransformGizmo {
return this._shapes.face.tolerance;
}

/**
* @param {string} prop - The property to set.
* @param {any} value - The value to set.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'm gonna stop pointing these out now....maybe there's a good reason it's any! 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these are any because its a generic property update so the property could technically be any type

@kpal81xd kpal81xd merged commit f8f7148 into main Jun 28, 2024
8 checks passed
@kpal81xd kpal81xd deleted the gizmo-fixes branch June 28, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants