CParticleColorModifierType::CParticleColorModifierType(void)
{
    m_vStartColor=CRGBColor(1,1,1);
    m_vEndColor=CRGBColor(1,1,1);
    m_dStartAlpha=1;
    m_dEndAlpha=1;
    m_dAlphaTransitionStart=0;
    m_dAlphaTransitionEnd=1;
    m_dColorTransitionStart=0;
    m_dColorTransitionEnd=1;
}
Esempio n. 2
0
void UT_MapDisk() {

	hScreen = CDisplayScreen::GetInstance();
	hScreen->Init();

	int nSamples = 512;
	int width = nSamples, height = nSamples;

	//CMultiJitteredSampler* sampler=new CMultiJitteredSampler(nSamples,1);
	//CNRookSampler* sampler=new CNRookSampler(nSamples,1);
	//CJitteredSampler* sampler=new CJitteredSampler(nSamples,1);
	CHammersleySampler* sampler = new CHammersleySampler(nSamples, 1);
	sampler->Map_sample_to_unit_disk();

	CPoint2D pt;
	for (int i = 0; i < nSamples; i++) {
		pt = sampler->Sample_unit_disk();
		//Move center(1,1) to (0,0)
		pt.x+=1.0;
		pt.y+=1.0;
		pt = pt * nSamples/2;
		hScreen->SetPixel(pt.x, pt.y, CRGBColor(255, 255, 255));
	}

	hScreen->OpenWindow(width, height, 1);

	glutDisplayFunc(display);
	glutMainLoop();
}
Esempio n. 3
0
CRGBColor CPainter::ReadPoint(const CPoint& Point)
{
	CPoint RealPoint = (m_pWindow != 0) ? Point + m_pWindow->GetClientRect().TopLeft() : Point;
	Uint32 PixelColor = 0;
	if (CRect(0, 0, m_pSurface->w, m_pSurface->h).HitTest(RealPoint) == CRect::RELPOS_INSIDE)
	{
		Uint8* PixelOffset = static_cast<Uint8*>(m_pSurface->pixels) +
			m_pSurface->format->BytesPerPixel * RealPoint.XPos() + m_pSurface->pitch * RealPoint.YPos();
		switch (m_pSurface->format->BytesPerPixel)
		{
		case 1: // 8 bpp
			PixelColor = *reinterpret_cast<Uint8*>(PixelOffset);
			break;
		case 2: // 16 bpp
			PixelColor = *reinterpret_cast<Uint16*>(PixelOffset);
			break;
		case 3: // 24 bpp
		{
			Uint8* pPixelDest = reinterpret_cast<Uint8*>(&PixelColor);
			Uint8* pPixelSource = reinterpret_cast<Uint8*>(PixelOffset);
			*pPixelDest = *pPixelSource;
			*(++pPixelDest) = *(++pPixelSource);
			*(++pPixelDest) = *(++pPixelSource);
			break;
		}
		case 4: // 32 bpp
			PixelColor = *reinterpret_cast<Uint32*>(PixelOffset);
			break;
		default:
			throw(Wg_Ex_SDL("CPainter::DrawPoint : Unrecognized BytesPerPixel."));
			break;
		}
	}
	return CRGBColor(&PixelColor, m_pSurface->format);
}
Esempio n. 4
0
void UT_Sinusoid() {

	hScreen = CDisplayScreen::GetInstance();
	hScreen->Init();


	int width = 800, height = 800;
	double peroid = 100;
	double z;
	for (int x = 0; x < width; x++) {
		for (int y = 0; y < height; y++) {
			z = 255.0
					* sin(
							pow((double(y) / peroid), 2)
									* pow((double(x) / peroid), 2));
			hScreen->SetPixel(x, y, CRGBColor(z, z, z));
		}
	}

	hScreen->OpenWindow(width, height, 1);

	glutDisplayFunc(display);
	glutMainLoop();
	return;
}
Esempio n. 5
0
void CPinhole::Render_Stereo(CWorld* _world, double _x, int _offset) {
	CRGBColor pixel_color;
	CRay ray;
	CPoint2D pt;
	double x, y;
	int nSample = _world->vp.nSamples;
	double hres = _world->vp.hres;
	double vres = _world->vp.vres;
	double size = _world->vp.size / m_zoom;
	/*
	 * Clean before rendering
	 */

	ray.o = m_eye;

	for (int c = 0; c < hres; c++) {
		for (int r = 0; r < vres; r++) {
			pixel_color = CRGBColor(0, 0, 0);
			for (int p = 0; p < nSample; p++) {
				pt = _world->vp.sampler->Sample_unit_square();
				x = size * (c - hres / 2 + pt.x) + _x;
				y = size * (r - vres / 2 + pt.y);
				ray.d = Ray_Direction(CPoint2D(x, y));
				pixel_color += _world->tracer_ptr->Trace_Ray(ray);
			}
			pixel_color /= nSample;
			_world->m_screen->SetPixel(c+_offset, r, pixel_color);
		}
	}
}
Esempio n. 6
0
void CThinLens::Render_Scence(CWorld* _world) {
    CPoint2D lp;
    CPoint2D sp;
    CPoint2D dp;
    CPoint2D pp;
    CRGBColor pixelColor;
    CRay ray;

    double size = _world->vp.size;
    int hres = _world->vp.hres;
    int vres = _world->vp.vres;
    int nSamples = _world->vp.nSamples;

    _world->m_screen->Clear();
    _world->m_screen->OpenWindow(hres, vres, _world->vp.size);
    size /= m_zoom;

    for (int c = 0; c < hres; c++) {
        for (int r = 0; r < vres; r++) {
            pixelColor = CRGBColor(0, 0, 0);
            for (int p = 0; p < nSamples; p++) {
                dp = this->sampler->Sample_unit_square();
                lp = dp * m_radius;

                pp = _world->vp.sampler->Sample_unit_square();
                sp.x = size * (c - hres / 2 + pp.x);
                sp.y = size * (r - vres / 2 + pp.y);

                ray.o = m_eye + lp.x * m_u + lp.y * m_v;
                ray.d = Ray_Direction(sp, lp);
                pixelColor += _world->tracer_ptr->Trace_Ray(ray);
            }
            pixelColor /= nSamples;
            _world->m_screen->SetPixel(c, r, pixelColor);
        }
    }
}