Jump to content

klepto2

Developers
  • Posts

    856
  • Joined

  • Last visited

Everything posted by klepto2

  1. Yes I'm using Lazlo's Leadwerks.Net. I have already got Images working ( you can load from file, byte[], stream or from Leadwerkstexture. Then you can draw them scaled, rotated, tiled, normal or just a part of it.)
  2. Hi guys, finally I have some more freetime back and have restarted developing with Leadwerks more intensively in C#. Currently I'm working on multiple extensions for the .NET Wrapper of Leadwerks and I'm also finishing / continuing developing my tools. Later I hope this will all fit in one easy to use framework. First here is a screen of new nightsky texture used in my lua daynight script (not completely correct scaled) : the texture was made by taking screenshots from the stellarium software ( http://www.stellarium.org ) and building a cubemap out of them. Also I have started an advanced 2D Library for Leadwerks.Net : This is the current 2D code for the image above: public void Render() { Drawing2D.Enabled = true; //Enables Rendering of 2D Elements in native OpenGL Drawing2D.SetViewRotation(m_angle2, 1024f/ 2f, 768f / 2f); //Rotates the complete Viewport around given point Drawing2D.SetBlend(BlendMode.Alpha); // Set differten Blendmodes Drawing2D.SetColor(255, 0, 0, 1.0f); // Set Color for the following drawing calls Drawing2D.DrawLine(0, 0, 1024, 768); // Draws a line Drawing2D.SetColor(0, 255, 0, 0.5f); Drawing2D.DrawLine(0, -100, 1024, 768); Drawing2D.SetColor(0, 0, 255, 0.5f); Drawing2D.DrawLine(0, 100, 1024, 768); Drawing2D.SetColor(255, 0, 255, .5f); // Set the Drawing Handle of the next items to draw //(eg: normally all items are rotated at their local [0,0] coordinate, this function offsets this point by the given point) //values of 10,10 would rotate the following rects around their center. Drawing2D.SetHandle(50, 50); for (int i = 0; i < 150; i++) { if (i % 2 == 0) Drawing2D.SetRotation(m_angle); //Sets current rotation for the following drawings else Drawing2D.SetRotation(-m_angle); Drawing2D.DrawRect(10.24f + i * 10.24f, 7.68f + i * 7.68f, 20, 20); // Draws a rect } m_angle += 0.02f; m_angle2 += 0.04f; Drawing2D.Enabled = false; // Disables raw OpenGL Mode } The module will have its own Image handling (Leadwerks textures can be used as well) and much more. This is a brief overview and will be continued...
  3. you don't need an extra class in C. You can simple load the entity and adjust the settings via SetEntityKey.
  4. You may have to change the OpenGL states to fit the needs of MyGui. try something like this: leglBegin(GetLayerCamera(background), cameraZoom); MyGUImanager.Render(); leglEnd(true); // End and specify that we used 3D projection legl.h // Includes, libs #pragma comment(lib,"opengl32.lib") #pragma comment(lib,"glu32.lib") #include "engine.h" #include <gl/gl.h> // Standard opengl include. #include <gl/glu.h> // GLU include. // Constants enum CullMode { CULL_NONE, // Both sides of faces are drawn. CULL_DRAW_CCW, // Only faces defined by vertices declared in ccw order will be drawn (default). CULL_DRAW_CW // Same as above but cw. }; // Commands (declarations) void leglBegin (TCamera camera = NULL, float zoom = 1.0f, CullMode cm = CULL_DRAW_CCW); void leglEnd (bool was3D = false); void leglBindTexture(TTexture texture); // Implementations (definitions) // Use NULL for the camera to set up 2D drawing instead of 3D. // The "zoom" parameter is only required because there's no GetCameraZoom() function. void leglBegin(TCamera camera, float zoom, CullMode cm) { // Setup projetion according to argument if (NULL != camera) { // Save current projection matrix. Then reset glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); // Calculate the view frustum float nearRange, farRange; GetCameraRange(camera, nearRange, farRange); float theta = 1.0f / zoom; // tan(45°) = 1.0f float aspect = float(BufferWidth(CurrentBuffer()))/BufferHeight(CurrentBuffer()); glFrustum (-nearRange*theta, nearRange*theta, -nearRange/aspect*theta, nearRange/aspect*theta, nearRange,farRange); // Reset transformation glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); // LE uses a differently handed coordinate system than ogl does glScalef(1.0f, 1.0f, -1.0f); // Calculate the LookAt vectors (camera direction and up vector)... TVec3 from = EntityPosition(camera, true); TVec3 to = {0,0,-1}; to = TFormVector(to, camera, NULL); to += from; TVec3 up = {0,1,0}; up = TFormVector(up, camera, NULL); // Set LookAt gluLookAt(from.X, from.Y, from.Z, to.X, to.Y , to.Z, up.X, up.Y, up.Z); } else { glPushMatrix(); // Set orthographic projection (used for 2D drawing) // Get the current viewport/buffer size. int vPort[4]; glGetIntegerv(GL_VIEWPORT, vPort); // Set the projection gluOrtho2D(0, vPort[2], vPort[3], 0); // like glOrtho(0, vPort[2], vPort[3], 0, -1, 1); // Reset transformation glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); } // Setup default drawing settings. // Alpha blending. glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Backface culling. if (CULL_NONE != cm)glEnable(GL_CULL_FACE); if (NULL != camera)glCullFace((CULL_DRAW_CCW == cm) ? GL_BACK : GL_FRONT); else glCullFace((CULL_DRAW_CCW == cm) ? GL_FRONT : GL_BACK); // Depth test for 3D projection if (NULL != camera)glEnable(GL_DEPTH_TEST); // Drawing color. glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } // Use NULL (0) for the texture to reset (bind no texture) void leglBindTexture(TTexture texture) { if(NULL != texture) { glEnable(GL_TEXTURE_2D); BindTexture(texture, 0); // LE command. } else { glBindTexture(GL_TEXTURE_2D, NULL); glDisable(GL_TEXTURE_2D); } } // End drawing. Set "was3D" to true if you specified a camera at leglBegin (= used 3D projection). void leglEnd(bool was3D) { // Undo changes only made in 3D mode (camera != NULL) if (was3D) { glMatrixMode(GL_PROJECTION); glPopMatrix(); glDisable(GL_DEPTH_TEST); } else glPopMatrix(); // Reset transformation. glMatrixMode(GL_MODELVIEW); glPopMatrix(); // Undo changed settings. glDisable(GL_BLEND); glCullFace(GL_BACK); glDisable(GL_CULL_FACE); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); leglBindTexture(NULL); }
  5. newer Version is available here: http://leadwerks.com/werkspace/index.php/topic/3104-day-night-script/
  6. I have seperated the properties into new sections. I have also noticed new bug with the Ambient settings, as a workaround place a normal Ambient light and use this instead.
  7. Hi, thx for the feedback. I have uploaded an updated version ( Download at first post). Changes: - Removed unneeded references to lua files - Fixed the ambientlight bug. - Reordered the Options and splitted them in different categories
  8. thx macklebee, I will add it to the toolbox as soon as it is stable and balanced enough. Currently the dawn and dusk effect is a bit out of sync (the effect starts to early and stays to long). intensity.lua and suncolor.lua are data scripts i have used in an earlier version and i have forgotten to delete the references in the current script. They are not needed.
  9. Hi, after long silence I want to present a small wip script/shader which replaces the Atmosphere script in the Editor with a dynamic sky tool. The other options from the old atmosphere script are all available through mine. [screen] [Download] DayNight.zip [installation] Unzip this in the models/Environment folder (or somewhere you like within your SDK/Editor folder) and restart the Editor. Keep in mind that this is still WIP and needs tweaking on various aspects, also I will add moving clouds in a later version. I hope you like it and I waiting for feedback. thx klepto2
  10. wip = Work in progress Save Mesh will save the mesh with the new materials and ready to use with LE. I'm also thinking about adding the abillity to load meshes in different formats / edit them and make them LE ready. It will also split (optionally) the mesh by worlds. eg: a house normally imported as one Mesh with submeshes and surfaces, the walls etc will be located in the main world, but things like windows should normally be rendered in the transparent world. My tool will split the meshes by the world and create a lua script with a base mesh, which will provide the submeshes to the correct worlds, even colored shadows will be supported.
  11. Hi, I want to introduce you to a tool i'm currently developing. Yes it is a material editor (again ) but this one will have some more features in the end. Features i want to include: - Realtime Material Editing (done) - Save new Mesh (wip) - Export as prefab ( you will be able to add entities like particles, othe meshes etc. and my tool will create a prefab mesh with a lua script/materials etc ready for LE Editor) - and much more. Here is a small preview of the material editor: I'm using the new C# headers (thx to Lazlo and tyler). I will keep you informed on progress and will provide a demo as soon as possible.
  12. 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
  13. 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)
  14. I have succesfully converted my LEControl yesterday and i will contribute it as soon as it is tested and works stable.
  15. 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.
  16. Don't use Entity.NullPointer, these Pointers are needed if you use the standard Pointer functions and not the OOP classes. Replace it with null or don't use it at all, it is an optional parameter.
  17. Emitter fire = new Emitter() use the standard constructor.
  18. Hi I hope i can help you. 1. You need to download the package from the first post as it includes all needed references like OpenTK, Leadwerks.dll etc. 2. Download tha latest version of the Control here : http://leadwerks.com/werkspace/index.php?/topic/2429-new-letkcontrol-beta/page__view__findpost__p__22982 3. Make sure you have set all References set correctly: you need a Reference to Leadwerks.dll and a reference to the 3 delivered OpenTK dlls. If you have done this, you should be able to run the sample.
  19. Hi, here is my current C# Header of the gmfsdk. The Header Assembly is located in the Libs folder together with the gmfsdk dll. Also the project itself is a C# Version of one of the sdk samples. Download: GMFSDK_Header.zip
  20. klepto2

    Suggestions

    Nice suggestions Lazlo. - Scilexer.dll doesn't need to be distributed as it is just for the scripteditor and not needed for the engine itself. - Currently i notice that a lot of bmx users also distribut engine.dll --> not needed in bmx. - I remember a chat with Josh about having Scripts in a pak file and I also rememer that this should be possible with > 2.32. @Rick he means the model scripts, not the general script folder. - I have a Batch Asset creator in the works. I have already converted > 300MB Packages from Arteria and Dexsoft in less than 5 minutes. Currently it is just a prototype, but it already let you convert from GMF, FBX, Obj to GMF format. Rescaling is implemented and it autogenerates materials if it can't find proper materials. It also generates normalmaps and simple scripts. Currently the pipeline is not that easy as it sounds, but this is what i'm currently working on. Least it packs the converted models into a clean ordered Folder. Otherwise +1 for the other things.
  21. Which engine.dll do you use? If i remember correctly you need the 2.3 dlls and not the 2.4 dlls.
  22. You need to copy the engine.dll, newton.dll, jointlibrary.dll, shader.pak and if you use scripting the whole Script Folder into the Output Folder of your app (both, debug and release)
  23. Rick, here is a new version:Klepto.Controls.dll Changes: - Added an AfterFrameworkRender eventhandler, please test if this helps and works - Fixed MouseZ bug. btw, its no problem that you find bugs thats why i call this beta. PS: the FPS thing is something i need to work on. Somehow the TKcontrol limits the rendering speed and the timer is a also a bit weird. Currently I'm experimenting with BackgroundWorkers which should work better. [Edit] Changes: - Changed Timing from timer to backgroundworker. RefreshRate works now correct, set RefreshRate to -1 for fullspeed.
  24. Ok, here we go last update for today changes: MouseX/ MouseY will update now after mousemove experimental MouseRelease the behaviour of MouseHit and MouseDown is different. Whereas MouseDown just checks if a button is pressed, Mousehit returns the number of clicks since the last time the given button was clicked. Klepto.Controls.dll
×
×
  • Create New...