Inheritance: IDisposable
Ejemplo n.º 1
0
        public BaseFrameMgr(GameWindow gameWindow, ShaderProgram positionColorShader, ShaderProgram positionTextureShader)
        {
        	this.gameWindow = gameWindow;
            this.gameWindow.Resize += new EventHandler<EventArgs>(GameWindow_Resize);

            PositionColor.Shader = positionColorShader;
            PositionTexture.Shader = positionTextureShader;
        }
Ejemplo n.º 2
0
Archivo: Model.cs Proyecto: tpb3d/TPB3D
		public Model(ShaderProgram shader, Group[] groups, Bone[] bones, Sample[] samples)
		{
			this.shader = shader;
			this.groups = groups;
			this.bones = bones;
            this.samples = samples;
			
			this.vertexTransformations = new Matrix4[maxBones];
			for (int i = 0; i < maxBones ; i++ ) 
			{
				this.vertexTransformations[i] = Matrix4.Identity;
			}
			
			Console.WriteLine(string.Format("Model created with {0} bones and {1} groups.", bones.Length, groups.Length));
			
			shader.Use();
			shader.SetSamplerUniform(sampler0UniformName, 0);
			this.boneAttribIndex = shader.FindAttribIndex(boneAttributeName);
		}
Ejemplo n.º 3
0
Archivo: Game.cs Proyecto: tpb3d/TPB3D
        public Game()  
		{
			game = this;
				
			this.Width = 800;
			this.Height = 600;
			this.Title = "OOGL Example";
			
			this.VSync = VSyncMode.Off;
			
			ResourceLocator.RootPath = System.Environment.CurrentDirectory + "/../../../Media/";
			
			ShaderProgram positionColorShader = new ShaderProgram(ResourceLocator.GetFullPath("Shaders/guiColored.vs"), ResourceLocator.GetFullPath("Shaders/guiColored.fs"));
			ShaderProgram positionTextureShader = new ShaderProgram(ResourceLocator.GetFullPath("Shaders/guiTextured.vs"), ResourceLocator.GetFullPath("Shaders/guiTextured.fs"));
			
			this.frameMgr = new BaseFrameMgr(this, positionColorShader, positionTextureShader);

            this.Keyboard.KeyDown += new EventHandler<KeyboardKeyEventArgs>(Game_KeyDown);
            this.Keyboard.KeyUp += new EventHandler<KeyboardKeyEventArgs>(Game_KeyUp);

            this.Mouse.ButtonDown += new EventHandler<MouseButtonEventArgs>(Game_MouseDown);
            this.Mouse.ButtonUp += new EventHandler<MouseButtonEventArgs>(Game_MouseUp);
            this.Mouse.Move += new EventHandler<MouseMoveEventArgs>(Game_MouseMove);
            this.Mouse.WheelChanged += new EventHandler<MouseWheelEventArgs>(Game_WheelChanged);
									
			new DemoWindow(this.frameMgr);
			new PlayerWindow(this.frameMgr);
			new RadarWindow(this.frameMgr);
			new WaypointWindow(this.frameMgr);

            this.frameMgr.LoadWorkspace();
		
			Ms3dLoader.File ms3dFile = new Ms3dLoader.File(ResourceLocator.GetFullPath("Models/Beta_Kamujin/Beta_Kamujin.ms3d"));

            Sample[] tracks = Sample.Load(ResourceLocator.GetFullPath("Models/Beta_Kamujin/Beta_Kamujin.animations"));
			ShaderProgram modelShader = new ShaderProgram(ResourceLocator.GetFullPath("Shaders/skeletalAnimation.vs"), ResourceLocator.GetFullPath("Shaders/skeletalAnimation.fs"));
            this.model = ms3dFile.ToModel(modelShader, tracks);
            this.controller = new Controller(model);
		}
Ejemplo n.º 4
0
Archivo: File.cs Proyecto: tpb3d/TPB3D
		public OOGL.Animation.Model ToModel(ShaderProgram shader, OOGL.Animation.Sample[] tracks)
		{
			OOGL.Animation.Group[] groups = new OOGL.Animation.Group[this.groups.Length];
			for(int i = 0; i < this.groups.Length; i++)
			{
				ushort[] indices;
				OOGL.Animation.VertexStruct[] vertices = GetVertices(i, out indices);
			
				groups[i] = new OOGL.Animation.Group
				(
					this.groups[i].name,
					this.materials[this.groups[i].materialIndex].GetOOGLMaterial(this.fileName),
					vertices,
					indices
				);
			}

			OOGL.Animation.Bone[] bones = new OOGL.Animation.Bone[this.joints.Length];
			AddChildBones("", null, bones);

            OOGL.Animation.Model model = new OOGL.Animation.Model(shader, groups, bones, tracks);
			
			return model;
		}