mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 13:33:38 +02:00
fix formatting and syntax issues
This commit is contained in:
parent
bd5c6517a5
commit
4f26c9e0fa
7 changed files with 36 additions and 33 deletions
|
@ -884,11 +884,11 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
|||
|
||||
case Qt::Key_W:
|
||||
if (isOption && !isShifted && !isMeta) {
|
||||
Menu::getInstance()->triggerOption(MenuOption::Wireframe);
|
||||
Menu::getInstance()->triggerOption(MenuOption::Wireframe);
|
||||
} else {
|
||||
_myAvatar->setDriveKeys(FWD, 1.f);
|
||||
}
|
||||
break;
|
||||
_myAvatar->setDriveKeys(FWD, 1.f);
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_S:
|
||||
if (isShifted && isMeta && !isOption) {
|
||||
|
@ -2906,7 +2906,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
|
|||
// draw a red sphere
|
||||
float originSphereRadius = 0.05f;
|
||||
glColor3f(1,0,0);
|
||||
_geometryCache.renderSphere(originSphereRadius, 15, 15);
|
||||
_geometryCache.renderSphere(originSphereRadius, 15, 15);
|
||||
|
||||
// draw the audio reflector overlay
|
||||
{
|
||||
|
|
|
@ -172,7 +172,7 @@ void BuckyBalls::render() {
|
|||
}
|
||||
glPushMatrix();
|
||||
glTranslatef(_bballPosition[i].x, _bballPosition[i].y, _bballPosition[i].z);
|
||||
Application::getInstance()->getGeometryCache()->renderSphere(_bballRadius[i], 15, 15);
|
||||
Application::getInstance()->getGeometryCache()->renderSphere(_bballRadius[i], 15, 15);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,5 +266,5 @@ void Environment::renderAtmosphere(Camera& camera, const EnvironmentData& data)
|
|||
|
||||
program->release();
|
||||
|
||||
glPopMatrix();
|
||||
glPopMatrix();
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ void Hand::render(bool isMine, Model::RenderMode renderMode) {
|
|||
glPushMatrix();
|
||||
glTranslatef(position.x, position.y, position.z);
|
||||
glColor3f(0.0f, 1.0f, 0.0f);
|
||||
Application::getInstance()->getGeometryCache()->renderSphere(PALM_COLLISION_RADIUS * _owningAvatar->getScale(), 10, 10);
|
||||
Application::getInstance()->getGeometryCache()->renderSphere(PALM_COLLISION_RADIUS * _owningAvatar->getScale(), 10, 10);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -899,7 +899,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) {
|
|||
endPoint = endPoint - simulationTranslation;
|
||||
glTranslatef(endPoint.x, endPoint.y, endPoint.z);
|
||||
glColor4f(0.6f, 0.6f, 0.8f, alpha);
|
||||
Application::getInstance()->getGeometryCache()->renderSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||
Application::getInstance()->getGeometryCache()->renderSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||
|
||||
// draw a yellow sphere at the capsule startpoint
|
||||
glm::vec3 startPoint;
|
||||
|
@ -908,7 +908,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) {
|
|||
glm::vec3 axis = endPoint - startPoint;
|
||||
glTranslatef(-axis.x, -axis.y, -axis.z);
|
||||
glColor4f(0.8f, 0.8f, 0.6f, alpha);
|
||||
Application::getInstance()->getGeometryCache()->renderSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||
Application::getInstance()->getGeometryCache()->renderSphere(capsule->getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||
|
||||
// draw a green cylinder between the two points
|
||||
glm::vec3 origin(0.0f);
|
||||
|
|
|
@ -51,7 +51,7 @@ void DeferredLightingEffect::releaseSimpleProgram() {
|
|||
|
||||
void DeferredLightingEffect::renderSolidSphere(float radius, int slices, int stacks) {
|
||||
bindSimpleProgram();
|
||||
Application::getInstance()->getGeometryCache()->renderSphere(radius, slices, stacks);
|
||||
Application::getInstance()->getGeometryCache()->renderSphere(radius, slices, stacks);
|
||||
releaseSimpleProgram();
|
||||
}
|
||||
|
||||
|
|
|
@ -114,17 +114,20 @@ void GeometryCache::renderHemisphere(int slices, int stacks) {
|
|||
void GeometryCache::renderSphere(float radius, int slices, int stacks) {
|
||||
VerticesIndices& vbo = _sphereVBOs[IntPair(slices, stacks)];
|
||||
int vertices = slices * (stacks - 1) + 2;
|
||||
int indices = slices * 2 * 3 * (stacks - 1) + slices * 2 * 3;
|
||||
if (vbo.first == 0) {
|
||||
GLfloat* vertexData = new GLfloat[vertices * 3];
|
||||
int numVerticesPerTriangle = 3;
|
||||
int numTrianglesPerQuad = 2;
|
||||
int indices = slices * numTrianglesPerQuad * numVerticesPerTriangle * (stacks - 1) + slices * numTrianglesPerQuad * numVerticesPerTriangle;
|
||||
if (vbo.first == 0) {
|
||||
int numCoordinatesPerVertex = 3;
|
||||
GLfloat* vertexData = new GLfloat[vertices * numCoordinatesPerVertex];
|
||||
GLfloat* vertex = vertexData;
|
||||
|
||||
// south pole
|
||||
*(vertex++) = 0.0f;
|
||||
|
||||
// south pole
|
||||
*(vertex++) = 0.0f;
|
||||
*(vertex++) = 0.0f;
|
||||
*(vertex++) = -1.0f;
|
||||
|
||||
//add stacks vertices climbing up Y axis
|
||||
//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);
|
||||
|
@ -138,31 +141,31 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks) {
|
|||
}
|
||||
}
|
||||
|
||||
// north pole
|
||||
*(vertex++) = 0.0f;
|
||||
// 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 = 3 * sizeof(GLfloat);
|
||||
const int BYTES_PER_VERTEX = numCoordinatesPerVertex * 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;
|
||||
|
||||
// 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++) {
|
||||
|
||||
// (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++) {
|
||||
|
@ -178,8 +181,8 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks) {
|
|||
}
|
||||
}
|
||||
|
||||
// north cap
|
||||
bottom = (stacks - 2) * slices + 1;
|
||||
// north cap
|
||||
bottom = (stacks - 2) * slices + 1;
|
||||
top = bottom + slices;
|
||||
for (int i = 0; i < slices; i++) {
|
||||
*(index++) = bottom + i;
|
||||
|
@ -199,12 +202,12 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks) {
|
|||
}
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, 0, 0);
|
||||
glNormalPointer(GL_FLOAT, 0, 0);
|
||||
|
||||
glPushMatrix();
|
||||
glScalef(radius, radius, radius);
|
||||
|
||||
glPushMatrix();
|
||||
glScalef(radius, radius, radius);
|
||||
glDrawRangeElementsEXT(GL_TRIANGLES, 0, vertices - 1, indices, GL_UNSIGNED_SHORT, 0);
|
||||
glPopMatrix();
|
||||
|
||||
|
|
Loading…
Reference in a new issue