Jump to content

Gandi

Members
  • Posts

    295
  • Joined

  • Last visited

Posts posted by Gandi

  1. Hey,

     

    I'm currently working on an attachment system and ran into some weird problems when I started attaching models to the main character.

     

    This is what it should look like:

    post-418-0-21430300-1312051026_thumb.png

     

    If I rotate the camera a little it looks like this:

    post-418-0-07587800-1312051141_thumb.png

     

    If I keep rotating it up, th artifacts are gone... but the character becomes invisible:

    post-418-0-77296700-1312051233_thumb.png

     

    Usually I'd say this is a bug, but I tried this out in another test program with the animated model and the scene.sbx and it works like a charm. I would guess that this is some kind of problem with the terrain, or do you have any ideas what I might be doing wrong?

  2. Object* o;
    int pointer = *(int*)o;

     

    When doing this, you only store the first 4 Bytes of your Object data (not the pointer to the object!) in the pointer-variable.

    There is no way to get back the original object from this int, because you do not store the adress of you object anywhere.

     

    If you do:

    int pointer = (int)o;

    it might work, but only if the size of int matches the size of a pointer. This is not the case on x64 systems.

  3. No such feature has been promised. I'll see how it works out, but I honestly think this kind of thing is overblown and would only benefit a very small number of people.

     

    Are you joking?!?! I might be wrong - but my guess would be that basically everyone here would _love_ to have a multithreaded LoadModel - command...

  4. In former versions of Leadwerks Editor I could place single vegetations with brush size 0 quite precisely. With the current LE version (2.42) I can't place anything with that brush size anymore. While usining brush size 1 I often place more than one vegetation and that's annoying.

     

    If there isn't a solution for this I would be glad if Josh would accept this as an important suggestion for the improvement of Leadwerks and eliminate this bug.

  5. Makes perfect sense. The worst that happens is you don't need/use it.

     

    The Core function here also won't work since the declaration is obviously not working, although I dunno exactly why.

     

    If you open up Leadwerks.dll with the .NET Reflector ( yeah I know I shouldn't do this^^ ) you can see that Core.CameraUnproject looks like this:

     

    [DllImport("Engine.dll", CallingConvention=CallingConvention.StdCall)]
    public static extern void CameraUnproject(IntPtr camera, float[] p);

     

    This is sort of off topic... apologies.

     

    ...

     

     

    Okay, replace the words "probably not the best solution" with "definately not the best solution" :( I just tried to make everything excactly like it is in C++ to make sure it works. You version is a little smarter of course.

  6. Okay, this is probably not the perfect solution but it works:

     

                    
    public static class PInvoke
    {
           [structLayout(LayoutKind.Explicit)]
           public struct TVec3
           {
               [FieldOffset(0)]
               public float X;
    
               [FieldOffset(4)]
               public float Y;
    
               [FieldOffset(8)]
               public float Z;
           }
    
           [DllImport("Engine.dll", CallingConvention = CallingConvention.StdCall)]
           unsafe public static extern void CameraUnproject(IntPtr camera, TVec3* addr);
    }
    
    public void SomeFunction()
    {
       Vector3 v = SomeGlobalPositionInHere;
       unsafe
       {
           PInvoke.TVec3 result;
           result.X = v.X;
           result.Y = v.Y;
           result.Z = v.Z;
    
           PInvoke.CameraUnproject(Framework.Camera.Pointer, &result);
    
           v.X = result.X;
           v.Y = result.Y;
           v.Z = result.Z;
       }
    
       Draw.Text("TEEEEEEEEEEEEST", (int)v.X, (int)v.Y);
    }
    

     

    I guess there is something wrong with the float[] beeing passed in the wrapper... would be nice if someone could fix this.

  7. I did... but Reflector says that that it does not even matter.

    Just made a fresh test with some code frome the tutorials:

     

    using Leadwerks;
    
    public static class Game
    {
       private static void Main()
       {
           try
           {
               Engine.Initialize(DisplayMode.Window,800,600,60);
               Framework.Initialize();
           }
           catch (LeadwerksException e)
           {
               Debug.Alert(e);
               Engine.Terminate();
           }
    
           Framework.Camera.Position.Z -= 5;
    
           Mesh cube = new Mesh.Cube();
    
           Light sun = new Light.Directional();
           sun.Rotation = 45;
           sun.Rotation.Y = 120;
    
           Mesh ground = new Mesh.Cube();
           ground.Scale = new Vector3(5, 0.2f, 5);
           ground.Position.Y -= 1;
           ground.Color = Color.SandyBrown;
    
           Framework.Effects.Bloom.Enabled = true;
           Framework.Effects.Water.Enabled = true;
           Framework.Effects.Water.Height = -1;
           Framework.Adjustments.Saturation = 0.5f;
           Filtering.Optimize();
    
           while (!Window.HasRequestedClose)
           {
               cube.Rotation += Timing.Speed;
    
               Timing.Update();
               Framework.Update();
               Framework.Render();
    
               Vector3 loc = ground.Position.Clone();
               Vector3 newloc = Framework.Camera.Unproject(loc);
    
               // newloc is the same as ground.Position now
    
               Draw.Text("Test", (int)newloc.X, (int)newloc.Y);
               Graphics.Flip();
           }
    
           Framework.Terminate();
           Engine.Terminate();
       }
    }
    

  8. Hi!

     

    Do you know if its possible to use LE without calling Graphics(). By creating the OpenGL device by myself.

    If yes, which Parameters do i have to use for the Pixelformat e.g.?

     

    I just want to pass the HWND to my window to my application and then want to get the OpenGL window, which resizes with the Window.

  9. Ok, I know know where the error occures..

     

    seems like he cant find my functions..

     

    if(leGuiInitialize==NULL)
    		printf("Error: GuiInitialize=NULL\n");
    	(leGuiTerminate) = (TGuiTerminate) GetProcAddress(gui_hlib,"terminateGui");
    	if(leGuiTerminate==NULL)
    		printf("Error: leGuiTerminate=NULL\n");
    	(leGuiGetHandle) = (TGuiGetHandle) GetProcAddress(gui_hlib,"getLEHandle");
    	if(leGuiGetHandle==NULL)
    		printf("Error: leGuiGetHandle=NULL\n");
    

     

    all three are null....

  10. ok.. thats what i got now:

     

    #define DLLEXPORT(s) __declspec(dllexport) ##s _stdcall 
    
    extern "C"
    {
    	DLLEXPORT(int) initializeGui(int debug)
           {
                   return Initialize(debug);
           };
    
           DLLEXPORT(HMODULE) getLEHandle(void)
           {
                   return le_hlib;
           };
    
    	DLLEXPORT(int) terminateGui(void)
           {
                   return Terminate();
           };
    
    };
    

    in my .dll header

     

    and then i copied the engine.cpp renamed it and included it into my project instead of the engine.cpp

     

    here are the changes i made in the "engine.cpp"

     

    i added:

    typedef	int		(__stdcall *TGuiInitialize)			(int);
    typedef	HMODULE	(__stdcall *TGuiGetHandle)			(void);
    typedef	int		(__stdcall *TGuiTerminate)			(void);
    
    leDeclareFunc(GuiInitialize);
    leDeclareFunc(GuiGetHandle);
    leDeclareFunc(GuiTerminate);
    

     

    and edited the Initialize()-function:

    inline int Initialize(int allowenginedebug)
    {
    LPCSTR dllfilename;
    if(1==allowenginedebug)
    {
    #ifdef DEBUG
    	dllfilename = (LPCSTR) "CWGui.dll";
    #else
    	dllfilename = (LPCSTR) "CWGui.dll";
    #endif
    }
    else
    	if(2==allowenginedebug)
    		dllfilename = (LPCSTR) "CWGui.dll";
    	else
    		dllfilename = (LPCSTR) "CWGui.dll";
    gui_hlib = LoadLibraryA(dllfilename);
    (leGuiInitialize) = (TGuiInitialize) GetProcAddress(gui_hlib,"initializeGui");
    (leGuiTerminate) = (TGuiTerminate) GetProcAddress(gui_hlib,"terminateGui");
    (leGuiGetHandle) = (TGuiGetHandle) GetProcAddress(gui_hlib,"getLEHandle");
    leGuiInitialize(allowenginedebug);
    le_hlib = leGuiGetHandle();
    if (le_hlib != 0)
    {	/*printf("%s loaded.\n", dllfilename)*/;
    	leLoadFuncs();\
    }\
    else\
    	printf("%s failed to load.\n", dllfilename);
    return NULL!=le_hlib;
    }
    

     

    and the Terminate():

    inline int Terminate(void)
    {
       return leGuiTerminate();
    }
    

     

    but it seems like im doin something wrong..

     

    everything compiles fine, but when i try to run it i recently get an error message before even anything is written into the log

  11. let's see if i got it right :D

     

    1) i have to load the LE functions in my dll (the Initialize() function of engine.h, if im right)

    2) i have to link the LE functions from my own dll to the main programm ( so i link to my dll which links to the LE dll???) (writing my own engine.cpp, right?)

     

    I'm sry, but i just haven't done a lot with dll's and linking so far ..

  12. Hi!

     

    Is it possible to use LE-commands from a selfmade .dll file?

    I tried is today, but always got errors, as the dll seems to load in its own thread.

     

    Or is there any other way of doing it? i want to use this dll in some of my projects and maybe share it with the community, but i dont want to recompile/include/share the whole source code..

  13. Atm im rendering every frame.. the system aint far atm..

     

    but i got a problem now ..

     

    I'm creating a .dll and .lib file and when including my classes from the dll i cant run any LE-commands anymore (guess it's another thread?)

    anyone got an idea how i can get all my classes from the dll into main project??

  14. yeah just draw the image at the same fraction of the buffer dimensions for both width and height but it means that what you want your image to look like must have the same relative scale as the width and height of the buffer...

     

    EDIT--- I mean the image must have the same width to height ratio as the buffer's width to height ratio...

     

    i think you kinda missunderstood my problem :D

     

    look at the picture. When my child component is badly placed, so it doesnt fit into the parent-component i want it to be rendered same size as usual, just it gets cut at the edge of the parent-container.

  15. the advantage would be, that components which are to big for its parents components dont get rendered out of the bounds of the parent.

     

    a little picture:

    black: parent

    red: child

     

    top: how i dont want it to be

    bottom: how i want it to be

     

    zeichnung836.jpg

     

    and yes that would be a bunch of buffers.. thats why im asking :D

     

    € @macklebee: ok.. that sucks^^ as i wanted to render the text into buffers ( with freetype) because always rendering it with freetype seems to slow down everything a bit..

     

    €2: or do you know a way for rendering an image to a specific size without stretching it?

  16. Hi!

     

    I'm currently working on a GUI-system and don't really know how LE would perform with a lot of buffers (a buffer for each component)

     

    If that aint a good idea i think i'll have to write a litte shader for what im planning.

     

    Another question: Is there a minimum size for buffers (i think i read something some time ago)

  17. This is a video of my current WIP of the river editor.

    It's a script i wrote in lua for the editor.

    The shader was also written by me and still needs some fine tuning (would also look better if i would somehow get the light position into my shader (click me for help))

     

    I'll also add some physics which makes objects float into the direction of the river.

     

×
×
  • Create New...