• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Light函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Light函数的典型用法代码示例。如果您正苦于以下问题:C++ Light函数的具体用法?C++ Light怎么用?C++ Light使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Light函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: stage

Graphics::Graphics(const RECT& rect) : stage(rect) {
	linePainter = new LinePainter(rect);

	AssertEx(rect.bottom - rect.top == rect.right - rect.left, "only square stage is supported");

	camera = new Camera(moveSpeed, rotateSpeed, rect.bottom - rect.top);

	LightAttribute lightAttr;
	lightAttr.diffuse = Color(255, 255, 255);
	lightAttr.direction = Vector3::right;
	lightAttr.lightOn = true;
	lightAttr.lightType = LightTypeDirection;
	lightAttr.position.Set(200, 0, 0);
	camera->AddLight(Light(lightAttr));

	lightAttr.ambient = Color(90, 90, 90);
	lightAttr.lightType = LightTypeAmbient;
	lightAttr.lightOn = true;
	camera->AddLight(Light(lightAttr));

	zBuffer = new ZBuffer(stage.right - stage.left, stage.bottom - stage.top);

	VertexContainer vertices;
	IndexedTriangleContainer triangles;
	CreatePlane(vertices, triangles, Texture("bmp/metal.bmp"), 2, 3);
	street = new Object();
	//street->Initialize(vertices, triangles, 5.f, 12.f, Vector3(), Vector3());
	AddObject(street);

	xmin = stage.left + 1;
	xmax = stage.right - 2;
	ymin = stage.top + 1;
	ymax = stage.bottom - 2;
}
开发者ID:OasisGallagher,项目名称:SimpleGraphicEngine,代码行数:34,代码来源:graphics.cpp


示例2: can_see

/** Can a player see something?
 * \param player the looker.
 * \param thing object to be seen.
 * \param can_see_loc 1 if player can see the location, 0 if location is dark.
 * \retval 1 player can see thing.
 * \retval 0 player can not see thing.
 */
int
can_see(dbref player, dbref thing, int can_see_loc)
{
  if (!can_interact(thing, player, INTERACT_SEE, NULL))
    return 0;

  /*
   * 1) your own body isn't listed in a 'look' 2) exits aren't listed in a
   * 'look' 3) unconnected (sleeping) players aren't listed in a 'look'
   */
  if (player == thing || IsExit(thing) ||
      (IsPlayer(thing) && !Connected(thing)))
    return 0;

  /* if thing is in a room set LIGHT, it can be seen */
  else if (IS(Location(thing), TYPE_ROOM, "LIGHT"))
    return 1;

  /* if the room is non-dark, you can see objects which are light or non-dark */
  else if (can_see_loc)
    return (Light(thing) || !DarkLegal(thing));

  /* otherwise room is dark and you can only see lit things */
  else
    return (Light(thing));
}
开发者ID:zetafunction,项目名称:pennmush-mirror,代码行数:33,代码来源:predicat.c


示例3: sceneFive

/* SCENE DESCRIPTION:
 *    -> Cube test.
 */
void sceneFive()
{
    /* First, allocates enough space for all the structures.*/
    noObjects = 2;
    noLights = 2;

    objects = new Object *[noObjects];
    lights = new Light[noLights];

    /* Spheres initialization. */
    Cube *cube = new Cube(200.0,300, 500.0, 200,200,200, 1.0, 0.0, 0.0);
    (*cube).setReflection(0.0);
    (*cube).setShininess(50);
    (*cube).setSpecular(1, 1, 1);
    (*cube).setRefraction(0.0);

    objects[0] = cube;

    /* Back wall.*/
    vector normalOne = {1, 0, 0};
    Plane *plane = new Plane(0,0,0, normalOne, 0.1,0.1,0.8);
    (*plane).setReflection(0.0);
    (*plane).setShininess(50);
    (*plane).setSpecular(0.1, 0.1, 0.1);
    (*plane).setRefraction(0);

    objects[1] = plane;

    /* Lights initialization. */
    //lights[0] = Light(300,10000,6000, 1.0, 1, 1, 1);
    lights[0] = Light(300,400,-1000, 1.0, 1, 1, 1);
    lights[1] = Light(1000,400,500, 1.0, 1, 1, 1);
}
开发者ID:jpbarbosa,项目名称:reiTracing,代码行数:36,代码来源:scene.cpp


