mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 15:59:49 +02:00
add dashed line support to cube overlay
This commit is contained in:
parent
060a690f85
commit
b2e725c964
1 changed files with 33 additions and 2 deletions
|
@ -57,12 +57,43 @@ void Cube3DOverlay::render() {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glm::vec3 positionToCenter = center - position;
|
glm::vec3 positionToCenter = center - position;
|
||||||
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
|
||||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
|
||||||
if (_isSolid) {
|
if (_isSolid) {
|
||||||
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
||||||
} else {
|
} else {
|
||||||
glLineWidth(_lineWidth);
|
glLineWidth(_lineWidth);
|
||||||
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(1.0f);
|
|
||||||
|
if (getIsDashedLine()) {
|
||||||
|
glm::vec3 halfDimensions = dimensions / 2.0f;
|
||||||
|
glm::vec3 bottomLeftNear(-halfDimensions.x, -halfDimensions.y, -halfDimensions.z);
|
||||||
|
glm::vec3 bottomRightNear(halfDimensions.x, -halfDimensions.y, -halfDimensions.z);
|
||||||
|
glm::vec3 topLeftNear(-halfDimensions.x, halfDimensions.y, -halfDimensions.z);
|
||||||
|
glm::vec3 topRightNear(halfDimensions.x, halfDimensions.y, -halfDimensions.z);
|
||||||
|
|
||||||
|
glm::vec3 bottomLeftFar(-halfDimensions.x, -halfDimensions.y, halfDimensions.z);
|
||||||
|
glm::vec3 bottomRightFar(halfDimensions.x, -halfDimensions.y, halfDimensions.z);
|
||||||
|
glm::vec3 topLeftFar(-halfDimensions.x, halfDimensions.y, halfDimensions.z);
|
||||||
|
glm::vec3 topRightFar(halfDimensions.x, halfDimensions.y, halfDimensions.z);
|
||||||
|
|
||||||
|
drawDashedLine(bottomLeftNear, bottomRightNear);
|
||||||
|
drawDashedLine(bottomRightNear, bottomRightFar);
|
||||||
|
drawDashedLine(bottomRightFar, bottomLeftFar);
|
||||||
|
drawDashedLine(bottomLeftFar, bottomLeftNear);
|
||||||
|
|
||||||
|
drawDashedLine(topLeftNear, topRightNear);
|
||||||
|
drawDashedLine(topRightNear, topRightFar);
|
||||||
|
drawDashedLine(topRightFar, topLeftFar);
|
||||||
|
drawDashedLine(topLeftFar, topLeftNear);
|
||||||
|
|
||||||
|
drawDashedLine(bottomLeftNear, topLeftNear);
|
||||||
|
drawDashedLine(bottomRightNear, topRightNear);
|
||||||
|
drawDashedLine(bottomLeftFar, topLeftFar);
|
||||||
|
drawDashedLine(bottomRightFar, topRightFar);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
|
Application::getInstance()->getDeferredLightingEffect()->renderWireCube(1.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
Loading…
Reference in a new issue