mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 10:48:15 +02:00
hair is a separate class
This commit is contained in:
parent
2e2d03c58b
commit
f072c04b4c
5 changed files with 86 additions and 0 deletions
35
interface/src/Hair.cpp
Normal file
35
interface/src/Hair.cpp
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// Hair.cpp
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by Philip on June 26, 2014
|
||||||
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
// Creates single flexible vertlet-integrated strands that can be used for hair/fur/grass
|
||||||
|
|
||||||
|
#include "Hair.h"
|
||||||
|
|
||||||
|
#include "Util.h"
|
||||||
|
#include "world.h"
|
||||||
|
|
||||||
|
|
||||||
|
Hair::Hair() {
|
||||||
|
qDebug() << "Creating Hair";
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hair::simulate(float deltaTime) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hair::render() {
|
||||||
|
//
|
||||||
|
// Before calling this function, translate/rotate to the origin of the owning object
|
||||||
|
glPushMatrix();
|
||||||
|
glColor3f(1.0f, 1.0f, 0.0f);
|
||||||
|
glutSolidSphere(1.0f, 15, 15);
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
35
interface/src/Hair.h
Normal file
35
interface/src/Hair.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// Hair.h
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by Philip on June 26, 2014
|
||||||
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_Hair_h
|
||||||
|
#define hifi_Hair_h
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
|
#include "GeometryUtil.h"
|
||||||
|
#include "InterfaceConfig.h"
|
||||||
|
#include "Util.h"
|
||||||
|
|
||||||
|
|
||||||
|
class Hair {
|
||||||
|
public:
|
||||||
|
Hair();
|
||||||
|
void simulate(float deltaTime);
|
||||||
|
void render();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_Hair_h
|
|
@ -143,6 +143,11 @@ void Avatar::simulate(float deltaTime) {
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) {
|
||||||
simulateHair(deltaTime);
|
simulateHair(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (Hair* hair, _hairs) {
|
||||||
|
hair->simulate(deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update position by velocity, and subtract the change added earlier for gravity
|
// update position by velocity, and subtract the change added earlier for gravity
|
||||||
|
@ -380,6 +385,9 @@ void Avatar::renderBody(RenderMode renderMode, float glowLevel) {
|
||||||
getHead()->render(1.0f, modelRenderMode);
|
getHead()->render(1.0f, modelRenderMode);
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) {
|
||||||
renderHair();
|
renderHair();
|
||||||
|
foreach (Hair* hair, _hairs) {
|
||||||
|
hair->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <AvatarData.h>
|
#include <AvatarData.h>
|
||||||
|
|
||||||
|
#include "Hair.h"
|
||||||
#include "Hand.h"
|
#include "Hand.h"
|
||||||
#include "Head.h"
|
#include "Head.h"
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
@ -159,6 +160,7 @@ signals:
|
||||||
void collisionWithAvatar(const QUuid& myUUID, const QUuid& theirUUID, const CollisionInfo& collision);
|
void collisionWithAvatar(const QUuid& myUUID, const QUuid& theirUUID, const CollisionInfo& collision);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
QVector<Hair*> _hairs;
|
||||||
SkeletonModel _skeletonModel;
|
SkeletonModel _skeletonModel;
|
||||||
QVector<Model*> _attachmentModels;
|
QVector<Model*> _attachmentModels;
|
||||||
float _bodyYawDelta;
|
float _bodyYawDelta;
|
||||||
|
|
|
@ -199,6 +199,9 @@ void MyAvatar::simulate(float deltaTime) {
|
||||||
PerformanceTimer perfTimer("MyAvatar::simulate/hair Simulate");
|
PerformanceTimer perfTimer("MyAvatar::simulate/hair Simulate");
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) {
|
||||||
simulateHair(deltaTime);
|
simulateHair(deltaTime);
|
||||||
|
foreach (Hair* hair, _hairs) {
|
||||||
|
hair->simulate(deltaTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,6 +863,9 @@ void MyAvatar::renderBody(RenderMode renderMode, float glowLevel) {
|
||||||
getHead()->render(1.0f, modelRenderMode);
|
getHead()->render(1.0f, modelRenderMode);
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) {
|
||||||
renderHair();
|
renderHair();
|
||||||
|
foreach (Hair* hair, _hairs) {
|
||||||
|
hair->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getHand()->render(true, modelRenderMode);
|
getHand()->render(true, modelRenderMode);
|
||||||
|
|
Loading…
Reference in a new issue