mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 02:53:43 +02:00
some preliminary work on avatarRenderer
This commit is contained in:
parent
bbeac7701a
commit
7f0d2e572e
6 changed files with 43 additions and 38 deletions
|
@ -302,7 +302,6 @@ void Application::paintGL() {
|
|||
_myCamera.setTargetRotation(_myAvatar.getBodyYaw() - 180.0f,
|
||||
0.0f,
|
||||
0.0f);
|
||||
|
||||
} else {
|
||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
|
||||
_myCamera.setTargetPosition(_myAvatar.getSpringyHeadPosition());
|
||||
|
@ -1635,6 +1634,7 @@ void Application::displaySide(Camera& whichCamera) {
|
|||
|
||||
// Render my own Avatar
|
||||
_myAvatar.render(_lookingInMirror, _myCamera.getPosition());
|
||||
//_avatarRenderer.render();
|
||||
}
|
||||
|
||||
// Render the world box
|
||||
|
|
|
@ -186,6 +186,9 @@ private:
|
|||
Oscilloscope _audioScope;
|
||||
|
||||
Avatar _myAvatar; // The rendered avatar of oneself
|
||||
|
||||
//AvatarRenderer _avatarRenderer;
|
||||
|
||||
Camera _myCamera; // My view onto the world
|
||||
Camera _viewFrustumOffsetCamera; // The camera we use to sometimes show the view frustum from an offset mode
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ bool usingBigSphereCollisionTest = true;
|
|||
float chatMessageScale = 0.0015;
|
||||
float chatMessageHeight = 0.45;
|
||||
|
||||
|
||||
Avatar::Avatar(bool isMine) {
|
||||
_orientation.setToIdentity();
|
||||
|
||||
|
@ -691,19 +692,6 @@ void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) {
|
|||
|
||||
_cameraPosition = cameraPosition; // store this for use in various parts of the code
|
||||
|
||||
// render a simple round on the ground projected down from the avatar's position
|
||||
renderDiskShadow(_position, glm::vec3(0.0f, 1.0f, 0.0f), 0.1f, 0.2f);
|
||||
|
||||
/*
|
||||
// show avatar position
|
||||
glColor4f(0.5f, 0.5f, 0.5f, 0.6);
|
||||
glPushMatrix();
|
||||
glTranslatef(_position.x, _position.y, _position.z);
|
||||
glScalef(0.03, 0.03, 0.03);
|
||||
glutSolidSphere(1, 10, 10);
|
||||
glPopMatrix();
|
||||
*/
|
||||
|
||||
if (usingBigSphereCollisionTest) {
|
||||
// show TEST big sphere
|
||||
glColor4f(0.5f, 0.6f, 0.8f, 0.7);
|
||||
|
@ -714,10 +702,12 @@ void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) {
|
|||
glPopMatrix();
|
||||
}
|
||||
|
||||
// render a simple round on the ground projected down from the avatar's position
|
||||
renderDiskShadow(_position, glm::vec3(0.0f, 1.0f, 0.0f), 0.1f, 0.2f);
|
||||
|
||||
//render body
|
||||
renderBody(lookingInMirror);
|
||||
|
||||
|
||||
// if this is my avatar, then render my interactions with the other avatar
|
||||
if (_isMine) {
|
||||
_avatarTouch.render(_cameraPosition);
|
||||
|
@ -1038,10 +1028,12 @@ void Avatar::updateBodySprings(float deltaTime) {
|
|||
_joint[b].springyVelocity = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
/*
|
||||
//apply forces from touch...
|
||||
if (_joint[b].touchForce > 0.0) {
|
||||
_joint[b].springyVelocity += _mouseRayDirection * _joint[b].touchForce * 0.7f;
|
||||
}
|
||||
*/
|
||||
|
||||
//update position by velocity...
|
||||
_joint[b].springyPosition += _joint[b].springyVelocity * deltaTime;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <Orientation.h>
|
||||
#include "world.h"
|
||||
#include "AvatarTouch.h"
|
||||
#include "AvatarRenderer.h"
|
||||
#include "InterfaceConfig.h"
|
||||
#include "SerialInterface.h"
|
||||
#include "Balls.h"
|
||||
|
|
|
@ -10,54 +10,61 @@
|
|||
#include "AvatarRenderer.h"
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
/*
|
||||
AvatarRenderer::AvatarRenderer() {
|
||||
}
|
||||
|
||||
// this method renders the avatar
|
||||
void AvatarRenderer::render(Avatar *avatarToRender, bool lookingInMirror, glm::vec3 cameraPosition) {
|
||||
void AvatarRenderer::render() {
|
||||
|
||||
avatar = avatarToRender;
|
||||
|
||||
/*
|
||||
// show avatar position
|
||||
glColor4f(0.5f, 0.5f, 0.5f, 0.6);
|
||||
glPushMatrix();
|
||||
glm::vec3 j( avatar->getJointPosition( AVATAR_JOINT_PELVIS ) );
|
||||
glm::vec3 j( getJointPosition( AVATAR_JOINT_PELVIS ) );
|
||||
glTranslatef(j.x, j.y, j.z);
|
||||
glScalef(0.08, 0.08, 0.08);
|
||||
glutSolidSphere(1, 10, 10);
|
||||
glPopMatrix();
|
||||
*/
|
||||
|
||||
//renderDiskShadow(avatar->getJointPosition( AVATAR_JOINT_PELVIS ), glm::vec3(0.0f, 1.0f, 0.0f), 0.1f, 0.2f);
|
||||
renderDiskShadow(getJointPosition( AVATAR_JOINT_PELVIS ), glm::vec3(0.0f, 1.0f, 0.0f), 0.1f, 0.2f);
|
||||
|
||||
//renderBody();
|
||||
//renderBody(lookingInMirror);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void AvatarRenderer::renderBody() {
|
||||
/*
|
||||
// Render joint positions as spheres
|
||||
for (int b = 0; b < NUM_AVATAR_JOINTS; b++) {
|
||||
|
||||
if (b != AVATAR_JOINT_HEAD_BASE) { // the head is rendered as a special case in "renderHead"
|
||||
if (b == AVATAR_JOINT_HEAD_BASE) { // the head is rendered as a special case
|
||||
if (_displayingHead) {
|
||||
_head.render(lookingInMirror);
|
||||
}
|
||||
} else {
|
||||
|
||||
//show direction vectors of the bone orientation
|
||||
//renderOrientationDirections(_joint[b].springyPosition, _joint[b].orientation, _joint[b].radius * 2.0);
|
||||
|
||||
glm::vec3 j( avatar->getJointPosition( AVATAR_JOINT_PELVIS ) );
|
||||
glColor3fv(skinColor);
|
||||
glColor3fv(_avatar->skinColor);
|
||||
glPushMatrix();
|
||||
glTranslatef(j.x, j.y, j.z);
|
||||
glutSolidSphere(_joint[b].radius, 20.0f, 20.0f);
|
||||
glTranslatef(_avatar->[b].springyPosition.x, _avatar->_joint[b].springyPosition.y, _avatar->_joint[b].springyPosition.z);
|
||||
glutSolidSphere(_avatar->_joint[b].radius, 20.0f, 20.0f);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
if (_joint[b].touchForce > 0.0f) {
|
||||
|
||||
float alpha = _joint[b].touchForce * 0.2;
|
||||
float r = _joint[b].radius * 1.1f + 0.005f;
|
||||
glColor4f(0.5f, 0.2f, 0.2f, alpha);
|
||||
glPushMatrix();
|
||||
glTranslatef(_joint[b].springyPosition.x, _joint[b].springyPosition.y, _joint[b].springyPosition.z);
|
||||
glScalef(r, r, r);
|
||||
glutSolidSphere(1, 20, 20);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Render lines connecting the joint positions
|
||||
glColor3f(0.4f, 0.5f, 0.6f);
|
||||
glLineWidth(3.0);
|
||||
|
@ -71,5 +78,6 @@ void AvatarRenderer::renderBody() {
|
|||
glEnd();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -11,16 +11,17 @@
|
|||
#include "Avatar.h"
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class AvatarRenderer {
|
||||
/*
|
||||
class AvatarRenderer : public Avatar {
|
||||
public:
|
||||
|
||||
AvatarRenderer();
|
||||
void render(Avatar *avatarToRender, bool lookingInMirror, glm::vec3 cameraPosition );
|
||||
void render();
|
||||
|
||||
private:
|
||||
|
||||
Avatar *avatar;
|
||||
void renderBody();
|
||||
};
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue