// Code taken from Dr. Geist's handout
void do_stuff() {
	float eyepoint[3], viewpoint[3];
	int k;
	glEnable(GL_DEPTH_TEST);
	glClearColor(0.8,0.6,0.62,1.0);
	glBindFramebufferEXT(GL_FRAMEBUFFER,1); 
	glUseProgram(0);
	for(k=0;k<3;k++){ 
		eyepoint[k] = light0_position[k]; 
		viewpoint[k] = light0_direction[k]+light0_position[k];
	}
	
	view_volume(eyepoint,viewpoint, 0);

	lights(); 
	aa_display(eyepoint,viewpoint);
	glBindFramebufferEXT(GL_FRAMEBUFFER,0); 

	save_matrix(eyepoint,viewpoint);

	glUseProgram(sprogram);
	glActiveTexture(GL_TEXTURE7);
	glBindTexture(GL_TEXTURE_2D,1);

	// Draw scene from the intended eye point, complete with shadows. 
	eyepoint[0] = 1.0; eyepoint[1] = 2.0; eyepoint[2] = -5.0;
	viewpoint[0] = 0.0; viewpoint[1] = 0.0; viewpoint[2] = 0.0;
	view_volume(eyepoint,viewpoint, 0);
	lights(); 
	aa_display(eyepoint,viewpoint);
	glutSwapBuffers();
}
示例#2
0
文件: umain.c 项目: sudolee/embedded
void umain(void)
{
	struct uart_res *port0 = get_port_entry(0);
#ifdef DEBUG_LEDS
	lights(2);
#endif /* DEBUG_LEDS */

	init_uart0(port0);

	while(1) {
		serial_printf(0, "%c,%c,%c,%c\n", '-', '+', '*', '/');
		serial_printf(0, "%s\n", __func__);
		serial_printf(0, "%p\n", umain);
		serial_printf(0, "%#X\n", (u32)umain);
		serial_printf(0, "%#o\n", 1234);
		serial_printf(0, "%#+6.4x\n", 12345678);
		serial_printf(0, "%#+5.8s\n", "hello world...");
		serial_printf(0, "%#x\n", 0x1234567);
		serial_printf(0, "-> %s %d\n", "i'm:", 618);
	}

#ifdef DEBUG_LEDS
	lights(3);
#endif /* DEBUG_LEDS */
}
示例#3
0
文件: main.cpp 项目: 4og/guacamole
std::vector<std::shared_ptr<gua::node::TransformNode>> add_lights(gua::SceneGraph& graph,
                                                  int count) {

  std::vector<std::shared_ptr<gua::node::TransformNode>> lights(count);

  for (int i(0); i < count; ++i) {
    scm::math::vec3 randdir(gua::math::random::get(-1.f, 1.f),
                            gua::math::random::get(-1.f, 1.f),
                            gua::math::random::get(-1.f, 1.f));
    scm::math::normalize(randdir);

    gua::TriMeshLoader loader;
    auto sphere_geometry(
      loader.create_geometry_from_file(
      "sphere" + gua::string_utils::to_string(i),
      "data/objects/light_sphere.obj",
      "data/materials/White.gmd"
    ));

    sphere_geometry->scale(0.04, 0.04, 0.04);

    lights[i] = graph.add_node("/", std::make_shared<gua::node::TransformNode>("light" + gua::string_utils::to_string(i)));
    lights[i]->add_child(sphere_geometry);
    lights[i]->translate(randdir[0], randdir[1], randdir[2]);

    auto light = lights[i]->add_child(std::make_shared<gua::node::PointLightNode>("light"));
    light->data.set_color(gua::utils::Color3f::random());
  }

  return lights;
}
示例#4
0
  void playWithHomeTheater() {

    // Create all the parts of the home theatre system
    Amplifier amp("Top-O-Line Amplifier");
    CdPlayer cd("Top-O-Line CD Player", &amp);
    DvdPlayer dvd("Top-O-Line DVD Player", &amp);
    Screen screen("My Theater Screen");
    PopcornPopper popper("My Popcorn Popper");
    Tuner tuner("Top-O-Line AM/FM Tuner", &amp);
    TheaterLights lights("Theater Ceiling Lights");
    Projector projector("Top-O-Line Projector");

    popper.on();  // Turn on the popcorn popper...
    popper.pop(); // and start popping...

    lights.dim(10); // Dim the lights to 10%... 
    
    screen.down();  // Put the screen down...

    projector.on();             // Turn on the projector...
    projector.setInput(&dvd);    // set it to DVD...
    projector.wideScreenMode(); // and put it on wide screen mode for the movie...

    amp.on();                // Turn on the amp...
    amp.setInput(&dvd);       // set it to DVD and...
    amp.setSurroundSound();  // put it into surround sound mode...
    amp.setVolume(11);       // and set the volume to 11...

    dvd.on();                            // Turn on the DVD player...
    dvd.play("Raiders of the lost ark"); // and FINALLY, play the movie!

    // What about shutting everything down again?!
    // How would you play a CD? etc...
  }
