diff --git a/interface/src/Hair.cpp b/interface/src/Hair.cpp new file mode 100644 index 0000000000..a23312eba1 --- /dev/null +++ b/interface/src/Hair.cpp @@ -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(); +} + + diff --git a/interface/src/Hair.h b/interface/src/Hair.h new file mode 100644 index 0000000000..e4dc3778c3 --- /dev/null +++ b/interface/src/Hair.h @@ -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 + +#include +#include + +#include "GeometryUtil.h" +#include "InterfaceConfig.h" +#include "Util.h" + + +class Hair { +public: + Hair(); + void simulate(float deltaTime); + void render(); + +private: + + }; + +#endif // hifi_Hair_h diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 5a294bb2a5..769d0398a2 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -143,6 +143,11 @@ void Avatar::simulate(float deltaTime) { if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) { simulateHair(deltaTime); } + + foreach (Hair* hair, _hairs) { + hair->simulate(deltaTime); + } + } // 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); if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) { renderHair(); + foreach (Hair* hair, _hairs) { + hair->render(); + } } } diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index f20db1019d..369cd7e688 100755 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -19,6 +19,7 @@ #include +#include "Hair.h" #include "Hand.h" #include "Head.h" #include "InterfaceConfig.h" @@ -159,6 +160,7 @@ signals: void collisionWithAvatar(const QUuid& myUUID, const QUuid& theirUUID, const CollisionInfo& collision); protected: + QVector _hairs; SkeletonModel _skeletonModel; QVector _attachmentModels; float _bodyYawDelta; diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 7367f64d73..cfdf7e057a 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -199,6 +199,9 @@ void MyAvatar::simulate(float deltaTime) { PerformanceTimer perfTimer("MyAvatar::simulate/hair Simulate"); if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) { 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); if (Menu::getInstance()->isOptionChecked(MenuOption::StringHair)) { renderHair(); + foreach (Hair* hair, _hairs) { + hair->render(); + } } } getHand()->render(true, modelRenderMode);