Jump to content

Ma-Shell

Members
  • Posts

    371
  • Joined

  • Last visited

Posts posted by Ma-Shell

  1. You said exactly, those bones connection is so elastic. I spent a whole day to find out that too, It seems to be no solution, then I decided to live with this.

     

    You don't need to live with this wink.png

    It is possible to directly access the NewtonDynamics-Functions like so:

     

    Joint* j;
    j = (...)
    NewtonJointSetStiffness(((NewtonDynamicsJoint*)j)->newtonjoint, 0.42);
    

    will set the stiffness of the joint j to 0.42. Of course you will have to make j point to the joint you created previously, before calling the function.

     

     

    EDIT:

    Oops, just noticed, you are probably using LUA, as you wrote things like "Model:Box()". No idea, whether you can do something like this in LUA. sad.png

    • Upvote 1
  2. To get you started: use a blue material (mode alpha) and some simple fragment-shader like this:

     

    #version 400
    //Uniforms
    uniform sampler2D texture0;
    uniform vec4 materialcolordiffuse;
    uniform float currenttime;
    //Inputs
    in vec4 ex_color;
    in vec2 texcoords0;
    in float clipdistance0;
    //Outputs
    out vec4 fragData0;
    void main()
    {
    //Clip plane discard
    if (clipdistance0>0.0) discard;
    
    fragData0 = ex_color * materialcolordiffuse;
    fragData0.rgb += .2*sin(tan(texcoords0.y-currenttime*.008)*10)+.25;
    fragData0.a = .5;
    }
    

     

    This does in fact look horrible. You will need some (maybe even a lot of) fine-tuning of the parameters, but it should give you an impression, how to create that flickering look.

  3. [App.h]:

    Buffer* mybuffer;
    Buffer* mainbuffer;
    Texture* mytexture;
    Texture* mydepthtexture;
    

     

    [App.cpp, App::Start after context = Context::Create(window);]

    mainbuffer = Buffer::GetCurrent();
    mybuffer = Buffer::Create(context->GetWidth(), context->GetHeight(), 2, 0);
    mytexture = Texture::Create(context->GetWidth(), context->GetHeight(),Texture::RGBA,0,1,0);
    mydepthtexture = Texture::Create(context->GetWidth(), context->GetHeight(), Texture::Depth, 0, 1, 0);
    mytexture->SetFilter(Texture::Smooth);
    mybuffer->SetColorTexture(foregroundtexture1);
    mybuffer->SetDepthTexture(foregrounddepthtexture1);
    mybuffer->Disable();
    

     

    [when rendering (normally in App::Loop())]

    world->Update();
    Buffer::SetCurrent(mybuffer);
    mybuffer->Enable();
    world->Render();
    mybuffer->Disable();
    Buffer::SetCurrent(mainbuffer);
    

  4. Although OpenAL provides a function for retrieving the index of the sample currently being played, I am unable find Leadwerks API that passes this through.

     

    Which OpenAL-function are you talking about?

    If Leadwerks doesn't provide it, you can directly call it. See the following example:

    Sound* snd = Sound::Load("Sound\\Footsteps\\concrete1.wav");
    Source * s = Source::Create();
    s->SetSound(snd);
    s->SetLoopMode(true);
    s->Play();
    
    if (alIsSource(((Leadwerks::OpenALChannel*)s->channel)->source) == AL_TRUE)
     printf("Source TRUE\n\n");
    if (alIsBuffer(((Leadwerks::OpenALSound*)s->sound)->buffer) == AL_TRUE)
     printf("Buffer TRUE\n\n");
    
    alSourceStop(((Leadwerks::OpenALChannel*)s->channel)->source);
    

     

    As you can see, you can get the OpenAL-source and OpenAL-buffer as demonstrated. If you need any other OpenAL-ids, I would be glad to show you, how you can retrieve them.

    • Upvote 2
  5. Just get a script that does copies and formats your disk at system boot... rolleyes.gifwink.png

     

    Have you tried creating a new user on your pc and executing leadwerks from this new user?

    Also, when executing tasklist with the parameter "/V", does it say, the state of the processes is "Running"?

     

    EDIT:

    Bonus: get the parent process of the leadwerks-processes by issuing:

    wmic process where (processid=7276) get parentprocessid
    

    (change the pid with your current values and find the result in tasklist)

  6. Hi,

    are the missing models imported meshes or are they brushes (i.e. simple forms created in the editor, like boxes, spheres, etc)?

    In the latter case, it is important to know, that they get collapsed, so that they are only one model, which has several advantages with respect to performance.

    You can prevent them from being collapsed by either giving them a mass =/= 0 or by assigning a script (just a dummy one is enough).

  7. Actually, it's not only the physics, since I get a lot more fps, if I don't create them at all (~80), but disabling the simulation for these bodies increases the fps from like 1 frame every 30 seconds to like 30 FPS, which is still massive.

    Also, I noticed, if I delete the phy-file, I also have to wait ~20 seconds after the scene has loaded, before the fps stabilize.

    The whole code I inserted into App::Start():

    Model* m;
    for (int n = 0; n < 20000; n++)
    {
    m = Model::Load("Models/Trees/pine01.mdl");
    m->SetPosition(n, 0, 0);
    NewtonBodyDisableSimulation(((NewtonDynamicsBody*)m->body)->body);
    m->Hide();
    }
    

     

    (You can re-enable physics by calling "NewtonBodyEnableSimulation" with the same parameter.)

    Is something like this possible in LUA?

    • Upvote 4
  8. In C++ you can get access to a few more functions for manipulating physics by casting m->body (best look at the definition of NewtonDynmaicsBody in Newton.h):

    ((NewtonDynamicsBody*)m->body)

    Furthermore, you can access the NewtonBody-structure which is used internally for all the Newton-functions by doing:

    ((NewtonDynamicsBody*)m->body)->body

    You can then proceed to call any function from the Newton by using this body.

    Sadly, I have no idea, whether you can do something like this on LUA.

    However, I don't think that the problem lies in the physics, since if I remove the file "pine01.phy", there is no physics-model, as can be seen by issuing

    camera->SetDebugPhysicsMode(true);
    

    in App::Start(). The FPS are bad in that case, nevertheless...

     

    EDIT:

    By "all the Newton-functions", I meant those: http://newtondynamics.com/wiki/index.php5?title=API_Database

    Also notice, that you won't see an effect for some, as they get overwritten by Leadwerks in the world-update (I guess).

     

    EDIT2:

    It IS in fact the physics. You can call

    NewtonBodyDisableSimulation(((NewtonDynamicsBody*)m->body)->body);
    

    Doing this with 20000 trees will give me a solid 30 fps on my i5 2500 and gtx970.

    Withouth that line, I get like no frames at all...

    However, even after the scene has loaded, it takes a few seconds (~20) before the fps stabilize.

    • Upvote 4
  9. Thx, shadmar, for this example. For this to run, you will nevertheless have to modify some parts of your vertex-shader, so that the "in"s and "out"s match.

     

    Also geometry made by the gs won't cast shadows

    That's not true. You just have to set the same shader in the Material-Settings in the Shaders-tab as the Shadow-shader, then it will have a shadow.

    This is the advantage of shadow maps: The shadows are generated from the depth-buffers of the generated fragments, so that is after the fragment-shader (and since the fragment-shader is run for the newly generated gemoetry, as well, they can cast shadows as well).

    • Upvote 1
  10. For placing the turrets, you should multiply their positions with their widths. This means, you should differentiate between grid-coordinates and world-coordinates.

    So, say your turrets are 10 leadwerks-units wide, then your grid-point (0,1) would correspond to world-coordinates (0,10). The grid-point (9,8) would correspond to the world-coordinates (90,80), etc.

    This also means, when you are in the process of placing the turret, you should derive their grid-coordinates from world-coordinates by dividing the world-coordinate by the width, while rounding down, i.e., the world-point (94,83) would belong to the grid-point (9,8) and therefore the turret would be placed at (90,80).

    I hope, you can see, what I'm trying to say. ;)

    • Upvote 1
  11. Hi,

    as far, as I remember, the downloader for the standalone version remembered the key (which was written to a log/config file in the same folder), so if you still have the downloader on your main pc, it should be there.

    However, I don't know, if the servers are still online, because Leadwerks moved to Steam and the standalone is not getting any updates anymore (see http://www.leadwerks.com/werkspace/blog/1/entry-1379-full-steam-ahead/).

    The Blogpost also says, you should send an email to support. Did you use the email-address shown on the link?

    Don't worry, you will get the Standard-DLC as well.

  12. I managed to rewrite my controller classes for native support (eliminating the need for the SDL lib) for both Linux and Windows but when i include dinput.h in a LE project, the compiler is giving errors, probably because it's conflicting somewhere somehow and i haven't been able to figure out how to fix it.

     

    1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\dinput.h(4318): error C2143: syntax error : missing ';' before '__stdcall'
    1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\dinput.h(4318): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    

    This is most likely due to one of the Macros in that line not being defined. You would have to search the headers for the definitions of those macros (most likely WINMAPI, MMRESULT, or WINAPI) and include those files and hope that they do not have additional requirements. Since this is a part of DirectX (DirectInput), you will most likely have problems with this, nevertheless.

  13. I don't see why it wouldn't be possible. Right now the C++ project uses the Lua Interpreter to load main.lua which kicks off all the lua stuff. You can just gut the C++ code and make your own game loop in C++ and that should completely remove Lua from your project given you don't attach any lua scripts to any entities in the editor. The fact that Lua may get initialized directly in LE shouldn't cause any sort of memory or performance issues if you never use it. Lua itself if not used but included is so small.

     

    I tried that but this doesn't work. As soon as leadwerks.h is included, you can't prevent the LUA-Interpreter to be started. Even if you exit right in the first line of the main-function the tools for detecting memory leaks will tell you that there are allocated chunks everywhere. There seems to be something statically initialized. In the template code, there is no line which starts the interpreter (only one that connects it) and you can only disconnect it but never destroy it.

  14. Hi

     

    I would go for a complete removal of the lua interpreter if You are not going to use it.

     

    BR

    Eirik

     

    I don't think, this is possible...

    I tried to get rid of LUA a few times, since it is driving me nuts that I can't really check my games for memory leaks because the LUA-interpreter allocates and disallocates memory randomly (see e.g. this thread: http://www.leadwerks.com/werkspace/topic/9505-tons-of-memory-leaks-in-leadwerks/).

    Also, if you don't use LUA, this is only wasting performance and memory, so I would absolutely love to see the possibility to turn off LUA (/ to not turn it on in first place).

  15. I promise I will not ever make the interface more like Blender.

     

    That's a real shame. Blender's user interface is very well thought through.

     

    (Also, this statement makes me wonder, why you wanted this Blender plugin, if you seem to despise Blender.)

  16. The microsoft compiler has some settings for optimization.

    You will find them in VS 2013 by clicking

     

    Debug -> [Project name] properties... -> Configuration Properties -> C/C++ -> Optimization

     

    You should set the value of "Optimization" to "Maximize Speed (/O2)" and "Favor Size Or Speed" to "Favor fast code (/Ot)".

    I am not sure, whether the other settings will also have a noticeable impact but these should be the most important ones.

    Be sure to select the "Release"-Configuration in the Combobox at the top of the dialog window.

×
×
  • Create New...