示例4: sceneThree

/* SCENE DESCRIPTION:
 *    -> There is one ground plane and two spheres, one blue and another red.
 */
void sceneThree()
{
    /* First, allocates enough space for all the structures.*/
    noObjects = 4;
    noLights = 2;

    objects = new Object *[noObjects];
    lights = new Light[noLights];

    /* Spheres initialization. */
    Sphere *sphere = new Sphere(500.0,500, 800.0, 280.0, 0.0, 0.0, 0.0);
    (*sphere).setReflection(0.9);
    (*sphere).setShininess(50);
    (*sphere).setSpecular(1, 1, 1);
    (*sphere).setRefraction(0.0);

    objects[0] = sphere;

    sphere = new Sphere(50.0,520.0, 600.0, 200.0, 0.0, 0.0, 1.0);
    (*sphere).setReflection(0.0);
    (*sphere).setShininess(50);
    (*sphere).setSpecular(1, 1, 1);
    (*sphere).setRefraction(0.0);

    /*sphere = new Sphere(450.0,300.0, 100.0, 50.0, 0.1, 0.1, 0.1);
    (*sphere).setReflection(0.0);
    (*sphere).setShininess(10);
    (*sphere).setSpecular(0.2, 0.2, 0.2);
    (*sphere).setDiffuse(0.2, 0.2, 0.2);
    (*sphere).setRefraction(0.5);*/

    objects[1] = sphere;

    /* Planes initialization. */

    /* Ground. */
    vector normalZero = {0, 1, 0};
    Plane *plane = new Plane(0,0,0, normalZero, 0.0,0.0,0.7);
    (*plane).setReflection(0.0);
    (*plane).setShininess(20);
    (*plane).setSpecular(0.6, 0.4, 0.2);
    (*plane).setRefraction(0);

    objects[2] = plane;

    /* Right wall. */
    vector normalOne = {-1, 0, 0};
    plane = new Plane(1600,0,0, normalOne, 0.0,0.0,0.0);
    (*plane).setReflection(0.9);
    (*plane).setShininess(50);
    (*plane).setSpecular(1, 1, 1);
    (*plane).setRefraction(0);

    objects[3] = plane;

    /* Lights initialization. */
    lights[0] = Light(300,10000,6000, 1.0, 1, 1, 1);
    lights[1] = Light(300,400,-6000, 1.0, 1, 1, 1);
}
开发者ID:jpbarbosa,项目名称:reiTracing,代码行数:62,代码来源:scene.cpp


示例5: look_exits

/* Show the 'Obvious Exits' list for a room. Used in 'look' and 'examine'.
 * \param player The player looking
 * \param loc room whose exits we're showing
 * \param exit_name "Obvious Exits" string
 * \param pe_info the pe_info to use for evaluating EXITFORMAT and interact locks
 */
