예제 #1
0
DrawBatch::DrawBatch( Viewport *vp, FragmentShader *fs, BLENDTYPE bt, GLuint tx, GLuint primtype, Vec2 tr, Vec2 scl, float r, Mesh *m, bool copy_mesh ) : vf_type(VFTYPE_INVAL), tex(tx), prim_type(primtype), f_shader(fs), blend_type(bt), line_width(0), vb(NULL), ib(NULL), vert_used(0), index_used(0), translate(tr), scale(scl), radrot(r), viewport(vp), perform_transform(true) {
    if(copy_mesh) {
        setupVBIB(m);
        mesh = NULL;
    } else {
        mesh = m;
    }
}
예제 #2
0
void WaterPlane::prepRenderImage( SceneRenderState *state )
{
   PROFILE_SCOPE(WaterPlane_prepRenderImage);

   if( !state->isDiffusePass() )
      return;

   mBasicLighting = dStricmp( LIGHTMGR->getId(), "BLM" ) == 0;
   mUnderwater = isUnderwater( state->getCameraPosition() );

   mMatrixSet->setSceneView(GFX->getWorldMatrix());
   
   const Frustum &frustum = state->getFrustum();

   if ( mPrimBuff.isNull() || 
        mGenerateVB ||         
        frustum != mFrustum )
   {      
      mFrustum = frustum;
      setupVBIB( state );
      mGenerateVB = false;

      MatrixF proj( true );
      MathUtils::getZBiasProjectionMatrix( 0.0001f, mFrustum, &proj );
      mMatrixSet->setSceneProjection(proj);
   }

   _getWaterPlane( state->getCameraPosition(), mWaterPlane, mWaterPos );
   mWaterFogData.plane = mWaterPlane;
   mPlaneReflector.refplane = mWaterPlane;
   updateUnderwaterEffect( state );

   ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
   ri->renderDelegate.bind( this, &WaterObject::renderObject );
   ri->type = RenderPassManager::RIT_Water;
   state->getRenderPass()->addInst( ri );

   //mRenderUpdateCount++;
}
예제 #3
0
DrawBatch::DrawBatch( Viewport *vp, VFTYPE vft, GLuint tx, GLuint primtype, FragmentShader *fs, BLENDTYPE bt, int linew ) : vf_type(vft), tex(tx), prim_type(primtype), f_shader(fs), blend_type(bt), line_width(linew), vert_used(0), index_used(0), mesh(NULL), translate(0,0), scale(8,8), radrot(0), viewport(vp), perform_transform(false) {
    setupVBIB(NULL,vft);
}