예제 #1
0
파일: Scene.cs 프로젝트: lewurm/benchmarker
		/**
	 * LoadSceneOrig
	 *
	 * @param filename
	 * @return int
	 */
		private int LoadSceneOrig ()
		{
			String instr = Constants.INPUT;
			char[] spt = new char[1];
			spt [0] = '\n';
			sceneLines = instr.Split (spt);
			MainCL.logger.InfoFormat ("number of lines: {0}", sceneLines.Length);
			scenePos = 0;

			int numObj = 0, ObjID = 0;

			camera = null;
			lights = null;
			objects = null;
			materials = null;
			MaxX = MinX = MaxY = MinY = MaxZ = MinZ = 0.0f;
			String input;

			input = readString ();

			while (input != null) {
				if (input.Equals ("camera {")) {
					ReadCamera ();
				} else if (input.Equals ("point_light {")) {
					ReadLight ();
				} else if (input.Equals ("sphere {")) {
					numObj += ReadSphere (ObjID);
				} else if (input.Equals ("poly_set {")) {
					numObj += ReadPoly (ObjID);
				} else {
					;
				}

				input = readString ();
			}

			return (numObj);
		}
예제 #2
0
파일: Scene.cs 프로젝트: lewurm/benchmarker
		/**
	 * ReadLight
	 *
	 * @param infile
	 */
		private void ReadLight ()
		{
			String temp;
			double[] input = new double[3];
			int i;

			temp = readString ();
			temp = temp.Substring (11);
			for (i = 0; i < 2; i++) {
				input [i] = (double)Double.Parse (temp.Substring (0, temp.IndexOf (' ')));
				temp = temp.Substring (temp.IndexOf (' ') + 1);
			}
			input [2] = (double)Double.Parse (temp);
			Point position = new Point (input [0], input [1], input [2]);
			temp = readString ();
			temp = temp.Substring (8);
			for (i = 0; i < 2; i++) {
				input [i] = (double)Double.Parse (temp.Substring (0, temp.IndexOf (' ')));
				temp = temp.Substring (temp.IndexOf (' ') + 1);
			}
			input [2] = (double)Double.Parse (temp);
			Color color = new Color (input [0], input [1], input [2]);
			temp = readString ();
			Light newlight = new Light (position, color);
			LightNode newnode = new LightNode (newlight, lights);
			lights = newnode;
		}