Exemplo n.º 1
0
bool QNLWidget::x11Event(XEvent *event)
{
    if (m_driver && m_driver->isActive())
    {
        NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(m_driver)->getDriver();
        if (driver)
        {
            x11Proc proc = (x11Proc)driver->getWindowProc();
            return proc(driver, event);
        }
    }

    return false;
}
Exemplo n.º 2
0
bool QNLWidget::winEvent(MSG *message, long *result)
{
    if (m_driver && m_driver->isActive())
    {
        NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(m_driver)->getDriver();
        if (driver)
        {
            winProc proc = (winProc)driver->getWindowProc();
            return proc(driver, message->hwnd, message->message, message->wParam, message->lParam);
        }
    }

    return false;
}
Exemplo n.º 3
0
	bool Nel3DWidget::x11Event( XEvent *event )
	{
		if( driver != NULL )
		{
			NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver();
			if( driver != NULL )
			{
				x11Proc proc = ( x11Proc )iDriver->getWindowProc();
				return proc( iDriver, event );
			}
		}

		return false;
	}
Exemplo n.º 4
0
	bool Nel3DWidget::winEvent( MSG *message, long *result )
	{
		if( driver != NULL ) 
		{
			NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver();
			if( iDriver != NULL )
			{
				winProc proc = (winProc)iDriver->getWindowProc();
				return proc( iDriver, message->hwnd, message->message, message->wParam, message->lParam );
			}
		}

		return false;
	}
Exemplo n.º 5
0
bool QNLWidget::macEvent(EventHandlerCallRef caller, EventRef event)
{
    if(caller)
        nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt");

    if (m_driver && m_driver->isActive())
    {
        NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(m_driver)->getDriver();
        if (driver)
        {
            cocoaProc proc = (cocoaProc)driver->getWindowProc();
            return proc(driver, event);
        }
    }

    return false;
}
Exemplo n.º 6
0
CFXAA::CFXAA(NL3D::UDriver *driver) : m_Driver(driver), m_PP(NULL), m_VP(NULL), m_Width(~0), m_Height(~0)
{
	nldebug("3D: Create FXAA");

	CDriverUser *dru = static_cast<CDriverUser *>(driver);
	NL3D::IDriver *drv = (dru)->getDriver();

	if (drv->supportBloomEffect() && drv->supportNonPowerOfTwoTextures())
	{
		m_PP = new CPixelProgram();
		// arbfp1
		{
			IProgram::CSource *source = new IProgram::CSource();
			source->Features.MaterialFlags = CProgramFeatures::TextureStages;
			source->Profile = IProgram::arbfp1;
			source->setSourcePtr(a_arbfp1);
			m_PP->addSource(source);
		}
		// ps_2_0
		{
			IProgram::CSource *source = new IProgram::CSource();
			source->Features.MaterialFlags = CProgramFeatures::TextureStages;
			source->Profile = IProgram::ps_2_0;
			source->setSourcePtr(a_ps_2_0);
			m_PP->addSource(source);
		}
		if (!drv->compilePixelProgram(m_PP))
		{
			nlwarning("3D: No supported pixel program for FXAA effect");

			delete m_PP;
			m_PP = NULL;
		}
		else
		{
			nldebug("3D: FXAA pixel program available");
		}
	}

	if (!m_PP)
	{
		return;
	}

	// create vp
	{
		m_VP = new CVertexProgram();
		// nelvp
		{
			IProgram::CSource *source = new IProgram::CSource();
			source->Features.MaterialFlags = CProgramFeatures::TextureStages;
			source->Profile = IProgram::nelvp;
			source->setSourcePtr(a_nelvp);
			m_VP->addSource(source);
		}
		if (!drv->compileVertexProgram(m_VP))
		{
			nlwarning("3D: No supported vertex program for FXAA effect");

			delete m_VP;
			m_VP = NULL;
			delete m_PP;
			m_PP = NULL;
		}
		else
		{
			nldebug("3D: FXAA vertex program available");
		}
	}

	if (!m_VP)
	{
		return;
	}
	
	// create material and vb
	{
		m_Mat = m_Driver->createMaterial();
		m_Mat.initUnlit();
		m_Mat.setColor(CRGBA::White);
		m_Mat.setBlend (false);
		m_Mat.setAlphaTest (false);
		NL3D::CMaterial *mat = m_Mat.getObjectPtr();
		mat->setShader(NL3D::CMaterial::Normal);
		mat->setBlendFunc(CMaterial::one, CMaterial::zero);
		mat->setZWrite(false);
		mat->setZFunc(CMaterial::always);
		mat->setDoubleSided(true);

		m_QuadUV.V0 = CVector(0.f, 0.f, 0.5f);
		m_QuadUV.V1 = CVector(1.f, 0.f, 0.5f);
		m_QuadUV.V2 = CVector(1.f, 1.f, 0.5f);
		m_QuadUV.V3 = CVector(0.f, 1.f, 0.5f);

		/*if (drv->textureCoordinateAlternativeMode())
		{
			m_QuadUV.Uv0 = CUV(0.f,  1.f);
			m_QuadUV.Uv1 = CUV(1.f, 1.f);
			m_QuadUV.Uv2 = CUV(1.f, 0.f);
			m_QuadUV.Uv3 = CUV(0.f,  0.f);
		}
		else
		{*/
			m_QuadUV.Uv0 = CUV(0.f,  0.f);
			m_QuadUV.Uv1 = CUV(1.f, 0.f);
			m_QuadUV.Uv2 = CUV(1.f, 1.f);
			m_QuadUV.Uv3 = CUV(0.f,  1.f);
		/*}*/

		/*CVertexBuffer &vb = m_VB;
		vb.clearValueEx();
		vb.addValueEx(CVertexBuffer::Position, CVertexBuffer::Float3);
		vb.addValueEx(CVertexBuffer::TexCoord0, CVertexBuffer::Float2);
		vb.addValueEx(CVertexBuffer::TexCoord1, CVertexBuffer::Float4);
		vb.initEx();
		vb.setPreferredMemory(CVertexBuffer::RAMVolatile, false);
		vb.setNumVertices(4);*/
	}
}