On 17/11/2014 at 12:58, xxxxxxxx wrote:
Sure, but there ain't much to see on code.
The strange thing is that if my plugin used CreateRay(), glowing textures won't glow.
If I remove VIDEOPOSTINFO_CUSTOMLENS from GetRenderInfo, but glow works.
VIDEOPOSTINFO BDVJData::GetRenderInfo(BaseVideoPost* node)
{
if ( bEnabled )
return VIDEOPOSTINFO_CUSTOMLENS|VIDEOPOSTINFO_EXECUTEPIXEL|VIDEOPOSTINFO_EXECUTELINE;
else
return VIDEOPOSTINFO_0;
}
void BDVJData::CreateRay(Ray* dst, Real x, Real y)
{
if ( ! bEnabled )
{
//this->VideoPostData::CreateRay(dst, x, y);
return;
}
// Get ray
LVector dir = CreateRay( x, y );
if ( dir == LVector(0) )
{
dst->p = LVector(0);
dst->v = LVector(0);
return;
}
// Get camera
LMatrix camMatrix = mCamera->GetMg();
LVector camPos = camMatrix.off;
// Make ray
dst->p = camPos; // posiciona na camera
dst->v = dir; // direcao do raio
dst->v *= camMatrix; // transformacao da camera
dst->v -= camPos; // volta pra 0,0,0
//dst->ior = 0.0;
// p - 0
// /
// 1 - 2
for ( int n = 0 ; n < 3 ; n++ )
{
Real xx = x + ( n % 2 == 0 ? 1.0 : 0.0 );
Real yy = y + ( n > 0 ? 1.0 : 0.0 );
LVector dd = CreateRay( xx, yy );
if ( dd == LVector(0) )
dd = dir;
dst->pp[n] = camPos; // posiciona na camera
dst->vv[n] = dd; // direcao do raio
dst->vv[n] *= camMatrix; // transformacao da camera
dst->vv[n] -= camPos; // volta pra 0,0,0
}
}
LVector BDVJData::CreateRay(Real x, Real y)
{
if ( bPanoramic )
{
// Panoramic projection
LVector uv = LVector( x - area.start.x, y - area.start.y, 0 ) / (mRadius * 2.0);
if ( uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0 )
return LVector(0);
uv.x = 1.0 - uv.x;
return geoToDome( uv );
}
else
{
// Fulldome projection
LVector uv = LVector( x - area.start.x, y - area.start.y, 0 ) / (mRadius * 2.0);
uv.y = 1.0 - uv.y;
return texelToDome( uv, mFov, mMask != VP_MASK_DISABLED );
}
}