L B Posted August 23, 2010 Share Posted August 23, 2010 The long awaited v2.0 is out! Visit www.middlewerks.com/headers to download them and get access to a growing list of in depth tutorial. Please report bugs here. Thanks! Note to header developers: SVN access will be granted after bug reports and initial fixes have been completed. Quote Link to comment Share on other sites More sharing options...
Sean Posted August 24, 2010 Share Posted August 24, 2010 Wow! Great job! Everything is very polished and professional. Thanks to all who contributed!! Quote AMD Phenom II X6 Black Edition, 8GB, 120 GB SSD, 2TB HDD, nVidia GTX 570 1.2GB, Win 7 x64 Intel Core i5, 4GB, 120GB SSD, NVidia 360M 1GB, Win 7 x64 Link to comment Share on other sites More sharing options...
Gandi Posted August 24, 2010 Share Posted August 24, 2010 Looks great The tutorials actually look better than the ones for C++/Lua. Thanks to all who put work into this! Quote Link to comment Share on other sites More sharing options...
Blue Solitare Posted August 25, 2010 Share Posted August 25, 2010 So how complete is this latest version with regard to the LE engine? Can I do everything with the C# headers as can be done with the C++? Quote Link to comment Share on other sites More sharing options...
TylerH Posted August 25, 2010 Share Posted August 25, 2010 So how complete is this latest version with regard to the LE engine? Can I do everything with the C# headers as can be done with the C++? Can and more! A lot more... Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Blue Solitare Posted August 25, 2010 Share Posted August 25, 2010 Such as? Quote Link to comment Share on other sites More sharing options...
L B Posted August 25, 2010 Author Share Posted August 25, 2010 cube.Position.X += sphere.Rotation.Y; Framework.Effects.Bloom.Enabled = !Framework.Effects.Bloom.Enabled; Many getters are only available in C#, such as Framework effects. Here's the equivalent of the first line in C. Notice how longer it is. PositionEntity(cube, EntityPosition(cube).X + EntityRotation(sphere).Y, EntityPosition(cube).Y, EntityPosition(cube).Z); You simply can't do the first line in another language. Quote Link to comment Share on other sites More sharing options...
Paul Thomas Posted August 25, 2010 Share Posted August 25, 2010 You can in BMax :) Quote Link to comment Share on other sites More sharing options...
Rick Posted August 25, 2010 Share Posted August 25, 2010 I'm confused. Are you saying you can't do "cube.Position.X += sphere.Rotation.Y;" in another language? Quote Link to comment Share on other sites More sharing options...
TylerH Posted August 25, 2010 Share Posted August 25, 2010 You don't have dynamic, per-component get/set accessors in any other language except Blitzmax. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Rick Posted August 25, 2010 Share Posted August 25, 2010 Can you elaborate on what dynamic, per-component get/set accessors is? I'm hard pressed to think C++ can't do this in one form or another. The line that was posted can be done in C++, so I'm interested in this dynamic, per-compoennt get/set accessors. I do understand that if reflection is used C++ has issues with (but can still use libraries to set reflection up), but I can't see why reflection would be used in the given example, so I'm not following what you mean. Quote Link to comment Share on other sites More sharing options...
Rick Posted August 25, 2010 Share Posted August 25, 2010 After a little googling I was able to come up with the following that seems to gives the same behavior. More operator overloading can be done in the properties class to handle other operations if needed. template<class _Prop_t, class _ObjClass_t> class Property { // typedef the callback methods typedef _Prop_t (_ObjClass_t::* _pmGet_t)() const; typedef void (_ObjClass_t::* _pmSet_t)(_Prop_t); _ObjClass_t& m_objInstance; _pmGet_t m_pmGet; _pmSet_t m_pmSet; public: Property(_ObjClass_t& objInstance, _pmGet_t pmGet, _pmSet_t pmSet) : m_objInstance(objInstance), m_pmGet(pmGet), m_pmSet(pmSet) {} operator _Prop_t() { return (m_objInstance.*m_pmGet)(); } void operator =(_Prop_t value) { (m_objInstance.*m_pmSet)(value); } _Prop_t operator +=(_Prop_t value) { (m_objInstance.*m_pmSet)((m_objInstance.*m_pmGet)() + value); return (m_objInstance.*m_pmGet)(); } }; class Sample { private: int m_length; public: int GetLength( ) const { return m_length ; } void SetLength (int nInputData ) { // do whatever you want here if ( nInputData < 0 ) m_length = 0 ; else m_length = nInputData ; } Property<int, Sample> Length; Sample() : m_length(0), Length(*this, &Sample::GetLength, &Sample::SetLength) {} }; int main(int argc, char* argv[]) { Sample obj; obj.Length = 100; int a = obj.Length; obj.Length += 50; a = obj.Length; return 0; } Quote Link to comment Share on other sites More sharing options...
klepto2 Posted August 25, 2010 Share Posted August 25, 2010 At first congrats for releasing it and thx for the hard work you both have done so far. I have found some small additions/bugs: Missing functions -- CreateSurface | Declared only in Core but not in Mesh or Surface -- Get/SetVertexColor | Not declared in Core Small bug: -- TriangleVertex returns void, but should return int. Hope this will be fixed soon Currently I have a small workaround for this (Klepto.CoreAdditions). Otherwise it seems very complete and nice. [Edit] found out that you can use mesh.surfaces.add([material]) as CreateSurface the standard functions should still be accessable IMHO @Rick: I believe he means extra getter / setter which are not available in the other languages because the engine.dll provided with LE doesn't offer these. The C# header uses a modified dll with much more functions. When using this sll with c++ or other languages, they can provide these features as well. Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
L B Posted August 25, 2010 Author Share Posted August 25, 2010 @Rick: Please don't be aggressive on language comparison, as it isn't our intention to compete: we're simply proud of the time we invested in the wrapper that, to us, paid off. Dynamic Vectors Indeed, all languages can provide the given functionality - however, as far as it goes now, only C# implements it. This means you *can* do it in C/C++, but you'll have to make the headers yourself. And believe me, it's a tedious task. Also, we do not use reflection (hard to maintain), but delegates. The line that was posted was this: cube.Position.X += sphere.Rotation.Y; The simplest and natural translation to C/C++ would therefore be: EntityPosition(cube).X += EntityRotation(sphere).Y; However, trying that, you will realize that it has no effect. This is because the Vector3 returned by EntityPosition isn't dynamic, and therefore, changes applied to it do not apply engine commands. You will merely store a variable and increment it, but not set its value back. Simplified Casts Of course, you'll still be able to increment the cube's X position in a longer manner. But version 2 was all about usability. For instance, you can declare a whole vector by a float or integer, due to an extensive set of operators and casts we created. Example: sun.Rotation = 45; This will set the sun's rotation to 45 degrees in all directions. Advanced Accessors What do we mean by "advanced accessors"? Have a look at this page: Unified Get/Set accessors. Our custom engine DLL and headers fully implement them, giving you much more flexibility and control. @klepto2: Sorry for the vertex stuff, many things are bugged in this sector. We'll look into it very soon. Quote Link to comment Share on other sites More sharing options...
Rick Posted August 26, 2010 Share Posted August 26, 2010 @Rick: Please don't be aggressive on language comparison, as it isn't our intention to compete: we're simply proud of the time we invested in the wrapper that, to us, paid off. Sorry, I didn't mean to come across as aggressive. I was just trying to get an accurate understanding of why this is special in the LE C# implementation. Thanks for the explanation. Quote Link to comment Share on other sites More sharing options...
cocopino Posted August 26, 2010 Share Posted August 26, 2010 Wow guys, this is looking great! Can we use Leadwerks in conjunction with Windows Forms (e.g. render to a picturebox)? This would be the way to go then certainly for Leadwerks GUI tools. Quote desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32 Link to comment Share on other sites More sharing options...
Davaris Posted August 26, 2010 Share Posted August 26, 2010 Its amazing how many good things are coming together for Leadwerks this year. Congratulations on your achievement guys! Quote Win 7 Pro 64 bit AMD Phenom II X3 720 2.8GHz GeForce 9800 GTX/9800 GTX+ 4 GB RAM Link to comment Share on other sites More sharing options...
klepto2 Posted August 26, 2010 Share Posted August 26, 2010 Wow guys, this is looking great! Can we use Leadwerks in conjunction with Windows Forms (e.g. render to a picturebox)? This would be the way to go then certainly for Leadwerks GUI tools. I have succesfully converted my LEControl yesterday and i will contribute it as soon as it is tested and works stable. Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
cocopino Posted August 26, 2010 Share Posted August 26, 2010 I have succesfully converted my LEControl yesterday and i will contribute it as soon as it is tested and works stable. Coolness! Quote desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32 Link to comment Share on other sites More sharing options...
klepto2 Posted August 26, 2010 Share Posted August 26, 2010 Ok, some more things i have found. -- ScaleMesh isn't included in the OOP header. -- How to retrieve global or local vectors? -- GetPreferedMaterialName isn't defined in the Engine.dll !! Critical !! Cant use the Surface object -- Color cast from float[] to Color doesn't multiply with 255 (backcast from color to float[] devides by 255) Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
L B Posted August 26, 2010 Author Share Posted August 26, 2010 Ok, some more things i have found. -- ScaleMesh isn't included in the OOP header. -- How to retrieve global or local vectors? -- GetPreferedMaterialName isn't defined in the Engine.dll !! Critical !! Cant use the Surface object -- Color cast from float[] to Color doesn't multiply with 255 (backcast from color to float[] devides by 255) Object scaling (as seven mentioned, it didn't work on meshes as entities): Fixed. Give me some time to upload the next revision. Done. Mesh scaling: use the following snippet:using (Mesh.Editing) { example.Scale = new Vector3(5, 9, 1); } Use the same for "Translate" and "Rotate". GetPreferredMaterialName: Far from being a critical command, I asked Tyler to add it to our DLL for Middlewerks. It should be there when I get to talk to Tyler again.Why can't you access the surface object? This should do for most uses:example.Surfaces[0].Material.Path Retrieving global and local vectors? Specify please. Color cast: This is normal. Try the following code to test by yourself:Color test = new float[] { 0.5f, 1f, 0.5f, 1f }; Debug.Alert(test.ToString()); float[] casted = (float[])test; Debug.Alert(string.Format("{0}f, {1}f, {2}f, {3}f", casted[0], casted[1], casted[2], casted[3])); This is because the internal constructor uses floats. Please do not assume it's wrong then, you shouldn't be messing with a reflector and looking into our methods anyway Quote Link to comment Share on other sites More sharing options...
TylerH Posted August 27, 2010 Share Posted August 27, 2010 Get/Set PreferredMaterialName have been added to the DLL. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
klepto2 Posted August 27, 2010 Share Posted August 27, 2010 First thx for the fast fix. 1. GetPrefferedMaterialName was critical for me because I wasn't able to access surface properties at all. This was due an internal Entrynotfound exception and causes the running program to stop. 2. Global/Local Vectors (ok bad description) Position and Rotation of an entity have a global and a local value. How to get them? 3. I don't use a reflector, but i have tried to implement SetVertexColor/GetVertexColor to my CoreAdditions as I need them for highlighting selected surfaces. And by doing this i have noticed this issue. If i have used a reflector i might have seen that this is wanted behaviour . Why are you making the mesh.Scale so complicated? Why don't you just renew the mesh.Scale property with MeshScale and then you can access them like this: m.Scale ; ScaleMesh ((Entity)m).Scale ; ScaleEntity Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
TylerH Posted August 27, 2010 Share Posted August 27, 2010 2: Use this using block: using (Engine.Globality) { // Get/Set position, rotation, scale, etc. } If you use that, it is global, otherwise everything is local. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
L B Posted August 27, 2010 Author Share Posted August 27, 2010 @Mesh.Scale suggestion: both Tyler and I found that more confusing than our way. Just use the Mesh editing mode, it's quite easy. Quote 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.