static void
look_exits(dbref player, dbref loc, const char *exit_name, NEW_PE_INFO *pe_info)
{
  dbref thing;
  char *tbuf1, *tbuf2, *nbuf;
  char *s1, *s2;
  char *p;
  int exit_count, this_exit, total_count;
  int texits;
  ufun_attrib ufun;
  PUEBLOBUFF;

  /* make sure location is a room */
  if (!IsRoom(loc))
    return;

  tbuf1 = (char *) mush_malloc(BUFFER_LEN, "string");
  tbuf2 = (char *) mush_malloc(BUFFER_LEN, "string");
  nbuf = (char *) mush_malloc(BUFFER_LEN, "string");
  if (!tbuf1 || !tbuf2 || !nbuf)
    mush_panic("Unable to allocate memory in look_exits");
  s1 = tbuf1;
  s2 = tbuf2;
  texits = exit_count = total_count = 0;
  this_exit = 1;

  if (fetch_ufun_attrib
      ("EXITFORMAT", loc, &ufun, UFUN_IGNORE_PERMS | UFUN_REQUIRE_ATTR)) {
    char *arg, *buff, *bp;
    PE_REGS *pe_regs = pe_regs_create(PE_REGS_ARG, "look_exits");

    arg = (char *) mush_malloc(BUFFER_LEN, "string");
    buff = (char *) mush_malloc(BUFFER_LEN, "string");
    if (!arg || !buff)
      mush_panic("Unable to allocate memory in look_exits");

    bp = arg;
    DOLIST(thing, Exits(loc)) {
      if (((Light(loc) || Light(thing)) || !(Dark(loc) || Dark(thing)))
          && can_interact(thing, player, INTERACT_SEE, pe_info)) {
        if (bp != arg)
          safe_chr(' ', arg, &bp);
        safe_dbref(thing, arg, &bp);
      }
    }
    *bp = '\0';
    pe_regs_setenv_nocopy(pe_regs, 0, arg);

    call_ufun(&ufun, buff, player, player, pe_info, pe_regs);

    pe_regs_free(pe_regs);
    notify_by(loc, player, buff);
    mush_free(tbuf1, "string");
    mush_free(tbuf2, "string");
    mush_free(nbuf, "string");
    mush_free(arg, "string");
    mush_free(buff, "string");
    return;
  }
开发者ID:ccubed,项目名称:MuDocker,代码行数:65,代码来源:look.c


示例6: main

/*!****************************************************************************
 @Function		main
 @Return		int			result code to OS
 @Description	Main function of the program
******************************************************************************/
int main()
{
    initEGL();
    Init();
    //create_texture();

	for(;;)
	{
		glClear(GL_COLOR_BUFFER_BIT);
		/*
			Clears the color buffer.
			glClear() can also be used to clear the depth or stencil buffer
			(GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT)
		*/
		glClearColor(0.0, 0.5, 0.5, 1.0);
		glClear(GL_DEPTH_BUFFER_BIT);
		if (!TestEGLError("glClear"))
		{
			goto cleanup;
		}


		glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glColorMask(false, true, true, true);
		Light(0); 
		Render(0); 
		glClear( GL_DEPTH_BUFFER_BIT) ;
		glColorMask(true, false, false, true);
		Light(1); 
		Render(1); 
		glColorMask( true, true, true, true);

		XRotate+=0.5; 
		/*
			Swap Buffers.
			Brings to the native display the current render surface.
		*/
		eglSwapBuffers(eglDisplay, eglSurface);
		if (!TestEGLError("eglSwapBuffers"))
		{
			goto cleanup;
		}
	}

	/*
		Step 8 - Terminate OpenGL ES and destroy the window (if present).
		eglTerminate takes care of destroying any context or surface created
	*/
cleanup:
	// Delete the VBO as it is no longer needed
	glDeleteBuffers(1, &ui32Vbo);
	eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) ;
	eglTerminate(eglDisplay);

	return 0;
}
开发者ID:aditya-nellutla,项目名称:3d-anaglyph-example,代码行数:61,代码来源:gl_sterio3d.cpp


示例7: sceneFour

/* SCENE DESCRIPTION:
 *    -> Sea theme.
 */
void sceneFour()
{
    fadingCoeficient = 100000;
    fullLightLimit = 1000000;

    /* First, allocates enough space for all the structures.*/
    noObjects = 4;
    noLights = 2;

    objects = new Object *[noObjects];
    lights = new Light[noLights];

    /* Spheres initialization. */
    Sphere *sphere = new Sphere(550.0,400, 500.0, 180.0, 0.0, 0.0, 0.0);
    (*sphere).setReflection(0.0);
    (*sphere).setShininess(50);
    (*sphere).setSpecular(1, 1, 1);
    (*sphere).setRefraction(0.5);

    objects[0] = sphere;

    sphere = new Sphere(300.0,380.0, 1000.0, 150.0, 0.0, 0.0, 1.0);
    (*sphere).setReflection(0.0);
    (*sphere).setShininess(50);
    (*sphere).setSpecular(1, 1, 1);
    (*sphere).setRefraction(0.0);

    objects[1] = sphere;

    /* Planes initialization. */

    /* Ground. */
    vector normalZero = {0, 1, 0};
    Plane *plane = new Plane(0,0,0, normalZero, 0.0,0.0,0.3);
    (*plane).setReflection(0.5);
    (*plane).setShininess(20);
    (*plane).setSpecular(0.6, 0.6, 0.6);
    (*plane).setRefraction(0.0);

    objects[2] = plane;

    /* Back wall.*/
    vector normalTwo = {0, 0, -1};
    plane = new Plane(0,0,100000, normalTwo, 0.1,0.1,0.8);
    (*plane).setReflection(0.5);
    (*plane).setShininess(0.1);
    (*plane).setSpecular(0.1, 0.1, 0.1);
    (*plane).setRefraction(0);

    objects[3] = plane;

    /* Lights initialization. */
    lights[0] = Light(300,10000,6000, 1.0, 1, 1, 1);
    lights[1] = Light(300,10000,-6000, 1.0, 1, 1, 1);
}
开发者ID:jpbarbosa,项目名称:reiTracing,代码行数:58,代码来源:scene.cpp


