예제 #1
0
파일: driver.c 프로젝트: khongton/Raycaster
int main() {
   /* Debugging Code */ 
   //double minX = 0.05859357, maxX = 0.44921857;
   //double minY = 2.03125, maxY = 2.421875;
   //int width = 20, height = 20;

   double minX = -10, maxX = 10, minY = -7.5, maxY = 7.5;
   int width = 512, height = 384;
   Canvas canvas;
   InitCanvas(&canvas, minX, maxX, minY, maxY, width, height);

   Point eye = CreatePoint(0.0, 0.0, -14.0);
   Point blueSphere = CreatePoint(1.0, 1.0, 0.0);
   Point redSphere = CreatePoint(0.5, 1.5, -3.0);
   Point lightPoint = CreatePoint(-100.0, 100.0, -100.0);

   Color blue = CreateColor(0.0, 0.0, 1.0);
   Color red = CreateColor(1.0, 0.0, 0.0);
   Color ambient = CreateColor(1.0, 1.0, 1.0);
   Color lightColor = CreateColor(1.5, 1.5, 1.5);
   
   Finish largeFinish = CreateFinish(0.2, 0.4, 0.5, 0.05);
   Finish smallFinish = CreateFinish(0.4, 0.4, 0.5, 0.05);

   Light light = CreateLight(lightPoint, lightColor);
   Sphere spheres[2];
   spheres[0] = CreateSphere(blueSphere, 2.0, blue, largeFinish);
   spheres[1] = CreateSphere(redSphere, 0.5, red, smallFinish);
   
   castAllRays(&canvas, eye, spheres, ambient, light, 2);
   return 0;
}
예제 #2
0
파일: App.cpp 프로젝트: pkoivumaki/xplosion
// Initialize application window
// Most of the error checking omitted
bool App::Init()
{
	/*
	viewports[0].SetVPSize(winWidth/2, winHeight/2);
	Viewport vp(viewports[0]);
	vp.SetVPPosition(winWidth/2, winHeight/2);
	viewports.push_back(vp);
	*/

	if(!InitWindow())
		return false;

	if(!InitD3D())
		return false;

	// Call resize to do rest of window initialization
	Resize();

	if(!CompileShaders())
		return false;

	// Set up sampler states for perlin noise
	SetupSamplers();

	// Set up lookup textures for perlin noise
	SetupTextures();	

	// Initialize vertex buffer with canvas quad
	InitCanvas();

	// Init default viewport
	viewports[0].RefreshBuffer();

	// Initialize viewport buffer
	D3D11_SUBRESOURCE_DATA vpbufData;
	vpbufData.pSysMem			= viewports[0].GetBufferData();
	vpbufData.SysMemPitch		= NULL;
	vpbufData.SysMemSlicePitch	= NULL;
	HR(dev->CreateBuffer(&Viewport::viewportBufferDesc, NULL, &viewportBuffer));

	// Initialize shader params buffer;
	D3D11_BUFFER_DESC shaderBufferDesc= {
		sizeof(ShaderParams),
		D3D11_USAGE_DYNAMIC,
		D3D11_BIND_CONSTANT_BUFFER,
		D3D11_CPU_ACCESS_WRITE,
		0
	};
	D3D11_SUBRESOURCE_DATA shaderBuffer;
	shaderBuffer.pSysMem			= shaderParams;
	shaderBuffer.SysMemPitch		= NULL;
	shaderBuffer.SysMemSlicePitch	= NULL;
	HR(dev->CreateBuffer(&shaderBufferDesc, &shaderBuffer, &shaderParamsBuffer));

	// And finally update the window
	UpdateWindow(mainWnd);

	return true;
}
예제 #3
0
void Init()
{
    gROOT->SetStyle("Plain");
    gStyle->SetTitleBorderSize(0);
    gStyle->SetPalette(1,0);
    
    gStyle->SetTitleW(0.5);
    gStyle->SetTitleH(0.08);
    
    gStyle->SetOptFit(00000);
    gStyle->SetOptStat(111);
    gStyle->SetStatFormat("g");
    gStyle->SetMarkerStyle(20);
    gStyle->SetMarkerSize(0.5);
    gStyle->SetHistLineWidth(1);
    gROOT->ForceStyle();

    canvas = new TCanvas();
    InitCanvas(canvas);

}
예제 #4
0
파일: winstuff.c 프로젝트: navoj/xlisp
/* InvokeXLISP - invoke the xlisp interpreter */
int InvokeXLISP(xlCallbacks *callbacks,int argc,char *argv[])
{
    xlSubrDef *sdp;
    xlXSubrDef *xsdp;
    
    /* initialize xlisp */
    if (!xlInit(callbacks,argc,argv,NULL)) {
        Error("initializing xlisp");
        return FALSE;
    }

    /* set our platform type */
    xlSetSoftwareType("WIN95");

    /* add all of our functions */
    for (sdp = subrtab; sdp->name != NULL; ++sdp)
        xlSubr(sdp->name,sdp->subr);
    for (xsdp = xsubrtab; xsdp->name != NULL; ++xsdp)
        xlXSubr(xsdp->name,xsdp->subr);

    /* initialize the widget classes */
    InitWidgets();

    /* initialize the window classes */
    InitWindows();

    /* initialize the canvas class */
    InitCanvas();
    
    /* initialize the menu classes */
    InitMenus();

    /* initialize the edit classes */
    InitEdit();

    /* initialize the toolbar routines */
    InitToolbars();

    /* initialize the accelerator routines */
    InitAccelerators();

    /* initialize the listener routines */
    InitListener();

    /* initialize the miscellaneous routines */
    InitMisc();

    /* setup the *command-line* variable */
    xlVal = xlMakeCString((char *)GetCommandLine());
    xlSetValue(xlEnter("*COMMAND-LINE*"),xlVal);

    /* load the lisp code */
    xlLoadFile("xlispw.lsp");
    
    /* display the banner */
    xlInfo("%s",xlBanner());
    
    /* display the initial prompt */
    xlCallFunctionByName(NULL,0,"LISTENER-PROMPT",0);

    /* flush terminal output */
    xlosFlushOutput();

    /* return successfully */
    return TRUE;
}
예제 #5
0
InitPad(char* option = 0)
{
  InitCanvas(gPad, option);
}