L B Posted December 31, 2009 Share Posted December 31, 2009 Just got done implementing Framework into C#. I run this scene at 60 FPS, which is the top I can seem to get in editor or in C#. So performance wise, it's quite good. I'll let you judge for the simplicity: public static void Main() { FileSystem.AbstractPath = @"C:\Program Files\Leadwerks Engine SDK"; Graphics.Initialize(800, 600); Framework.Initialize(); Scene.Load("abstract::test.sbx"); FreeCamera fc = new FreeCamera(Framework.Layers.Main.Camera); // Custom class Framework.Effects.Water = true; Framework.Effects.Parameters.Water.Height = 2.0f; Framework.Effects.DistanceFog = true; Framework.Effects.Bloom = true; Framework.Effects.VolumetricLighting = true; Framework.Effects.HighDynamicRange = true; Framework.Effects.Skybox = Material.Load("abstract::FullskiesBlueClear0016_2_L.mat"); while (!Keyboard.KeyHit(Key.Escape)) { fc.Update(); Framework.Update(); Framework.Render(); Graphics.Flip(); } Framework.Terminate(); Engine.Terminate(); } 1 Quote Link to comment Share on other sites More sharing options...
Niosop Posted December 31, 2009 Share Posted December 31, 2009 Excellent, looks very clean So is Framewerk fully wrapped now? Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
L B Posted December 31, 2009 Author Share Posted December 31, 2009 Completely. See this thread for download. Quote Link to comment Share on other sites More sharing options...
L B Posted December 31, 2009 Author Share Posted December 31, 2009 Quote Link to comment Share on other sites More sharing options...
Rick Posted December 31, 2009 Share Posted December 31, 2009 That looks clean. The only thing that seems backwards is: Framework.Effects.Water = true; Framework.Effects.Parameters.Water.Height = 2.0f; I'd think it would be: Framework.Effects.Water.Enabled = true; Framework.Effects.Water.Parameters.Height = 2.0f; That seems more logical to me. Or really you wouldn't even need Parameters just Water.Height. That's the more .NET way of things Quote Link to comment Share on other sites More sharing options...
L B Posted December 31, 2009 Author Share Posted December 31, 2009 I chose this method because we seldom access parameters and some effects don't even have any, but I'll consider your approach. Quote Link to comment Share on other sites More sharing options...
Rick Posted December 31, 2009 Share Posted December 31, 2009 Either way, no biggie. By having the .Enabled and such as opposed to just making the effect name true/false it opens up for future expansion of new effects that have parameters or old effects to get parameters at some point and could save you time & consistency issues later. That's all I was thinking. Otherwise I like it. Quote Link to comment Share on other sites More sharing options...
ZeroByte Posted December 31, 2009 Share Posted December 31, 2009 Well done Ubu, look's like you got it working nicely, nice screenshot. Hey, i'm trying to use that code in vb.net, but i can't find the FreeCamera in this line. FreeCamera fc = new FreeCamera(Framework.Layers.Main.Camera); // Custom class In vb.net it look's like this Dim fc As New FreeCamera(Framework.Layers.Main.Camera) It say's type FreeCamera is not defined. Any idea what i'm doing wrong ? Thank's. Quote Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI. Link to comment Share on other sites More sharing options...
ZeroByte Posted December 31, 2009 Share Posted December 31, 2009 Ok, i missed the comment "//custom class" duh. How did you define the FreeCamera, in you custom class? Thank's Quote Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI. Link to comment Share on other sites More sharing options...
L B Posted December 31, 2009 Author Share Posted December 31, 2009 FreeCamera is basically a spectator, only faster to make for me. Here's the code, but I don't guarantee it's clean or efficient. It's just for my personal development use that I made it: using Leadwerks; namespace Origins { public class FreeCamera { public Camera Camera { get; set; } public float SpeedMultiplier { get; set; } private Vector3 CameraRotation { get; set; } private Vector2 MouseDelta { get; set; } private float Move { get; set; } private float Strafe { get; set; } public FreeCamera(Camera camera) { this.Camera = camera; this.SpeedMultiplier = 10.0f; this.CameraRotation = new Vector3(); this.MouseDelta = new Vector2(); this.Move = 0.0f; this.Strafe = 0.0f; Mouse.Center(); Mouse.Hide(); } public void Update() { this.MouseDelta.X = Utilities.Curve(Mouse.X - Window.Width / 2, this.MouseDelta.X, 6); this.MouseDelta.Y = Utilities.Curve(Mouse.Y - Window.Height / 2, this.MouseDelta.Y, 6); Mouse.Center(); this.CameraRotation.X += this.MouseDelta.Y / 10; this.CameraRotation.Y -= this.MouseDelta.X / 10; this.Camera.Rotation = this.CameraRotation; this.Move = Utilities.Curve(((Keyboard.KeyDown(Key.W) ? 1 : 0) - (Keyboard.KeyDown(Key.S) ? 1 : 0)) * this.SpeedMultiplier, this.Move, 20); this.Strafe = Utilities.Curve(((Keyboard.KeyDown(Key.D) ? 1 : 0) - (Keyboard.KeyDown(Key.A) ? 1 : 0)) * this.SpeedMultiplier, this.Strafe, 20); this.Camera.Move(new Vector3(this.Strafe / 10 * Timing.Speed, 0, this.Move / 10 * Timing.Speed)); } } } Quote Link to comment Share on other sites More sharing options...
L B Posted December 31, 2009 Author Share Posted December 31, 2009 Either way, no biggie. By having the .Enabled and such as opposed to just making the effect name true/false it opens up for future expansion of new effects that have parameters or old effects to get parameters at some point and could save you time & consistency issues later. That's all I was thinking. Otherwise I like it. I changed the structure to your second suggestion. Here's an example from the "Scene.Load(string path);" I'm working on: Framework.Effects.DistanceFog.Enabled = Convert.ToBoolean(int.Parse(child.GetKey("fogmode"))); Framework.Effects.DistanceFog.Color = Vector4.Parse(child.GetKey("fogcolor")); Framework.Effects.DistanceFog.SetAngles(float.Parse(child.GetKey("fogangle").Split(',')[0]), float.Parse(child.GetKey("fogangle").Split(',')[1])); Framework.Effects.DistanceFog.SetRanges(float.Parse(child.GetKey("fogrange").Split(',')[0]), float.Parse(child.GetKey("fogrange").Split(',')[1])); Quote Link to comment Share on other sites More sharing options...
ZeroByte Posted December 31, 2009 Share Posted December 31, 2009 Thank's for sharing that code Ubu, it's working nice now. If anyone want's the vb.net version, i'll post the code. Quote Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI. Link to comment Share on other sites More sharing options...
Rick Posted December 31, 2009 Share Posted December 31, 2009 I changed the structure to your second suggestion. Here's an example from the "Scene.Load(string path);" I'm working on: Framework.Effects.DistanceFog.Enabled = Convert.ToBoolean(int.Parse(child.GetKey("fogmode"))); Framework.Effects.DistanceFog.Color = Vector4.Parse(child.GetKey("fogcolor")); Framework.Effects.DistanceFog.SetAngles(float.Parse(child.GetKey("fogangle").Split(',')[0]), float.Parse(child.GetKey("fogangle").Split(',')[1])); Framework.Effects.DistanceFog.SetRanges(float.Parse(child.GetKey("fogrange").Split(',')[0]), float.Parse(child.GetKey("fogrange").Split(',')[1])); Looks clean and crisp. I like it. I really hope this C# version sticks around and has all the functionality of the other versions because I prefer working in .NET. Quote Link to comment Share on other sites More sharing options...
L B Posted December 31, 2009 Author Share Posted December 31, 2009 Looks clean and crisp. I like it. I really hope this C# version sticks around and has all the functionality of the other versions because I prefer working in .NET. It should. At version 1.3 I'll try to talk with Josh about getting it official. Quote Link to comment Share on other sites More sharing options...
L B Posted January 3, 2010 Author Share Posted January 3, 2010 Here, in my game: Quote Link to comment Share on other sites More sharing options...
omid3098 Posted January 3, 2010 Share Posted January 3, 2010 WOW! amazing atmosphere! Quote Omid Saadat OD Arts Blog AMD Phenom II X4 940 - Geforce 8800GTS - 4GB RAM - XP x86 AMD 6000+ - Geforce 9800 GT - 2GB RAM - XP x86 (Home pc) Intel Core i7 - Geforce 310M - 4GB Ram - Win7 x64 (Laptop) Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.