more work on making avatar models (face included) use render payloads

This commit is contained in:
ZappoMan 2015-06-02 22:10:00 -07:00
parent 647d132d57
commit a7feca0727
5 changed files with 21 additions and 23 deletions

View file

@ -520,13 +520,17 @@ glm::quat Avatar::computeRotationFromBodyToWorldUp(float proportion) const {
void Avatar::renderBody(RenderArgs* renderArgs, ViewFrustum* renderFrustum, bool postLighting, float glowLevel) { void Avatar::renderBody(RenderArgs* renderArgs, ViewFrustum* renderFrustum, bool postLighting, float glowLevel) {
// check to see if when we added our models to the scene they were ready, if they were not ready, then // check to see if when we added our models to the scene they were ready, if they were not ready, then
// fix them up in the scene // fix them up in the scene
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
render::PendingChanges pendingChanges;
if (_skeletonModel.needsFixupInScene()) { if (_skeletonModel.needsFixupInScene()) {
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
render::PendingChanges pendingChanges;
_skeletonModel.removeFromScene(scene, pendingChanges); _skeletonModel.removeFromScene(scene, pendingChanges);
_skeletonModel.addToScene(scene, pendingChanges); _skeletonModel.addToScene(scene, pendingChanges);
scene->enqueuePendingChanges(pendingChanges);
} }
if (getHead()->getFaceModel().needsFixupInScene()) {
getHead()->getFaceModel().removeFromScene(scene, pendingChanges);
getHead()->getFaceModel().addToScene(scene, pendingChanges);
}
scene->enqueuePendingChanges(pendingChanges);
{ {
Glower glower(renderArgs, glowLevel); Glower glower(renderArgs, glowLevel);

View file

@ -40,17 +40,6 @@ class Hand : public HandData {
public: public:
Hand(Avatar* owningAvatar); Hand(Avatar* owningAvatar);
struct HandBall
{
glm::vec3 position; // the actual dynamic position of the ball at any given time
glm::quat rotation; // the rotation of the ball
glm::vec3 velocity; // the velocity of the ball
float radius; // the radius of the ball
bool isCollidable; // whether or not the ball responds to collisions
bool isColliding; // ball is currently colliding
float touchForce; // a scalar determining the amount that the cursor (or hand) is penetrating the ball
};
void simulate(float deltaTime, bool isMine); void simulate(float deltaTime, bool isMine);
void render(RenderArgs* renderArgs, bool isMine); void render(RenderArgs* renderArgs, bool isMine);

View file

@ -1178,13 +1178,17 @@ void MyAvatar::renderBody(RenderArgs* renderArgs, ViewFrustum* renderFrustum, bo
// check to see if when we added our models to the scene they were ready, if they were not ready, then // check to see if when we added our models to the scene they were ready, if they were not ready, then
// fix them up in the scene // fix them up in the scene
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
render::PendingChanges pendingChanges;
if (_skeletonModel.needsFixupInScene()) { if (_skeletonModel.needsFixupInScene()) {
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
render::PendingChanges pendingChanges;
_skeletonModel.removeFromScene(scene, pendingChanges); _skeletonModel.removeFromScene(scene, pendingChanges);
_skeletonModel.addToScene(scene, pendingChanges); _skeletonModel.addToScene(scene, pendingChanges);
scene->enqueuePendingChanges(pendingChanges);
} }
if (getHead()->getFaceModel().needsFixupInScene()) {
getHead()->getFaceModel().removeFromScene(scene, pendingChanges);
getHead()->getFaceModel().addToScene(scene, pendingChanges);
}
scene->enqueuePendingChanges(pendingChanges);
Camera *camera = Application::getInstance()->getCamera(); Camera *camera = Application::getInstance()->getCamera();
const glm::vec3 cameraPos = camera->getPosition(); const glm::vec3 cameraPos = camera->getPosition();

View file

@ -501,7 +501,7 @@ void EntityTreeRenderer::render(RenderArgs* renderArgs) {
_viewState->getShadowViewFrustum() : _viewState->getCurrentViewFrustum(); _viewState->getShadowViewFrustum() : _viewState->getCurrentViewFrustum();
// Setup batch transform matrices // Setup batch transform matrices
gpu::Batch batch; gpu::Batch batch; // FIX ME - this is very suspicious!
glm::mat4 projMat; glm::mat4 projMat;
Transform viewMat; Transform viewMat;
frustum->evalProjectionMatrix(projMat); frustum->evalProjectionMatrix(projMat);
@ -509,7 +509,7 @@ void EntityTreeRenderer::render(RenderArgs* renderArgs) {
batch.setProjectionTransform(projMat); batch.setProjectionTransform(projMat);
batch.setViewTransform(viewMat); batch.setViewTransform(viewMat);
renderArgs->_batch = &batch; renderArgs->_batch = &batch; // FIX ME - this is very suspicious!
_tree->lockForRead(); _tree->lockForRead();
@ -525,6 +525,7 @@ void EntityTreeRenderer::render(RenderArgs* renderArgs) {
Model::endScene(renderArgs); Model::endScene(renderArgs);
_tree->unlock(); _tree->unlock();
// FIX ME - this is very suspicious!
// glPushMatrix(); // glPushMatrix();
// renderArgs->_context->render(batch); // renderArgs->_context->render(batch);
// glPopMatrix(); // glPopMatrix();

View file

@ -2269,13 +2269,13 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran
_transforms.push_back(Transform()); _transforms.push_back(Transform());
} }
// _transforms[0] = _viewState->getViewTransform(); // _transforms[0] = _viewState->getViewTransform();
// args->_viewFrustum->evalViewTransform(_transforms[0]); // args->_viewFrustum->evalViewTransform(_transforms[0]);
// apply entity translation offset to the viewTransform in one go (it's a preTranslate because viewTransform goes from world to eye space) // apply entity translation offset to the viewTransform in one go (it's a preTranslate because viewTransform goes from world to eye space)
// _transforms[0].setTranslation(_translation); // _transforms[0].setTranslation(_translation);
// batch.setViewTransform(_transforms[0]); // batch.setViewTransform(_transforms[0]);
// const float OPAQUE_ALPHA_THRESHOLD = 0.5f; // const float OPAQUE_ALPHA_THRESHOLD = 0.5f;