Exemplo n.º 1
0
bool
Bedge :: is_texture_seam()const
{
    //this function is under construction
    //do not use yet

    //fix for skin users
    static bool USE_UV = !Config::get_var_bool("SKIN_INHIBIT_UV",false);
    if(  USE_UV && !UVdata::is_continuous(this)) return true;


    if (_f1 && _f2 && !is_patch_boundary())//patches on both sides are the same
    {

        TexCoordGen* tg = patch()->tex_coord_gen();
        if (tg)
        {
            UVpt tx1A = tg->uv_from_vert(_v1,_f1);
            UVpt tx1B = tg->uv_from_vert(_v1,_f2);
            UVpt tx2A = tg->uv_from_vert(_v2,_f1);
            UVpt tx2B = tg->uv_from_vert(_v2,_f2);

            if ((tx1A!=tx1B) || (tx2A!=tx2B)) return true;

        }
    }

    return false;
}
Exemplo n.º 2
0
/**********************************************************************
 * FlatShadeStripCB:
 **********************************************************************/
void 
FlatShadeStripCB::faceCB(CBvert* v, CBface* f) 
{
   // normal
   glNormal3dv(f->norm().data());

   if (v->has_color()) {
      GL_COL(v->color(), alpha*v->alpha());
   }

   // texture coords
   if (_do_texcoords) {
      if (_use_auto) { //force automatic 
         //use spherical text coord gen
         glTexCoord2dv(_auto_UV->uv_from_vert(v,f).data());
      } else {
         // the patch has a texture... try to find
         // appropriate texture coordinates...

         // use patch's TexCoordGen if possible,
         // otherwise use the texture coordinates stored
         // on the face (if any):
         TexCoordGen* tg = f->patch()->tex_coord_gen();
         if (tg)
            glTexCoord2dv(tg->uv_from_vert(v,f).data());
         else if (UVdata::lookup(f))
            glTexCoord2dv(UVdata::get_uv(v,f).data());
      }
   }
  
   // vertex coords
   glVertex3dv(v->loc().data());
}
Exemplo n.º 3
0
/**********************************************************************
 * SmoothShadeStripCB:
 **********************************************************************/
void 
SmoothShadeStripCB::faceCB(CBvert* v, CBface* f) 
{
   using mlib::Wvec;
   // normal
   Wvec n;
   glNormal3dv(f->vert_normal(v,n).data());

   if (v->has_color())
      GL_COL(v->color(), alpha*v->alpha());

   // texture coords
   if (do_texcoords) {
      // the patch has a texture... try to find
      // appropriate texture coordinates...

      // use patch's TexCoordGen if possible,
      // otherwise use the texture coordinates stored
      // on the face (if any):
      TexCoordGen* tg = f->patch()->tex_coord_gen();
      if (tg)
         glTexCoord2dv(tg->uv_from_vert(v,f).data());
      else if (UVdata::lookup(f))
         glTexCoord2dv(UVdata::get_uv(v,f).data());
   }

   // vertex coords
   glVertex3dv(v->loc().data());
}
Exemplo n.º 4
0
/**********************************************************************
 * NPRSolidTexCB:
 **********************************************************************/
void 
NPRSolidTexCB::faceCB(CBvert* v, CBface*f) 
{
   Wvec n;
   f->vert_normal(v,n);

   if (!nst_use_vertex_program)
   {
      if (nst_tex_flag) {
         TexCoordGen* tg = f->patch()->tex_coord_gen();
         if (tg) 
            glTexCoord2dv(tg->uv_from_vert(v,f).data());
         else if (UVdata::lookup(f))
            glTexCoord2dv(UVdata::get_uv(v,f).data());
      }
   
      if (nst_paper_flag)
         PaperEffect::paper_coord(NDCZpt(v->wloc()).data());
      
      glNormal3dv(n.data());
      glVertex3dv(v->loc().data());
   }
   else
   {
      if (nst_tex_flag)
      {
         TexCoordGen* tg = f->patch()->tex_coord_gen();
         if (tg) 
            glTexCoord2dv(tg->uv_from_vert(v,f).data());
         else if (UVdata::lookup(f))
            glTexCoord2dv(UVdata::get_uv(v,f).data());
      }


      glNormal3dv(n.data());
      glVertex3dv(v->loc().data());
   }

}
Exemplo n.º 5
0
	virtual  UVpt get_attrib(CBvert* v, CBface* f)
	{
	  assert(v&&f);

	  TexCoordGen* tg = f->patch()->tex_coord_gen();
      if (tg)
         return tg->uv_from_vert(v,f);
      else 
		 if (UVdata::lookup(f))
           return UVdata::get_uv(v,f);
		 else
			return UVpt(0.0,0.0); 
	}