示例8: sceneTriangles

/* SCENE DESCRIPTION:
 *    -> The triangle scene test.
 */
void sceneTriangles()
{

    /* First, allocates enough space for all the structures.*/
    noObjects = 3;
    noLights = 2;

    objects = new Object *[noObjects];
    lights = new Light[noLights];

    /* Triangles initialization. */
    Triangle *triangle = new Triangle(1.0, 0.0, 0.0);
    (*triangle).setVertix(2, 700, 400, 1000);
    (*triangle).setVertix(1, 900, 400, 200);
    (*triangle).setVertix(0, 800, 700, 1700);
    (*triangle).setNormal();
    (*triangle).setReflection(0.0);
    (*triangle).setShininess(50);
    (*triangle).setSpecular(1, 1, 1);
    (*triangle).setRefraction(0.0);

    objects[0] = triangle;

    triangle = new Triangle(0.0, 1.0, 0.0);
    (*triangle).setVertix(2, 800, 700, 1700);
    (*triangle).setVertix(1, 900, 400, 200);
    (*triangle).setVertix(0, 1200, 700, 500);
    (*triangle).setNormal();
    (*triangle).setReflection(0.0);
    (*triangle).setShininess(50);
    (*triangle).setSpecular(1, 1, 1);
    (*triangle).setRefraction(0.0);

    objects[1] = triangle;

    triangle = new Triangle(0.0, 0.0, 1.0);
    (*triangle).setVertix(2, 900, 400, 200);
    (*triangle).setVertix(1, 1600, 500, 1000);
    (*triangle).setVertix(0, 1200, 700, 500);
    (*triangle).setNormal();
    (*triangle).setReflection(0.0);
    (*triangle).setShininess(50);
    (*triangle).setSpecular(1, 1, 1);
    (*triangle).setRefraction(0.0);

    objects[2] = triangle;

    /* Lights initialization. */
    lights[0] = Light(0,10000,6000, 1.0, 1, 1, 1);
    lights[0] = Light(800,700,-6000, 1.0, 1, 1, 1);

}
开发者ID:jpbarbosa,项目名称:reiTracing,代码行数:55,代码来源:scene.cpp


示例9: main

int main() {
   const int height = 2000;
   const int width = 2000;
        
   ofstream image;
   image.open("out.ppm");
   image << "P3" << '\n' << width << ' ' << height << '\n' << 255 << '\n';
        
   Point camera(0,0,0);
        
   Light lights [3] = { Light(Point(1200,0,800), Colour(255,0,0)),
                        Light(Point(1200,800,0), Colour(0,255,0)),
                        Light(Point(1200,-800,0), Colour(0,0,255)) };
        
   Colour background;

   Sphere sphere(Point(2000,0,0),700);

   Point plane_point;
   Point surface_point;
        
   //std::cout << illuminate(Point(0,0,0),Vector(2,2,2),Light(Point(4,4,4),Colour(2,2,2))).convertToString() << std::endl;
        
   //std::cout << Line(Point(0,0,0),Vector(1,0,0)).intersect(Sphere(Point(10,0,0),2)) << std::endl;
        
   Line ray;
   Vector direction;
   Colour point_colour;
   for (int z = 1000; z > -1000; z-=1) {
      for (int y = -1000; y < 1000; y+=1) {
         plane_point = Point(1000,y,z);
         direction = plane_point - camera;

         ray = Line(camera, direction);

         if (ray.intersect(sphere)) {
            surface_point = ray.point_intersect(sphere);
            point_colour = illuminate(surface_point, surface_point - sphere.center(), lights);
            point_colour = boundColour(point_colour, 0, 255);
            image << point_colour.convertToString() << ' ';
            //image << "255 255 255 ";
         } else {
            image << background.convertToString() << ' ';
         }
      }
      image << '\n';
   }

   image.close();

   return 0;
}
开发者ID:srcreigh,项目名称:reightracer,代码行数:52,代码来源:reightracer.cpp