示例#5
0
bool Assembly::on_render_begin(
    const Project&          project,
    const BaseGroup*        parent,
    OnRenderBeginRecorder&  recorder,
    IAbortSwitch*           abort_switch)
{
    if (!Entity::on_render_begin(project, parent, recorder, abort_switch))
        return false;

    if (!BaseGroup::on_render_begin(project, parent, recorder, abort_switch))
        return false;

    bool success = true;
    success = success && invoke_on_render_begin(bsdfs(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(bssrdfs(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(edfs(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(surface_shaders(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(materials(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(lights(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(objects(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(object_instances(), project, this, recorder, abort_switch);
    success = success && invoke_on_render_begin(volumes(), project, this, recorder, abort_switch);

    return success;
}
示例#6
0
void display(void) {
	glLoadIdentity ();
	lights();
	/* Point the camera */
	gluLookAt(4.0 * sin(rot),height,-4.0 * cos(rot),
			  0.0,cam_offset,0.0,
			  0.0,100.0,0.0);

	if (!rotation_paused) {
		rot += 0.002;
	}

	glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	/* Draw the teapot */
	glBegin(GL_TRIANGLES);
	for (uint32_t i = 0; i < faces.len; ++i) {
		glNormal3f(faces.nodes[i]->a->normal.x, faces.nodes[i]->a->normal.y, faces.nodes[i]->a->normal.z);
		glTexCoord2f(faces.nodes[i]->a->u,faces.nodes[i]->a->v);
		glVertex3f(faces.nodes[i]->a->x, faces.nodes[i]->a->y, faces.nodes[i]->a->z);
		glNormal3f(faces.nodes[i]->b->normal.x, faces.nodes[i]->b->normal.y, faces.nodes[i]->b->normal.z);
		glTexCoord2f(faces.nodes[i]->b->u,faces.nodes[i]->b->v);
		glVertex3f(faces.nodes[i]->b->x, faces.nodes[i]->b->y, faces.nodes[i]->b->z);
		glNormal3f(faces.nodes[i]->c->normal.x, faces.nodes[i]->c->normal.y, faces.nodes[i]->c->normal.z);
		glTexCoord2f(faces.nodes[i]->c->u,faces.nodes[i]->c->v);
		glVertex3f(faces.nodes[i]->c->x, faces.nodes[i]->c->y, faces.nodes[i]->c->z);
	}
	glEnd();

	glFlush ();

}
示例#7
0
bool Assembly::on_frame_begin(
    const Project&      project,
#ifdef WITH_OSL
    OSL::ShadingSystem& shading_system,
#endif
    AbortSwitch*        abort_switch)
{
    bool success = true;

    success = success && invoke_on_frame_begin(project, texture_instances(), abort_switch);
    success = success && invoke_on_frame_begin(project, *this, surface_shaders(), abort_switch);
    success = success && invoke_on_frame_begin(project, *this, bsdfs(), abort_switch);
    success = success && invoke_on_frame_begin(project, *this, edfs(), abort_switch);

#ifdef WITH_OSL
    success = success && invoke_on_frame_begin(project, *this, shading_system, shader_groups(), abort_switch);
#endif

    success = success && invoke_on_frame_begin(project, *this, materials(), abort_switch);
    success = success && invoke_on_frame_begin(project, *this, lights(), abort_switch);

    success = success && invoke_on_frame_begin(project, *this, object_instances(), abort_switch);

#ifdef WITH_OSL
    success = success && invoke_on_frame_begin(project, assemblies(), shading_system, abort_switch);
#else
    success = success && invoke_on_frame_begin(project, assemblies(), abort_switch);
#endif

    success = success && invoke_on_frame_begin(project, assembly_instances(), abort_switch);

    return success;
}
示例#8
0
void Control::clearButtonLights(){
	for(int i = 1; i < 10; i++){
		lights(i, false);
	}
	cout << "All lights cleared" << endl << endl << endl;

}
示例#9
0
    void onDrawContent(SkCanvas* canvas) override {
        fLightAngle += 0.015f;
        fColorFactor += 0.01f;
        if (fColorFactor > 1.0f) {
            fColorFactor = 0.0f;
        }

        sk_sp<SkLights> lights(create_lights(fLightAngle, fColorFactor));
        SkPaint paint;
        sk_sp<SkShader> normalMap = SkShader::MakeBitmapShader(fNormalBitmap,
            SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullptr);
        sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeFromNormalMap(
                std::move(normalMap), SkMatrix::I());
        sk_sp<SkShader> diffuseShader = SkShader::MakeBitmapShader(fDiffuseBitmap,
                SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullptr);
        paint.setShader(SkLightingShader::Make(std::move(diffuseShader), std::move(normalSource),
                                               std::move(lights)));
        paint.setColor(SK_ColorBLACK);

        SkRect r = SkRect::MakeWH((SkScalar)fDiffuseBitmap.width(),
                                  (SkScalar)fDiffuseBitmap.height());
        canvas->drawRect(r, paint);

        // so we're constantly updating
        this->inval(nullptr);
    }
示例#10
0
int main() {

	// do setup 
	setup();
	
	DDRC |= (1 << PC5);
	PORTC &= ~(1 << PC5);

/*
	// wait until all buttons released
	uint8_t waitbutton = ~(PIND) & 0b00011111;
	if (~(PINB) & (1<<PB0)) waitbutton |= 0b00100000; // pridame edit tlacitko z portu B
	while (waitbutton) {
		waitbutton = ~(PIND) & 0b00011111;
		if (~(PINB) & (1<<PB0)) waitbutton |= 0b00100000; // pridame edit tlacitko z portu B
	}
*/

	// and go for infinite loop
	for (;;) {
		
		controls();		// read buttons and pots
		lights();		// compute which LED to light up
		
		if (newstep) {
			newstep = 0;
			uint8_t i;
			for (i = 0; i < 4; i++) {
				if (seq[playstep] & (1 << i)) gate[i] = 1;			
			}
		}
	}
}
示例#11
0
    void onDrawContent(SkCanvas* canvas) override {
        fLightAngle += 0.015f;
        fColorFactor += 0.01f;
        if (fColorFactor > 1.0f) {
            fColorFactor = 0.0f;
        }

        SkAutoTUnref<const SkLightingShader::Lights> lights(create_lights(fLightAngle,
                                                                          fColorFactor));

        fShader.reset(SkLightingShader::Create(fDiffuseBitmap, fNormalBitmap,
                                               lights, SkVector::Make(1.0f, 0.0f),
                                               nullptr, nullptr));

        SkPaint paint;
        paint.setShader(fShader);
        paint.setColor(SK_ColorBLACK);

        SkRect r = SkRect::MakeWH((SkScalar)fDiffuseBitmap.width(), 
                                  (SkScalar)fDiffuseBitmap.height());
        canvas->drawRect(r, paint);

        // so we're constantly updating
        this->inval(NULL);
    }
示例#12
0
int main(int argv, char **argc) {

	Scene *scene = new Scene();

	std::ifstream sceneFile("scene.txt");

	if (!sceneFile)
		return 123;

	std::string s((std::istreambuf_iterator<char>(sceneFile)), std::istreambuf_iterator<char>());

	JsonGroup json(s);
	JsonArray objects(json.at("objects").Array());
	JsonArray lights(json.at("lights").Array());
	JsonGroup camera(json.at("camera").Group());

	Camera cam = Camera(Vector3D(camera.at("position").Array().at(0).Float(), camera.at("position").Array().at(1).Float(), camera.at("position").Array().at(2).Float()), Vector3D(camera.at("target").Array().at(0).Float(), camera.at("target").Array().at(1).Float(), camera.at("target").Array().at(2).Float()), camera.at("roll").Float());

	for (int i = 0; i < objects.size(); i++){
		JsonGroup object = objects.at(i).Group();

		if (object.at("type").String().compare("sphere") == 0){
			scene->add(new SphereObject(Vector3D(object.at("position").Array().at(0).Float(), object.at("position").Array().at(1).Float(), object.at("position").Array().at(2).Float()),
				object.at("radius").Float(), Color(object.at("color").Array().at(0).Integer(), object.at("color").Array().at(1).Integer(), object.at("color").Array().at(2).Integer()), object.at("reflection").Float(), object.at("refraction").Float(), object.at("ior").Float()));
		}

		if (object.at("type").String().compare("plane") == 0){
			scene->add(new PlaneObject(Vector3D(object.at("position").Array().at(0).Float(), object.at("position").Array().at(1).Float(), object.at("position").Array().at(2).Float()),
				Vector3D(object.at("normal").Array().at(0).Float(), object.at("normal").Array().at(1).Float(), object.at("normal").Array().at(2).Float()),
				Color(object.at("color").Array().at(0).Array().at(0).Integer(), object.at("color").Array().at(0).Array().at(1).Integer(), object.at("color").Array().at(0).Array().at(2).Integer()),
				Color(object.at("color").Array().at(1).Array().at(0).Integer(), object.at("color").Array().at(1).Array().at(1).Integer(), object.at("color").Array().at(1).Array().at(2).Integer()), object.at("reflection").Float(), object.at("refraction").Float(), object.at("ior").Float()));
		}

		if (object.at("type").String().compare("triangle") == 0){
			scene->add(new TriangleObject(Vector3D(object.at("vertices").Array().at(0).Array().at(0).Integer(), object.at("vertices").Array().at(0).Array().at(1).Integer(), object.at("vertices").Array().at(0).Array().at(2).Integer()),
				Vector3D(object.at("vertices").Array().at(1).Array().at(0).Integer(), object.at("vertices").Array().at(1).Array().at(1).Integer(), object.at("vertices").Array().at(1).Array().at(2).Integer()),
				Vector3D(object.at("vertices").Array().at(2).Array().at(0).Integer(), object.at("vertices").Array().at(2).Array().at(1).Integer(), object.at("vertices").Array().at(2).Array().at(2).Integer()),
				Color(object.at("color").Array().at(0).Integer(), object.at("color").Array().at(1).Integer(), object.at("color").Array().at(2).Integer()), object.at("reflection").Float(), object.at("refraction").Float(), object.at("ior").Float()));
		}
	}

	for (int i = 0; i < lights.size(); i++){
		JsonGroup light = lights.at(i).Group();

		if (light.at("type").String().compare("point") == 0){
			scene->add(new PointLight(Vector3D(light.at("position").Array().at(0).Float(), light.at("position").Array().at(1).Float(), light.at("position").Array().at(2).Float())));
		}

		if (light.at("type").String().compare("direction") == 0){
			scene->add(new DirectionLight(Vector3D(light.at("direction").Array().at(0).Float(), light.at("direction").Array().at(1).Float(), light.at("direction").Array().at(2).Float())));
		}
	}

    Renderer *renderer = new Renderer();
	PixelBuffer *buffer = renderer->render(scene, &cam, camera.at("resolution").Array().at(0).Integer(), camera.at("resolution").Array().at(1).Integer(), camera.at("raydepth").Integer());
	//buffer->savePPM("test.ppm");
	buffer->saveBMP("image.bmp");
    return 0;
}
示例#13
0
void Assembly::on_frame_end(const Project& project)
{
    invoke_on_frame_end(project, assembly_instances());
    invoke_on_frame_end(project, assemblies());
    invoke_on_frame_end(project, *this, lights());
    invoke_on_frame_end(project, *this, materials());
    invoke_on_frame_end(project, *this, edfs());
    invoke_on_frame_end(project, *this, bsdfs());
    invoke_on_frame_end(project, *this, surface_shaders());
}
示例#14
0
void main(){
    unsigned char seg7[] ={0x3f, 0x06,0x5b,0x4f,0x66, 
  0x6d,0x7d,0x07,0x7f,0x6f, 0x77,0x7c,0x39,0x5e,0x79,0x71}; //Array of Hex table

    initAll(); // DO EVERYTHING NOW
    while(1){ // this could go on f0r3v3r
       lights(PTH & 0x07 );
       LED7();
    }

}
示例#15
0
    void onDrawContent(SkCanvas* canvas) override {
        sk_sp<SkLights> lights(create_lights(fLightAngle, fColorFactor));

        SkPaint paint;
        paint.setShader(SkLightingShader::Make(fDiffuseShader,
                                               fNormalSource,
                                               std::move(lights)));
        paint.setColor(SK_ColorBLACK);

        canvas->drawRect(fRect, paint);
    }
示例#16
0
int main() {
	
	LED_INIT();
	BUT_INIT();
	LEDS_OFF(); //the default is on
	while(1){
		if (nrf_gpio_pin_read(BUTTON_0) == 0){
			lights();
			LEDS_OFF();
		}
	}
}
示例#17
0
/* The initialize function configures the PLL to set the internal clock
 * frequency. It also configures the digital IO and calls the initialization
 * functions for each of the modules. A light sequence signals the end of
 * initialization.
 */
void initialize(void){
    /* Configure Phase Lock Loop for  the system clock reference at 40MHz */
    // Fosc (Clock frequency) is set at 80MHz
    // Fin is 7.37 MHz from internal FRC oscillator
    // FPLLI = Fin/N1 = 3.685 MHz
    CLKDIVbits.PLLPRE = 0;   // N1 = 2
    // FVCO = FPLLI*M1 = 162.14MHz
    PLLFBDbits.PLLDIV = 42;  // M = 44
    // FPLLO = FVCO/N2 = 81.07 MHz
    // FOSC ~= 80MHz, FCY ~= 40MHz
    CLKDIVbits.PLLPOST = 0;  // N2 = 2

    /* Initiate Clock Switch */
    //The __builtin macro handles unlocking the OSCCON register
    __builtin_write_OSCCONH(1); //New oscillator is FRC with PLL
    __builtin_write_OSCCONL(OSCCON | 0x01); //Enable clock switch

    while (OSCCONbits.COSC!= 1); //Wait for FRC with PLL to be clock source
    while (OSCCONbits.LOCK!= 1); //Wait for PLL to lock

    /* Configure IO*/
    TRISDbits.TRISD10 = 1;   //USER input
    //LED outputs
    ANSELBbits.ANSB13 = 0;  //Disable Analog on B13
    TRISBbits.TRISB13 = 0;  //LED1
    ANSELBbits.ANSB12 = 0;  //Disable Analog on B12
    TRISBbits.TRISB12 = 0;  //LED2
    TRISDbits.TRISD11 = 0;  //LED3
    TRISDbits.TRISD0 = 0;   //LED4
    //Magnet Control
    TRISBbits.TRISB14 = 0;   //Top Magnet

    //Store bits indicating reason for reset
    resetStat = RCON;
    //Clear reset buffer so next reset reading is correct
    RCON = 0;

    /* Initialize peripherals*/
    initialize_PWM();
    initialize_CN();
    initialize_ADC();
    initialize_QEI();
    initialize_UART();
    initialize_UART2();
    //initialize_I2C_Master();
    lights();
    __delay32(10000000);
    //initialize_MPU();
    initialize_encoder_values(1600,1700,1800);
}
示例#18
0
int main (int argc, char **argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH);
    glutInitWindowSize(XRES,YRES);
    glutInitWindowPosition(100,100);
    glutCreateWindow("shadowmap");
	lights();
	//~ build_shadowmap();
	sprogram = set_shaders();
	glutDisplayFunc(do_stuff);
	glutMainLoop();
	return 0;
}
示例#19
0
bool Assembly::on_frame_begin(const Project& project)
{
    bool success = true;

    success = success && invoke_on_frame_begin(project, *this, surface_shaders());
    success = success && invoke_on_frame_begin(project, *this, bsdfs());
    success = success && invoke_on_frame_begin(project, *this, edfs());
    success = success && invoke_on_frame_begin(project, *this, materials());
    success = success && invoke_on_frame_begin(project, *this, lights());
    success = success && invoke_on_frame_begin(project, assemblies());
    success = success && invoke_on_frame_begin(project, assembly_instances());

    return success;
}
示例#20
0
void Assembly::update_asset_paths(const StringDictionary& mappings)
{
    BaseGroup::update_asset_paths(mappings);

    invoke_update_asset_paths(bsdfs(), mappings);
    invoke_update_asset_paths(bssrdfs(), mappings);
    invoke_update_asset_paths(edfs(), mappings);
    invoke_update_asset_paths(surface_shaders(), mappings);
    invoke_update_asset_paths(materials(), mappings);
    invoke_update_asset_paths(lights(), mappings);
    invoke_update_asset_paths(objects(), mappings);
    invoke_update_asset_paths(object_instances(), mappings);
    invoke_update_asset_paths(volumes(), mappings);
}
示例#21
0
void Assembly::collect_asset_paths(StringArray& paths) const
{
    BaseGroup::collect_asset_paths(paths);

    invoke_collect_asset_paths(bsdfs(), paths);
    invoke_collect_asset_paths(bssrdfs(), paths);
    invoke_collect_asset_paths(edfs(), paths);
    invoke_collect_asset_paths(surface_shaders(), paths);
    invoke_collect_asset_paths(materials(), paths);
    invoke_collect_asset_paths(lights(), paths);
    invoke_collect_asset_paths(objects(), paths);
    invoke_collect_asset_paths(object_instances(), paths);
    invoke_collect_asset_paths(volumes(), paths);
}
示例#22
0
void Assembly::on_frame_end(const Project& project)
{
    invoke_on_frame_end(project, assembly_instances());
    invoke_on_frame_end(project, assemblies());
    invoke_on_frame_end(project, object_instances());
    invoke_on_frame_end(project, *this, lights());
    invoke_on_frame_end(project, *this, materials());
#ifdef WITH_OSL
    invoke_on_frame_end(project, *this, shader_groups());
#endif
    invoke_on_frame_end(project, *this, edfs());
    invoke_on_frame_end(project, *this, bsdfs());
    invoke_on_frame_end(project, *this, surface_shaders());
    invoke_on_frame_end(project, texture_instances());
}
示例#23
0
    LightingView() {
        SkString diffusePath = GetResourcePath("brickwork-texture.jpg");
        SkImageDecoder::DecodeFile(diffusePath.c_str(), &fDiffuseBitmap);
        SkString normalPath = GetResourcePath("brickwork_normal-map.jpg");
        SkImageDecoder::DecodeFile(normalPath.c_str(), &fNormalBitmap);

        fLightAngle = 0.0f;
        fColorFactor = 0.0f;

        SkAutoTUnref<const SkLightingShader::Lights> lights(create_lights(fLightAngle, 1.0f));

        fShader.reset(SkLightingShader::Create(fDiffuseBitmap, fNormalBitmap,
                                               lights, SkVector::Make(1.0f, 0.0f),
                                               nullptr, nullptr));
    }
示例#24
0
  void playWithHomeTheaterFacade() {
    // Create all the parts of the home theatre system
    // Not encapsulated or owned by the facade.
    Amplifier amp("Top-O-Line Amplifier");
    CdPlayer cd("Top-O-Line CD Player", &amp);
    DvdPlayer dvd("Top-O-Line DVD Player", &amp);
    Screen screen("My Theater Screen");
    PopcornPopper popper("My Popcorn Popper");
    Tuner tuner("Top-O-Line AM/FM Tuner", &amp);
    TheaterLights lights("Theater Ceiling Lights");
    Projector projector("Top-O-Line Projector");

    HomeTheaterFacade theater(&amp, &tuner, &dvd, &cd, &projector, &lights, &screen, &popper);
    theater.watchMovie("Raiders of the Lost Ark");
    theater.endMovie();
  }
示例#25
0
void Control::pushed(int id){
	if(id == 0) {
		clearButtonLights();
		nextnumber = 1;
		cout << "System started" << endl << endl;
	}else if(X[id-1] == nextnumber){ //Spilleren traff riktig knapp
		lights(id, true); 
		++nextnumber;//neste riktige nummer inkrementeres.
		if(nextnumber == 10){
			cout<< "All lights on" << " You won! AWESOMENESS" << endl;
 		}	
	}else if(X[id-1] != nextnumber){ //Spillet skal resettes.
		cout << endl << id << " is WRONG, you suck!" << endl;
		nextnumber = 1;
		clearButtonLights();
	}
}
示例#26
0
    void RayTraceRenderPass::UploadToGPU(const Camera &cam) const
    {
        const auto primitivesUB = UniformBuffers::Get().Primitives();
		size_t offset = 0;
        primitivesUB.rectangles(mRectangles, offset);
		offset += mRectangles.size() * sizeof(RTRectangle);
        primitivesUB.boxes(mBoxes, offset);
		offset += mBoxes.size() * sizeof(RTBox);
		primitivesUB.spheres(mSpheres, offset);
		offset += mSpheres.size() * sizeof(RTSphere);
		primitivesUB.lights(mLights, offset);

		offset += mLights.size() * sizeof(RTLight);

		if (offset > PrimitivesUB::MAX_SIZE) {
			throw exception("PrimitivesUB size larger then max: " + offset);
		}
    }
示例#27
0
文件: main.cpp 项目: xeniatay/cs488
//-------------------------------------------------------------------
// init
//-------------------------------------------------------------------
void init(int argc, char** argv)
  {
      glEnable(GL_TEXTURE_2D);
	glEnable(GL_NORMALIZE);
	glShadeModel(GL_SMOOTH);
	glEnable(GL_COLOR_MATERIAL);

	// Black Background
	glClearColor(0.00f, 0.80f, 0.80f, 0.0f);

	glEnable(GL_DEPTH_TEST);

	lights();

	//glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
	makeMickey();

  }
示例#28
0
void init(void)
{
  glClearColor(1.0,1.0,1.0,1.0);
  glShadeModel(GL_SMOOTH);
  render.loadTextures();
  ball.loadTexture();
  glEnable(GL_TEXTURE_2D);
  glEnable(GL_COLOR_MATERIAL);
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glEnable(GL_DEPTH_TEST);
  lights();
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  GLfloat _x = random(-7.5, 7.5);
  GLfloat _z = random(0, 13);
  changePosition(_x,_z);

}
示例#29
0
int main() {

	// do setup 
	setup_lunchbeat();

	// and go for infinite loop
	for (;;) {
		
		controls();		// read buttons and pots
		lights();		// compute which LED to light up
		
		if (newstep) {
			newstep = 0;
			uint8_t i;
			for (i = 0; i < 4; i++) {
				if (seq[playstep] & (1 << i)) gate[i] = 1;			
			}
		}
	}
}
示例#30
0
bool Assembly::on_frame_begin(
    const Project&          project,
    const BaseGroup*        parent,
    OnFrameBeginRecorder&   recorder,
    IAbortSwitch*           abort_switch)
{
    if (!Entity::on_frame_begin(project, parent, recorder, abort_switch))
        return false;

    if (!BaseGroup::on_frame_begin(project, parent, recorder, abort_switch))
        return false;

    bool success = true;
    success = success && invoke_on_frame_begin(bsdfs(), project, this, recorder, abort_switch);
    success = success && invoke_on_frame_begin(bssrdfs(), project, this, recorder, abort_switch);
    success = success && invoke_on_frame_begin(edfs(), project, this, recorder, abort_switch);
    success = success && invoke_on_frame_begin(surface_shaders(), project, this, recorder, abort_switch);
    success = success && invoke_on_frame_begin(materials(), project, this, recorder, abort_switch);
    success = success && invoke_on_frame_begin(lights(), project, this, recorder, abort_switch);
    success = success && invoke_on_frame_begin(objects(), project, this, recorder, abort_switch);
    success = success && invoke_on_frame_begin(object_instances(), project, this, recorder, abort_switch);
    success = success && invoke_on_frame_begin(volumes(), project, this, recorder, abort_switch);
    if (!success)
        return false;

    // Collect procedural object instances.
    assert(!m_has_render_data);
    for (size_t i = 0, e = object_instances().size(); i < e; ++i)
    {
        const ObjectInstance* object_instance = object_instances().get_by_index(i);
        const Object& object = object_instance->get_object();
        if (dynamic_cast<const ProceduralObject*>(&object) != nullptr)
            m_render_data.m_procedural_object_instances.push_back(make_pair(object_instance, i));
    }
    m_has_render_data = true;

    return true;
}