mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 00:13:29 +02:00
Merge pull request #3540 from samcake/temp0
replacing glutSolidSPhere by a cached Geometry
This commit is contained in:
commit
0d5f81c062
50 changed files with 158 additions and 39 deletions
0
domain-server/resources/web/assignment/js/ace/ace.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/ace.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/mode-javascript.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/mode-javascript.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/snippets/javascript.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/snippets/javascript.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/theme-twilight.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/theme-twilight.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/worker-javascript.js
Executable file → Normal file
0
domain-server/resources/web/assignment/js/ace/worker-javascript.js
Executable file → Normal file
0
domain-server/resources/web/js/form2js.min.js
vendored
Executable file → Normal file
0
domain-server/resources/web/js/form2js.min.js
vendored
Executable file → Normal file
0
examples/move.js
Executable file → Normal file
0
examples/move.js
Executable file → Normal file
|
@ -35,6 +35,7 @@
|
||||||
uniform vec3 v3CameraPos; // The camera's current position
|
uniform vec3 v3CameraPos; // The camera's current position
|
||||||
uniform vec3 v3LightPos; // The direction vector to the light source
|
uniform vec3 v3LightPos; // The direction vector to the light source
|
||||||
uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels
|
uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels
|
||||||
|
uniform float fOuterRadius; // The outer (atmosphere) radius
|
||||||
uniform float fInnerRadius; // The inner (planetary) radius
|
uniform float fInnerRadius; // The inner (planetary) radius
|
||||||
uniform float fKrESun; // Kr * ESun
|
uniform float fKrESun; // Kr * ESun
|
||||||
uniform float fKmESun; // Km * ESun
|
uniform float fKmESun; // Km * ESun
|
||||||
|
@ -44,6 +45,7 @@ uniform float fScale; // 1 / (fOuterRadius - fInnerRadius)
|
||||||
uniform float fScaleDepth; // The scale depth (i.e. the altitude at which the atmosphere's average density is found)
|
uniform float fScaleDepth; // The scale depth (i.e. the altitude at which the atmosphere's average density is found)
|
||||||
uniform float fScaleOverScaleDepth; // fScale / fScaleDepth
|
uniform float fScaleOverScaleDepth; // fScale / fScaleDepth
|
||||||
|
|
||||||
|
|
||||||
const int nSamples = 2;
|
const int nSamples = 2;
|
||||||
const float fSamples = 2.0;
|
const float fSamples = 2.0;
|
||||||
|
|
||||||
|
@ -59,7 +61,7 @@ float scale(float fCos)
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
// Get the ray from the camera to the vertex, and its length (which is the far point of the ray passing through the atmosphere)
|
// Get the ray from the camera to the vertex, and its length (which is the far point of the ray passing through the atmosphere)
|
||||||
position = gl_Vertex.xyz;
|
position = gl_Vertex.xyz * fOuterRadius;
|
||||||
|
|
||||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,12 @@
|
||||||
// Copyright (c) 2004 Sean O'Neil
|
// Copyright (c) 2004 Sean O'Neil
|
||||||
//
|
//
|
||||||
|
|
||||||
|
uniform float fOuterRadius; // The outer (atmosphere) radius
|
||||||
|
|
||||||
varying vec3 position;
|
varying vec3 position;
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
position = gl_Vertex.xyz;
|
position = gl_Vertex.xyz * fOuterRadius;
|
||||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -883,7 +883,11 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_W:
|
case Qt::Key_W:
|
||||||
_myAvatar->setDriveKeys(FWD, 1.f);
|
if (isOption && !isShifted && !isMeta) {
|
||||||
|
Menu::getInstance()->triggerOption(MenuOption::Wireframe);
|
||||||
|
} else {
|
||||||
|
_myAvatar->setDriveKeys(FWD, 1.f);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_S:
|
case Qt::Key_S:
|
||||||
|
@ -2902,10 +2906,8 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
|
||||||
// draw a red sphere
|
// draw a red sphere
|
||||||
float originSphereRadius = 0.05f;
|
float originSphereRadius = 0.05f;
|
||||||
glColor3f(1,0,0);
|
glColor3f(1,0,0);
|
||||||
glPushMatrix();
|
_geometryCache.renderSphere(originSphereRadius, 15, 15);
|
||||||
glutSolidSphere(originSphereRadius, 15, 15);
|
|
||||||
glPopMatrix();
|
|
||||||
|
|
||||||
// draw the audio reflector overlay
|
// draw the audio reflector overlay
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("audio");
|
PerformanceTimer perfTimer("audio");
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "BuckyBalls.h"
|
#include "BuckyBalls.h"
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include "devices/SixenseManager.h"
|
#include "devices/SixenseManager.h"
|
||||||
|
@ -171,7 +172,7 @@ void BuckyBalls::render() {
|
||||||
}
|
}
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(_bballPosition[i].x, _bballPosition[i].y, _bballPosition[i].z);
|
glTranslatef(_bballPosition[i].x, _bballPosition[i].y, _bballPosition[i].z);
|
||||||
glutSolidSphere(_bballRadius[i], 15, 15);
|
Application::getInstance()->getGeometryCache()->renderSphere(_bballRadius[i], 15, 15);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,10 +261,10 @@ void Environment::renderAtmosphere(Camera& camera, const EnvironmentData& data)
|
||||||
|
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glutSolidSphere(data.getAtmosphereOuterRadius(), 100, 50);
|
Application::getInstance()->getGeometryCache()->renderSphere(1.f, 100, 50); //Draw a unit sphere
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
|
|
||||||
program->release();
|
program->release();
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,7 +385,7 @@ Menu::Menu() :
|
||||||
0,
|
0,
|
||||||
appInstance->getGlowEffect(),
|
appInstance->getGlowEffect(),
|
||||||
SLOT(cycleRenderMode()));
|
SLOT(cycleRenderMode()));
|
||||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, 0, false);
|
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, Qt::ALT | Qt::Key_W, false);
|
||||||
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, Qt::SHIFT | Qt::Key_L, this, SLOT(lodTools()));
|
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, Qt::SHIFT | Qt::Key_L, this, SLOT(lodTools()));
|
||||||
|
|
||||||
QMenu* avatarDebugMenu = developerMenu->addMenu("Avatar");
|
QMenu* avatarDebugMenu = developerMenu->addMenu("Avatar");
|
||||||
|
|
|
@ -2423,7 +2423,7 @@ void SphereRenderer::renderUnclipped(const glm::vec4& color, Mode mode) {
|
||||||
glm::vec3 axis = glm::axis(rotation);
|
glm::vec3 axis = glm::axis(rotation);
|
||||||
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
||||||
|
|
||||||
glutSolidSphere(sphere->getScale(), 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(sphere->getScale(), 10, 10);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
0
interface/src/Stars.cpp
Executable file → Normal file
0
interface/src/Stars.cpp
Executable file → Normal file
0
interface/src/Stars.h
Executable file → Normal file
0
interface/src/Stars.h
Executable file → Normal file
|
@ -27,6 +27,7 @@
|
||||||
#include "ui/TextRenderer.h"
|
#include "ui/TextRenderer.h"
|
||||||
#include "VoxelConstants.h"
|
#include "VoxelConstants.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
|
@ -112,13 +113,13 @@ void drawVector(glm::vec3 * vector) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor3f(1,0,0);
|
glColor3f(1,0,0);
|
||||||
glTranslatef(vector->x, 0, 0);
|
glTranslatef(vector->x, 0, 0);
|
||||||
glutSolidSphere(0.02, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(0.02f, 10, 10);
|
||||||
glColor3f(0,1,0);
|
glColor3f(0,1,0);
|
||||||
glTranslatef(-vector->x, vector->y, 0);
|
glTranslatef(-vector->x, vector->y, 0);
|
||||||
glutSolidSphere(0.02, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(0.02f, 10, 10);
|
||||||
glColor3f(0,0,1);
|
glColor3f(0,0,1);
|
||||||
glTranslatef(0, -vector->y, vector->z);
|
glTranslatef(0, -vector->y, vector->z);
|
||||||
glutSolidSphere(0.02, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(0.02f, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -155,22 +156,22 @@ void renderWorldBox() {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(MARKER_DISTANCE, 0, 0);
|
glTranslatef(MARKER_DISTANCE, 0, 0);
|
||||||
glColor3fv(red);
|
glColor3fv(red);
|
||||||
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(0, MARKER_DISTANCE, 0);
|
glTranslatef(0, MARKER_DISTANCE, 0);
|
||||||
glColor3fv(green);
|
glColor3fv(green);
|
||||||
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(0, 0, MARKER_DISTANCE);
|
glTranslatef(0, 0, MARKER_DISTANCE);
|
||||||
glColor3fv(blue);
|
glColor3fv(blue);
|
||||||
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor3fv(gray);
|
glColor3fv(gray);
|
||||||
glTranslatef(MARKER_DISTANCE, 0, MARKER_DISTANCE);
|
glTranslatef(MARKER_DISTANCE, 0, MARKER_DISTANCE);
|
||||||
glutSolidSphere(MARKER_RADIUS, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(MARKER_RADIUS, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,7 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
|
||||||
} else {
|
} else {
|
||||||
glTranslatef(_position.x, getDisplayNamePosition().y + LOOK_AT_INDICATOR_OFFSET, _position.z);
|
glTranslatef(_position.x, getDisplayNamePosition().y + LOOK_AT_INDICATOR_OFFSET, _position.z);
|
||||||
}
|
}
|
||||||
glutSolidSphere(LOOK_AT_INDICATOR_RADIUS, 15, 15);
|
Application::getInstance()->getGeometryCache()->renderSphere(LOOK_AT_INDICATOR_RADIUS, 15, 15);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,8 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(_position.x, _position.y, _position.z);
|
glTranslatef(_position.x, _position.y, _position.z);
|
||||||
glScalef(height, height, height);
|
glScalef(height, height, height);
|
||||||
glutSolidSphere(sphereRadius, 15, 15);
|
Application::getInstance()->getGeometryCache()->renderSphere(sphereRadius, 15, 15);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
0
interface/src/avatar/Avatar.h
Executable file → Normal file
0
interface/src/avatar/Avatar.h
Executable file → Normal file
|
@ -114,7 +114,7 @@ void Hand::render(bool isMine, Model::RenderMode renderMode) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
glColor3f(0.0f, 1.0f, 0.0f);
|
glColor3f(0.0f, 1.0f, 0.0f);
|
||||||
glutSolidSphere(PALM_COLLISION_RADIUS * _owningAvatar->getScale(), 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(PALM_COLLISION_RADIUS * _owningAvatar->getScale(), 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ void Hand::renderHandTargets(bool isMine) {
|
||||||
Avatar::renderJointConnectingCone(root, offsetFromPalm, PALM_DISK_RADIUS, 0.0f);
|
Avatar::renderJointConnectingCone(root, offsetFromPalm, PALM_DISK_RADIUS, 0.0f);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(root.x, root.y, root.z);
|
glTranslatef(root.x, root.y, root.z);
|
||||||
glutSolidSphere(PALM_BALL_RADIUS, 20.0f, 20.0f);
|
Application::getInstance()->getGeometryCache()->renderSphere(PALM_BALL_RADIUS, 20.0f, 20.0f);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
0
interface/src/avatar/Hand.h
Executable file → Normal file
0
interface/src/avatar/Hand.h
Executable file → Normal file
|
@ -399,7 +399,7 @@ void MyAvatar::renderDebugBodyPoints() {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor4f(0, 1, 0, .5f);
|
glColor4f(0, 1, 0, .5f);
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
glutSolidSphere(0.2, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(0.2, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
// Head Sphere
|
// Head Sphere
|
||||||
|
@ -407,7 +407,7 @@ void MyAvatar::renderDebugBodyPoints() {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor4f(0, 1, 0, .5f);
|
glColor4f(0, 1, 0, .5f);
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
glutSolidSphere(0.15, 10, 10);
|
Application::getInstance()->getGeometryCache()->renderSphere(0.15, 10, 10);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -554,9 +554,9 @@ void SkeletonModel::renderRagdoll() {
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
// draw each point as a yellow hexagon with black border
|
// draw each point as a yellow hexagon with black border
|
||||||
glColor4f(0.0f, 0.0f, 0.0f, alpha);
|
glColor4f(0.0f, 0.0f, 0.0f, alpha);
|
||||||
glutSolidSphere(radius2, BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
Application::getInstance()->getGeometryCache()->renderSphere(radius2, BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||||
glColor4f(1.0f, 1.0f, 0.0f, alpha);
|
glColor4f(1.0f, 1.0f, 0.0f, alpha);
|
||||||
glutSolidSphere(radius1, BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
Application::getInstance()->getGeometryCache()->renderSphere(radius1, BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
@ -847,7 +847,7 @@ void SkeletonModel::renderBoundingCollisionShapes(float alpha) {
|
||||||
endPoint = endPoint - _translation;
|
endPoint = endPoint - _translation;
|
||||||
glTranslatef(endPoint.x, endPoint.y, endPoint.z);
|
glTranslatef(endPoint.x, endPoint.y, endPoint.z);
|
||||||
glColor4f(0.6f, 0.6f, 0.8f, alpha);
|
glColor4f(0.6f, 0.6f, 0.8f, alpha);
|
||||||
glutSolidSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
Application::getInstance()->getGeometryCache()->renderSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||||
|
|
||||||
// draw a yellow sphere at the capsule startpoint
|
// draw a yellow sphere at the capsule startpoint
|
||||||
glm::vec3 startPoint;
|
glm::vec3 startPoint;
|
||||||
|
@ -856,7 +856,7 @@ void SkeletonModel::renderBoundingCollisionShapes(float alpha) {
|
||||||
glm::vec3 axis = endPoint - startPoint;
|
glm::vec3 axis = endPoint - startPoint;
|
||||||
glTranslatef(-axis.x, -axis.y, -axis.z);
|
glTranslatef(-axis.x, -axis.y, -axis.z);
|
||||||
glColor4f(0.8f, 0.8f, 0.6f, alpha);
|
glColor4f(0.8f, 0.8f, 0.6f, alpha);
|
||||||
glutSolidSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
Application::getInstance()->getGeometryCache()->renderSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||||
|
|
||||||
// draw a green cylinder between the two points
|
// draw a green cylinder between the two points
|
||||||
glm::vec3 origin(0.0f);
|
glm::vec3 origin(0.0f);
|
||||||
|
@ -889,7 +889,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) {
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
// draw a grey sphere at shape position
|
// draw a grey sphere at shape position
|
||||||
glColor4f(0.75f, 0.75f, 0.75f, alpha);
|
glColor4f(0.75f, 0.75f, 0.75f, alpha);
|
||||||
glutSolidSphere(shape->getBoundingRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
Application::getInstance()->getGeometryCache()->renderSphere(shape->getBoundingRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||||
} else if (shape->getType() == CAPSULE_SHAPE) {
|
} else if (shape->getType() == CAPSULE_SHAPE) {
|
||||||
CapsuleShape* capsule = static_cast<CapsuleShape*>(shape);
|
CapsuleShape* capsule = static_cast<CapsuleShape*>(shape);
|
||||||
|
|
||||||
|
@ -898,8 +898,8 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) {
|
||||||
capsule->getEndPoint(endPoint);
|
capsule->getEndPoint(endPoint);
|
||||||
endPoint = endPoint - simulationTranslation;
|
endPoint = endPoint - simulationTranslation;
|
||||||
glTranslatef(endPoint.x, endPoint.y, endPoint.z);
|
glTranslatef(endPoint.x, endPoint.y, endPoint.z);
|
||||||
glColor4f(0.6f, 0.6f, 0.8f, alpha);
|
glColor4f(0.6f, 0.6f, 0.8f, alpha);
|
||||||
glutSolidSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
Application::getInstance()->getGeometryCache()->renderSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||||
|
|
||||||
// draw a yellow sphere at the capsule startpoint
|
// draw a yellow sphere at the capsule startpoint
|
||||||
glm::vec3 startPoint;
|
glm::vec3 startPoint;
|
||||||
|
@ -907,8 +907,8 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) {
|
||||||
startPoint = startPoint - simulationTranslation;
|
startPoint = startPoint - simulationTranslation;
|
||||||
glm::vec3 axis = endPoint - startPoint;
|
glm::vec3 axis = endPoint - startPoint;
|
||||||
glTranslatef(-axis.x, -axis.y, -axis.z);
|
glTranslatef(-axis.x, -axis.y, -axis.z);
|
||||||
glColor4f(0.8f, 0.8f, 0.6f, alpha);
|
glColor4f(0.8f, 0.8f, 0.6f, alpha);
|
||||||
glutSolidSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
Application::getInstance()->getGeometryCache()->renderSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||||
|
|
||||||
// draw a green cylinder between the two points
|
// draw a green cylinder between the two points
|
||||||
glm::vec3 origin(0.0f);
|
glm::vec3 origin(0.0f);
|
||||||
|
|
|
@ -51,7 +51,7 @@ void DeferredLightingEffect::releaseSimpleProgram() {
|
||||||
|
|
||||||
void DeferredLightingEffect::renderSolidSphere(float radius, int slices, int stacks) {
|
void DeferredLightingEffect::renderSolidSphere(float radius, int slices, int stacks) {
|
||||||
bindSimpleProgram();
|
bindSimpleProgram();
|
||||||
glutSolidSphere(radius, slices, stacks);
|
Application::getInstance()->getGeometryCache()->renderSphere(radius, slices, stacks);
|
||||||
releaseSimpleProgram();
|
releaseSimpleProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,114 @@ void GeometryCache::renderHemisphere(int slices, int stacks) {
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GeometryCache::renderSphere(float radius, int slices, int stacks) {
|
||||||
|
VerticesIndices& vbo = _sphereVBOs[IntPair(slices, stacks)];
|
||||||
|
int vertices = slices * (stacks - 1) + 2;
|
||||||
|
const int NUM_VERTICES_PER_TRIANGLE = 3;
|
||||||
|
const int NUM_TRIANGLES_PER_QUAD = 2;
|
||||||
|
int indices = slices * NUM_TRIANGLES_PER_QUAD * NUM_VERTICES_PER_TRIANGLE * (stacks - 1) + slices * NUM_TRIANGLES_PER_QUAD * NUM_VERTICES_PER_TRIANGLE;
|
||||||
|
if (vbo.first == 0) {
|
||||||
|
const int NUM_COORDS_PER_VERTEX = 3;
|
||||||
|
GLfloat* vertexData = new GLfloat[vertices * NUM_COORDS_PER_VERTEX];
|
||||||
|
GLfloat* vertex = vertexData;
|
||||||
|
|
||||||
|
// south pole
|
||||||
|
*(vertex++) = 0.0f;
|
||||||
|
*(vertex++) = 0.0f;
|
||||||
|
*(vertex++) = -1.0f;
|
||||||
|
|
||||||
|
//add stacks vertices climbing up Y axis
|
||||||
|
for (int i = 1; i < stacks; i++) {
|
||||||
|
float phi = PI * (float)i / (float)(stacks) - PI_OVER_TWO;
|
||||||
|
float z = sinf(phi), radius = cosf(phi);
|
||||||
|
|
||||||
|
for (int j = 0; j < slices; j++) {
|
||||||
|
float theta = TWO_PI * (float)j / (float)slices;
|
||||||
|
|
||||||
|
*(vertex++) = sinf(theta) * radius;
|
||||||
|
*(vertex++) = cosf(theta) * radius;
|
||||||
|
*(vertex++) = z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// north pole
|
||||||
|
*(vertex++) = 0.0f;
|
||||||
|
*(vertex++) = 0.0f;
|
||||||
|
*(vertex++) = 1.0f;
|
||||||
|
|
||||||
|
glGenBuffers(1, &vbo.first);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vbo.first);
|
||||||
|
const int BYTES_PER_VERTEX = NUM_COORDS_PER_VERTEX * sizeof(GLfloat);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, vertices * BYTES_PER_VERTEX, vertexData, GL_STATIC_DRAW);
|
||||||
|
delete[] vertexData;
|
||||||
|
|
||||||
|
GLushort* indexData = new GLushort[indices];
|
||||||
|
GLushort* index = indexData;
|
||||||
|
|
||||||
|
// South cap
|
||||||
|
GLushort bottom = 0;
|
||||||
|
GLushort top = 1;
|
||||||
|
for (int i = 0; i < slices; i++) {
|
||||||
|
*(index++) = bottom;
|
||||||
|
*(index++) = top + i;
|
||||||
|
*(index++) = top + (i + 1) % slices;
|
||||||
|
}
|
||||||
|
|
||||||
|
// (stacks - 2) ribbons
|
||||||
|
for (int i = 0; i < stacks - 2; i++) {
|
||||||
|
bottom = i * slices + 1;
|
||||||
|
top = bottom + slices;
|
||||||
|
for (int j = 0; j < slices; j++) {
|
||||||
|
int next = (j + 1) % slices;
|
||||||
|
|
||||||
|
*(index++) = bottom + j;
|
||||||
|
*(index++) = top + next;
|
||||||
|
*(index++) = top + j;
|
||||||
|
|
||||||
|
*(index++) = bottom + j;
|
||||||
|
*(index++) = bottom + next;
|
||||||
|
*(index++) = top + next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// north cap
|
||||||
|
bottom = (stacks - 2) * slices + 1;
|
||||||
|
top = bottom + slices;
|
||||||
|
for (int i = 0; i < slices; i++) {
|
||||||
|
*(index++) = bottom + i;
|
||||||
|
*(index++) = bottom + (i + 1) % slices;
|
||||||
|
*(index++) = top;
|
||||||
|
}
|
||||||
|
|
||||||
|
glGenBuffers(1, &vbo.second);
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo.second);
|
||||||
|
const int BYTES_PER_INDEX = sizeof(GLushort);
|
||||||
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices * BYTES_PER_INDEX, indexData, GL_STATIC_DRAW);
|
||||||
|
delete[] indexData;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vbo.first);
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo.second);
|
||||||
|
}
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
|
|
||||||
|
glVertexPointer(3, GL_FLOAT, 0, 0);
|
||||||
|
glNormalPointer(GL_FLOAT, 0, 0);
|
||||||
|
|
||||||
|
glPushMatrix();
|
||||||
|
glScalef(radius, radius, radius);
|
||||||
|
glDrawRangeElementsEXT(GL_TRIANGLES, 0, vertices - 1, indices, GL_UNSIGNED_SHORT, 0);
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glDisableClientState(GL_NORMAL_ARRAY);
|
||||||
|
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void GeometryCache::renderSquare(int xDivisions, int yDivisions) {
|
void GeometryCache::renderSquare(int xDivisions, int yDivisions) {
|
||||||
VerticesIndices& vbo = _squareVBOs[IntPair(xDivisions, yDivisions)];
|
VerticesIndices& vbo = _squareVBOs[IntPair(xDivisions, yDivisions)];
|
||||||
int xVertices = xDivisions + 1;
|
int xVertices = xDivisions + 1;
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
virtual ~GeometryCache();
|
virtual ~GeometryCache();
|
||||||
|
|
||||||
void renderHemisphere(int slices, int stacks);
|
void renderHemisphere(int slices, int stacks);
|
||||||
|
void renderSphere(float radius, int slices, int stacks);
|
||||||
void renderSquare(int xDivisions, int yDivisions);
|
void renderSquare(int xDivisions, int yDivisions);
|
||||||
void renderHalfCylinder(int slices, int stacks);
|
void renderHalfCylinder(int slices, int stacks);
|
||||||
void renderGrid(int xDivisions, int yDivisions);
|
void renderGrid(int xDivisions, int yDivisions);
|
||||||
|
@ -67,6 +68,7 @@ private:
|
||||||
typedef QPair<GLuint, GLuint> VerticesIndices;
|
typedef QPair<GLuint, GLuint> VerticesIndices;
|
||||||
|
|
||||||
QHash<IntPair, VerticesIndices> _hemisphereVBOs;
|
QHash<IntPair, VerticesIndices> _hemisphereVBOs;
|
||||||
|
QHash<IntPair, VerticesIndices> _sphereVBOs;
|
||||||
QHash<IntPair, VerticesIndices> _squareVBOs;
|
QHash<IntPair, VerticesIndices> _squareVBOs;
|
||||||
QHash<IntPair, VerticesIndices> _halfCylinderVBOs;
|
QHash<IntPair, VerticesIndices> _halfCylinderVBOs;
|
||||||
QHash<IntPair, QOpenGLBuffer> _gridBuffers;
|
QHash<IntPair, QOpenGLBuffer> _gridBuffers;
|
||||||
|
|
0
interface/src/starfield/Config.h
Executable file → Normal file
0
interface/src/starfield/Config.h
Executable file → Normal file
0
interface/src/starfield/Controller.cpp
Executable file → Normal file
0
interface/src/starfield/Controller.cpp
Executable file → Normal file
0
interface/src/starfield/Controller.h
Executable file → Normal file
0
interface/src/starfield/Controller.h
Executable file → Normal file
0
interface/src/starfield/data/GpuVertex.cpp
Executable file → Normal file
0
interface/src/starfield/data/GpuVertex.cpp
Executable file → Normal file
0
interface/src/starfield/data/GpuVertex.h
Executable file → Normal file
0
interface/src/starfield/data/GpuVertex.h
Executable file → Normal file
0
interface/src/starfield/data/InputVertex.cpp
Executable file → Normal file
0
interface/src/starfield/data/InputVertex.cpp
Executable file → Normal file
0
interface/src/starfield/data/InputVertex.h
Executable file → Normal file
0
interface/src/starfield/data/InputVertex.h
Executable file → Normal file
0
interface/src/starfield/data/Tile.h
Executable file → Normal file
0
interface/src/starfield/data/Tile.h
Executable file → Normal file
0
interface/src/starfield/renderer/Renderer.cpp
Executable file → Normal file
0
interface/src/starfield/renderer/Renderer.cpp
Executable file → Normal file
0
interface/src/starfield/renderer/Renderer.h
Executable file → Normal file
0
interface/src/starfield/renderer/Renderer.h
Executable file → Normal file
0
interface/src/starfield/renderer/Tiling.h
Executable file → Normal file
0
interface/src/starfield/renderer/Tiling.h
Executable file → Normal file
0
interface/src/starfield/renderer/VertexOrder.cpp
Executable file → Normal file
0
interface/src/starfield/renderer/VertexOrder.cpp
Executable file → Normal file
0
interface/src/starfield/renderer/VertexOrder.h
Executable file → Normal file
0
interface/src/starfield/renderer/VertexOrder.h
Executable file → Normal file
|
@ -15,6 +15,7 @@
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include "Sphere3DOverlay.h"
|
#include "Sphere3DOverlay.h"
|
||||||
|
#include "Application.h"
|
||||||
#include "renderer/GlowEffect.h"
|
#include "renderer/GlowEffect.h"
|
||||||
|
|
||||||
Sphere3DOverlay::Sphere3DOverlay() {
|
Sphere3DOverlay::Sphere3DOverlay() {
|
||||||
|
@ -34,7 +35,6 @@ void Sphere3DOverlay::render() {
|
||||||
const float MAX_COLOR = 255.0f;
|
const float MAX_COLOR = 255.0f;
|
||||||
glColor4f(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
glColor4f(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
||||||
|
|
||||||
|
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
|
||||||
glm::vec3 position = getPosition();
|
glm::vec3 position = getPosition();
|
||||||
|
@ -58,7 +58,7 @@ void Sphere3DOverlay::render() {
|
||||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
//Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
//Application::getInstance()->getDeferredLightingEffect()->renderSolidCube(1.0f);
|
||||||
if (_isSolid) {
|
if (_isSolid) {
|
||||||
glutSolidSphere(1.0f, SLICES, SLICES);
|
Application::getInstance()->getGeometryCache()->renderSphere(1.0f, SLICES, SLICES);
|
||||||
} else {
|
} else {
|
||||||
glutWireSphere(1.0f, SLICES, SLICES);
|
glutWireSphere(1.0f, SLICES, SLICES);
|
||||||
}
|
}
|
||||||
|
|
0
libraries/avatars/src/AvatarData.h
Executable file → Normal file
0
libraries/avatars/src/AvatarData.h
Executable file → Normal file
0
libraries/avatars/src/HandData.h
Executable file → Normal file
0
libraries/avatars/src/HandData.h
Executable file → Normal file
0
libraries/embedded-webserver/src/HTTPConnection.cpp
Executable file → Normal file
0
libraries/embedded-webserver/src/HTTPConnection.cpp
Executable file → Normal file
0
libraries/embedded-webserver/src/HTTPManager.cpp
Executable file → Normal file
0
libraries/embedded-webserver/src/HTTPManager.cpp
Executable file → Normal file
0
libraries/embedded-webserver/src/HTTPManager.h
Executable file → Normal file
0
libraries/embedded-webserver/src/HTTPManager.h
Executable file → Normal file
0
libraries/octree/src/Plane.cpp
Executable file → Normal file
0
libraries/octree/src/Plane.cpp
Executable file → Normal file
0
libraries/octree/src/Plane.h
Executable file → Normal file
0
libraries/octree/src/Plane.h
Executable file → Normal file
0
tools/samples/cube1.hio
Executable file → Normal file
0
tools/samples/cube1.hio
Executable file → Normal file
0
tools/samples/oneRedVoxel.hio
Executable file → Normal file
0
tools/samples/oneRedVoxel.hio
Executable file → Normal file
0
tools/samples/single.hio
Executable file → Normal file
0
tools/samples/single.hio
Executable file → Normal file
Loading…
Reference in a new issue