示例10: main

int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QTextCodec *codec = QTextCodec::codecForName("gb2312");
    QTextCodec::setCodecForCStrings(codec);
    QTextCodec::setCodecForLocale(codec);
    QTextCodec::setCodecForTr(codec);

    app.setApplicationName("bowling");
    QPixmapCache::setCacheLimit(100 * 1024); // 100 MB
    if (!createConnection())
            return -1;

    const char *map =
            "#####=######"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          *"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          $"
            "#          #"
            "#          #"
            "#######(####";

    QVector<Light> lights;
    lights << Light(QPointF(3.5, 2.5), 1)
           << Light(QPointF(3.5, 6.5), 1)
           << Light(QPointF(1.5, 10.5), 0.3);

    MazeScene *scene = new MazeScene(lights, map, 12, 20);

    View view;
    view.resize(800, 600);
    view.setScene(scene);
    view.show();

    scene->toggleRenderer();

    return app.exec();
}
开发者ID:zweecn,项目名称:Bowling,代码行数:51,代码来源:main.cpp


示例11: can_see

bool
can_see(dbref player, dbref thing, bool can_see_loc)
{
    if (!OkObj(player) || !OkObj(thing))
        return 0;

    if (player == thing || Typeof(thing) == TYPE_EXIT
        || Typeof(thing) == TYPE_ROOM)
        return 0;

    if (Light(thing))
        return 1;

    if (can_see_loc) {
        switch (Typeof(thing)) {
            case TYPE_PROGRAM:
                return ((FLAGS(thing) & LINK_OK) || controls(player, thing)
                        || (POWERS(player) & POW_SEE_ALL));
            case TYPE_PLAYER:
                if (tp_dark_sleepers) {
                    return (!Dark(thing) || online(thing)
                            || (POWERS(player) & POW_SEE_ALL));
                }
            default:
                return (!Dark(thing) || (POWERS(player) & POW_SEE_ALL) ||
                        (controls(player, thing) && !(FLAGS(player) & STICKY)));

        }
    } else {
        /* can't see loc */
        return (controls(player, thing) && !(FLAGS(player) & STICKY));
    }
}
开发者ID:nekosune,项目名称:protomuck,代码行数:33,代码来源:predicates.c


示例12: Light

	void LightManager::popLight()
	{
		if( curNumLights > 0 )
		{
			m_Lights[ --curNumLights ] = Light();
		}
	}
开发者ID:kaylareedhanson,项目名称:raytracer,代码行数:7,代码来源:Light.cpp


示例13: glUseProgram

void LightingManager::Init(Shader lightingShader)
{
	_shader = lightingShader.shaderPointer;
	glUseProgram(_shader);
	for (int i = 0; i < MAX_LIGHTS; ++i)
	{
		_lights[i] = Light();
		_lights[i].position = glm::vec3();
		_lights[i].linearVelocity = glm::vec3();
		_lights[i].rotation = glm::quat();
		_lights[i].rotationOrigin = glm::vec3();
		_lights[i].angularVelocity = glm::quat();
		_lights[i].transformPos = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
		_lights[i].color = glm::vec4();
		_lights[i].power = 0.0f;

		std::string currentLight = "lights[";
		char numStringBuffer[32];
		itoa(i, numStringBuffer, 10);
		currentLight += numStringBuffer;
		currentLight += "].";
		std::string pos = "position";
		std::string col = "color_difPower";
		_lights[i].uPosition = glGetUniformLocation(_shader, (currentLight + pos).c_str());
		_lights[i].uColor_difPower = glGetUniformLocation(_shader, (currentLight + col).c_str());
	}	

	_uAmbient = glGetUniformLocation(_shader, "ambient");
}
开发者ID:IGME-RIT,项目名称:graphics-glfw-geometricLightingImproved,代码行数:29,代码来源:LightingManager.cpp


示例14: CreateTempLight

