mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 03:04:33 +02:00
We can't initialize avatars from the network thread; they need access to the
OpenGL context.
This commit is contained in:
parent
82c1ee2062
commit
ad377e6256
3 changed files with 11 additions and 3 deletions
|
@ -1083,6 +1083,9 @@ void Application::idle() {
|
|||
for(AgentList::iterator agent = agentList->begin(); agent != agentList->end(); agent++) {
|
||||
if (agent->getLinkedData() != NULL) {
|
||||
Avatar *avatar = (Avatar *)agent->getLinkedData();
|
||||
if (!avatar->isInitialized()) {
|
||||
avatar->init();
|
||||
}
|
||||
avatar->simulate(deltaTime, NULL);
|
||||
avatar->setMouseRay(mouseRayOrigin, mouseRayDirection);
|
||||
}
|
||||
|
@ -2061,6 +2064,9 @@ void Application::displaySide(Camera& whichCamera) {
|
|||
for (AgentList::iterator agent = agentList->begin(); agent != agentList->end(); agent++) {
|
||||
if (agent->getLinkedData() != NULL && agent->getType() == AGENT_TYPE_AVATAR) {
|
||||
Avatar *avatar = (Avatar *)agent->getLinkedData();
|
||||
if (!avatar->isInitialized()) {
|
||||
avatar->init();
|
||||
}
|
||||
avatar->render(false);
|
||||
}
|
||||
}
|
||||
|
@ -2534,9 +2540,7 @@ QAction* Application::checkedVoxelModeAction() const {
|
|||
|
||||
void Application::attachNewHeadToAgent(Agent* newAgent) {
|
||||
if (newAgent->getLinkedData() == NULL) {
|
||||
Avatar* newAvatar = new Avatar(newAgent);
|
||||
newAvatar->init();
|
||||
newAgent->setLinkedData(newAvatar);
|
||||
newAgent->setLinkedData(new Avatar(newAgent));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ float chatMessageHeight = 0.20;
|
|||
|
||||
Avatar::Avatar(Agent* owningAgent) :
|
||||
AvatarData(owningAgent),
|
||||
_initialized(false),
|
||||
_head(this),
|
||||
_ballSpringsInitialized(false),
|
||||
_TEST_bigSphereRadius(0.5f),
|
||||
|
@ -266,6 +267,7 @@ Avatar::~Avatar() {
|
|||
|
||||
void Avatar::init() {
|
||||
_voxels.init();
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
void Avatar::reset() {
|
||||
|
|
|
@ -100,6 +100,7 @@ public:
|
|||
void setOrientation (const glm::quat& orientation);
|
||||
|
||||
//getters
|
||||
bool isInitialized () const { return _initialized;}
|
||||
const Skeleton& getSkeleton () const { return _skeleton;}
|
||||
float getHeadYawRate () const { return _head.yawRate;}
|
||||
float getBodyYaw () const { return _bodyYaw;}
|
||||
|
@ -156,6 +157,7 @@ private:
|
|||
float touchForce; // a scalar determining the amount that the cursor (or hand) is penetrating the ball
|
||||
};
|
||||
|
||||
bool _initialized;
|
||||
Head _head;
|
||||
Skeleton _skeleton;
|
||||
bool _ballSpringsInitialized;
|
||||
|
|
Loading…
Reference in a new issue