mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-08 01:50:06 +02:00
Head will always render when body does - no decapitation
This commit is contained in:
parent
f961a40d1c
commit
59ac5ebd66
3 changed files with 22 additions and 14 deletions
|
@ -1135,7 +1135,7 @@ void Avatar::renderBody(bool lookingInMirror) {
|
|||
float distanceToCamera = glm::length(getCameraPosition() - _joint[b].position);
|
||||
// Always render other people, and render myself when beyond threshold distance
|
||||
if (b == AVATAR_JOINT_HEAD_BASE) { // the head is rendered as a special case
|
||||
if (lookingInMirror || !_isMine || distanceToCamera > RENDER_OPAQUE_BEYOND) {
|
||||
if (lookingInMirror || !_isMine || distanceToCamera > RENDER_TRANSLUCENT_BEYOND) {
|
||||
_head.render(lookingInMirror);
|
||||
}
|
||||
} else if (!_isMine || distanceToCamera > RENDER_TRANSLUCENT_BEYOND) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "Util.h"
|
||||
#include <vector>
|
||||
#include <lodepng.h>
|
||||
#include <AgentList.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -55,8 +56,9 @@ Head::Head() :
|
|||
_returnSpringScale(1.0f),
|
||||
_bodyRotation(0.0f, 0.0f, 0.0f),
|
||||
_headRotation(0.0f, 0.0f, 0.0f),
|
||||
_renderLookatVectors(false) {
|
||||
createMohawk();
|
||||
_renderLookatVectors(false),
|
||||
_mohawkExists(false)
|
||||
{
|
||||
}
|
||||
|
||||
void Head::reset() {
|
||||
|
@ -190,6 +192,7 @@ void Head::render(bool lookingInMirror) {
|
|||
}
|
||||
|
||||
void Head::createMohawk() {
|
||||
// int agentId = AgentList::getInstance()
|
||||
float height = 0.05f + randFloat() * 0.10f;
|
||||
float variance = 0.05 + randFloat() * 0.05f;
|
||||
const float RAD_PER_TRIANGLE = (2.3f + randFloat() * 0.2f) / (float)MOHAWK_TRIANGLES;
|
||||
|
@ -207,21 +210,25 @@ void Head::createMohawk() {
|
|||
_mohawkColors[i] = randFloat() * basicColor;
|
||||
|
||||
}
|
||||
|
||||
_mohawkExists = true;
|
||||
}
|
||||
|
||||
void Head::renderMohawk() {
|
||||
glPushMatrix();
|
||||
glTranslatef(_position.x, _position.y, _position.z);
|
||||
glRotatef(_bodyRotation.y, 0, 1, 0);
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
for (int i = 0; i < MOHAWK_TRIANGLES; i++) {
|
||||
glColor3f(_mohawkColors[i].x, _mohawkColors[i].y, _mohawkColors[i].z);
|
||||
glVertex3fv(&_mohawkTriangleFan[i].x);
|
||||
glNormal3fv(&_mohawkColors[i].x);
|
||||
if (!_mohawkExists) {
|
||||
createMohawk();
|
||||
} else {
|
||||
glPushMatrix();
|
||||
glTranslatef(_position.x, _position.y, _position.z);
|
||||
glRotatef(_bodyRotation.y, 0, 1, 0);
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
for (int i = 0; i < MOHAWK_TRIANGLES; i++) {
|
||||
glColor3f(_mohawkColors[i].x, _mohawkColors[i].y, _mohawkColors[i].z);
|
||||
glVertex3fv(&_mohawkTriangleFan[i].x);
|
||||
glNormal3fv(&_mohawkColors[i].x);
|
||||
}
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
}
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ private:
|
|||
bool _renderLookatVectors;
|
||||
glm::vec3* _mohawkTriangleFan;
|
||||
glm::vec3* _mohawkColors;
|
||||
bool _mohawkExists;
|
||||
|
||||
// private methods
|
||||
void createMohawk();
|
||||
|
|
Loading…
Reference in a new issue