void ParticleRenderer::CreateTempLight(const vec3& color, float strength, const vec3& position, const vec3& velocity, const vec3& target_velocity, float time_factor) {
	if (lights_.size() < max_light_count_) {
		lights_.push_back(Light(color, strength, position, velocity, target_velocity, time_factor));
		//log_.Infof("Creating new light with strength %f", strength);
	} else {
		int darkest_light_index = -1;
		float darkest_light_strength = 1e15f;
		int i = 0;
		LightArray::iterator x = lights_.begin();
		for (; x < lights_.end(); ++x, ++i) {
			if (x->strength_ < darkest_light_strength) {
				darkest_light_index = i;
				darkest_light_strength = x->strength_;
			}
		}
		if (strength >= darkest_light_strength && darkest_light_index >= 0) {
			//mLog.Infof("Overtaking light with render ID %i (had strength %f, got strength %f"), mLights[lDarkestLightIndex].mRenderLightId, mLights[lDarkestLightIndex].mStrength, pStrength);
			// TRICKY: don't overwrite! We must not leak the previosly allocated hardware light!
			lights_[darkest_light_index].color_ = color;
			lights_[darkest_light_index].strength_ = strength;
			lights_[darkest_light_index].position_ = position;
			lights_[darkest_light_index].velocity_ = velocity;
			lights_[darkest_light_index].target_velocity_ = target_velocity;
			lights_[darkest_light_index].time_factor_ = time_factor;
		}
	}
}
开发者ID:highfestiva,项目名称:life,代码行数:27,代码来源:uiparticlerenderer.cpp


示例15: void

//-----------------------------------------------------------------------------
void mglGraphGLUT::Window(int argc, char **argv,int (*draw)(mglGraph *gr, void *p),const char *title, void *par, void (*reload)(int next, void *p), bool maximize)
{
	NumFig=0;	curr_fig=1;	tt=0;
	_mgl_glwnd = this;
	CurFrameId = 1;

	char *tmp[1];	tmp[0]=new char[1];	tmp[0][0]=0;
	glutInit(&argc, argv ? argv:tmp);
	delete []tmp[0];
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowSize(600, 600);
	glutCreateWindow("MathPlotLibrary");

	Light(0,mglPoint(0,0,3),false);
	NumFig = draw(this,par)-1;	Finish();
	DrawFunc = draw;	FuncPar = par;
	LoadFunc = reload;
	glutSetWindowTitle(title);

	glutDisplayFunc(_mgl_display);
	glutKeyboardUpFunc(_mgl_key_up);
	glutTimerFunc(int(1000*Delay),_mgl_timer,0);

	// TODO Add window maximazing at start up ???

	glutMainLoop();
	glDeleteLists(1,NumFig);
}
开发者ID:ClinicalGraphics,项目名称:MathGL,代码行数:29,代码来源:mgl_glut.cpp


示例16: Light

Light operator*(const double& scalar, const Light& light) {
  return Light(
    scalar * light.red,
    scalar * light.green,
    scalar * light.blue
  );
}
开发者ID:xavierm02,项目名称:PROG1-projet-3,代码行数:7,代码来源:Light.cpp


示例17: Light

BOOL CLogo::Tick(DWORD fElapsedTime, BOOL skip)
{
	m_lText += fElapsedTime;
	m_lElapsedTime += fElapsedTime;
	if (!m_bEntering && m_lText > 2500) {
		Light(RL_START);
		m_lText = 0;
		m_bEnableSkip = TRUE;
	}
	if (skip && m_bEnableSkip) m_bEntering = TRUE;
	if (echoes.empty()) {
		if (m_bEntering) return TRUE;
		else if (m_lElapsedTime > 10000) {
			Fire();
			m_lElapsedTime = 0;
		}
	} else if (echoes[0]->IsGone()) {
		ClearCircles();
	}

	for (UINT i(0); i < echoes.size(); ++i) 
		echoes[i]->Tick(fElapsedTime);
	for (ElementsIt it(elements.begin()); it != elements.end();) {
		(*it)->Tick(fElapsedTime);
		if ((*it)->IsGone()) {
			SAFE_DELETE(*it);
			it = elements.erase(it);
			continue;
		}
		++it;
	}
	//return skip;	// Toggle comment here to enable skip anytime
	return FALSE;
}
开发者ID:YunHsiao,项目名称:Echo,代码行数:34,代码来源:Logo.cpp


示例18: first_visible

/** Return the first object near another object that is visible to a player.
 *
 * BEWARE:
 *
 * first_visible() does not behave as intended. It _should_ return the first
 * object in `thing' that is !DARK. However, because of the controls() check
 * the function will return a DARK object if the player owns it.
 *
 * The behavior is left as is because so many functions in fundb.c rely on
 * the incorrect behavior to return expected values. The lv*() functions
 * also make rewriting this fairly pointless.
 *
 * \param player the looker.
 * \param thing an object in the location to be inspected.
 * \return dbref of first visible object or NOTHING.
 */
dbref
first_visible(dbref player, dbref thing)
{
  int lck = 0;
  int ldark;
  dbref loc;

  if (!GoodObject(thing) || IsRoom(thing))
    return NOTHING;
  loc = IsExit(thing) ? Source(thing) : Location(thing);
  if (!GoodObject(loc))
    return NOTHING;
  ldark = IsPlayer(loc) ? Opaque(loc) : Dark(loc);

  while (GoodObject(thing)) {
    if (can_interact(thing, player, INTERACT_SEE, NULL)) {
      if (DarkLegal(thing) || (ldark && !Light(thing))) {
        if (!lck) {
          if (See_All(player) || (loc == player) || controls(player, loc))
            return thing;
          lck = 1;
        }
        if (controls(player, thing))    /* this is what causes DARK objects to show */
          return thing;
      } else {
        return thing;
      }
    }
    thing = Next(thing);
  }
  return thing;
}
开发者ID:zetafunction,项目名称:pennmush-mirror,代码行数:48,代码来源:predicat.c


示例19: if

void World::RenderGroup(SceneGroup *i, mat4 t) 
{
	int ii, time = 0;
	// sphere vars
	double r;
	MaterialInfo m;
	
	// light vars
	LightInfo l;
	
	// camera vars
	CameraInfo f;
	   
	// if this is a terminal node
	if (i->getChildCount() == 0) {
		
		// if this node is a sphere
		if (i->computeSphere(r,m,time)) {
			_spheres.push_back(Sphere(vec4(0,0,0,1), r, m, t));
		} else if (i->computeLight(l)) {
			
			if (l.type == LIGHT_POINT) {
				_lights[l.type].push_back(Light(vec3(t*vec4(0,0,0,1),VW),0, l));
			}else if (l.type == LIGHT_DIRECTIONAL){
				_lights[l.type].push_back(Light(0,vec3(t*vec4(0,0,-1,0),VW), l));
			}else if (l.type == LIGHT_AMBIENT)
				_ambientLight = l.color;
				
		} else if (i->computeCamera(f)) {
			vec4 eye(0.0, 0.0, 0.0, 1.0);
		    vec4 LL(f.sides[FRUS_LEFT], f.sides[FRUS_BOTTOM], -1*f.sides[FRUS_NEAR], 1.0);
		    vec4 UL(f.sides[FRUS_LEFT], f.sides[FRUS_TOP], -1*f.sides[FRUS_NEAR], 1.0);
		    vec4 LR(f.sides[FRUS_RIGHT], f.sides[FRUS_BOTTOM], -1*f.sides[FRUS_NEAR], 1.0);
		    vec4 UR(f.sides[FRUS_RIGHT], f.sides[FRUS_TOP], -1*f.sides[FRUS_NEAR], 1.0);

		    _view = Viewport(eye, LL, UL, LR, UR, IMAGE_WIDTH, IMAGE_HEIGHT);
		}
		
	} else {
		
		// expand and traverse this node
		for(ii=0; ii<i->getChildCount();ii++) 
			RenderInstance(i->getChild(ii), t);
		
	}
	
}
开发者ID:therichardnguyen,项目名称:-CS184-AS5,代码行数:47,代码来源:World.cpp


示例20: Light

inline Light Scene::light(unsigned i) const
{
	if(i < _lights.size()) {
		return _lights[i];
	} else {
		return Light(Point(), Colour());
	}
}
开发者ID:asandroq,项目名称:virtuality,代码行数:8,代码来源:scene.hpp



注:本文中的Light函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LightScheduler_ScheduleTurnOn函数代码示例发布时间:2022-05-30
下一篇:
C++ LiceColor函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap