Jump to content

Ma-Shell

Members
  • Posts

    371
  • Joined

  • Last visited

Posts posted by Ma-Shell

  1. Not sure what a card is...

    He means a map. Translation error... At least in german map=Karte=card.

     

    Hello! There was such problem. Created a card with the sky and water. I load it using the following: std:: string mapname = System:: GetProperty ("map", "Maps/my_map_01.map"). I start compilation and at me it is not visible the sky. What do I do not so?sad.png

    This won't load your map.

    You need this:

    http://www.leadwerks.com/werkspace/page/api-reference/_/map/mapload-r510

  2. Most of these values are printed, if you call

    self.context:DrawStats(10, 10, true) [LUA]
    context->DrawStats(10, 10, true) [C++]
    

     

    The third parameter ("extra") set to "true" instead of the default value "false" gives more output, which includes most of the values you mentioned.

    • Upvote 1
  3. 1. LE 2.5 downloads - shaders, assets, scripts, textures and other community driven each and every things.

    http://www.leadwerks.com/werkspace/files/category/39-leadwerks-2/

     

    2/ LE 2.5 engine downloader.

    http://www.leadwerks.com/werkspace/files/file/186-leadwerks-engine-updater/

     

    3. Community wikis, official tutorials, docs,

    Community-Wiki:

    http://leadwerks.wikidot.com/wiki:tutorials

    Official Stuff:

    http://www.leadwerks.com/werkspace/page/documentation

  4. Not really sure, what you are asking. Do you want to draw an image with an alpha-value above your rendered image?

    In that case the following code should do the trick:

     

    int blendModeOld = context->GetBlendMode();
    context->SetBlendMode(Blend::Alpha);
    context->DrawImage(...);
    context->SetBlendMode(blendModeOld);
    

  5. I don't really understand the question but I guess it's about the relationship between Context and Buffer.

    The Context-class inherits from / extends / is a sub-class of the Buffer-class, so basically the context is a special sort of buffer.

  6. You can look at the files I posted over there:

    http://www.leadwerks.com/werkspace/topic/11579-3d-screen-mode-for-3d-glasses/#entry83580

    If you open the StereoRender.cpp from the zip-file, you can see, how you can use buffers.

     

    Basically that file creates a Buffer called "leftEye" by using:

    Buffer* leftEye = Buffer::Create(context->GetWidth() + 1, context->GetHeight(), 1, 1, 0);
    

     

    This buffer can be cleared by

    leftEye->Clear()
    

     

    Rendering to this Buffer is done by:

    context->Disable();
    leftEye->Enable();
    world->Render();
    leftEye->Disable();
    context->Enable();
    

     

    The example then draws the leftEye-image over the context's image by using

    int blendModeOld = context->GetBlendMode();
    context->SetBlendMode(Blend::Alpha);
    context->DrawImage(leftEye->GetColorTexture(), 0, 0, context->GetWidth()+1, context->GetHeight()+1);
    context->SetBlendMode(blendModeOld);
    

    • Upvote 2
  7. First you have to create a new shader with the given code.

    1. To do that navigate to "Shaders/PostEffects" in the "Assets"-Tab.
    2. Right-Click on the dark grey area and choose "New"->"Shader"
    3. Give it a name, e.g. "rain"
    4. Double-Click the newly created file. The script-editor should open. Navigate to the Vertex-Shader by pressing "Vertex" in the white area on the left of the script-editor and paste the Vertex-Shader-Code
    5. Navigate to the Fragment-Shader by pressing "Fragment" and paste the Fragment-Shader-Code and save.
    6. Close the script-editor and select the Root-Object in the "Scene"-tab
    7. Under "Post Effects" add the newly created shader
    8. Select your camera and check the "Use Post-Effects"-Checkbox in the "Camera"-Tab

    • Like 1
    • Upvote 1
  8. You might want to try this PostFx-Shader I derived from

    http://glsl.herokuapp.com/e#14949.0

     

    You might want to play around with some of the values but I think, it's a good start.

     

    Vertex-Shader:

    #version 400
    uniform mat4 projectionmatrix;
    uniform mat4 drawmatrix;
    uniform vec2 offset;
    uniform vec2 position[4];
    in vec3 vertex_position;
    void main(void)
    {
    gl_Position = projectionmatrix * (drawmatrix * vec4(position[gl_VertexID]+offset, 0.0, 1.0));
    }
    

     

    Fragment-Shader:

    #version 400
    float torad(float deg){
    return deg*3.14/180;
    }
    uniform bool isbackbuffer;
    uniform float currenttime;
    uniform vec2 buffersize;
    uniform sampler2D texture1;
    out vec4 fragData0;
    uniform mat4 projectioncameramatrix;
    void main( void ) {
    vec2 tcoord = vec2(gl_FragCoord.xy/buffersize);
    if (isbackbuffer) tcoord.y = 1.0 - tcoord.y;
    float aspect = buffersize.y/buffersize.x;
    tcoord.x = clamp(tcoord.x,0.0,1.0);
    tcoord.y = clamp(tcoord.y,0.0,1.0);
    
    vec2 position = ( gl_FragCoord.xy -  buffersize.xy*.5 ) / buffersize.x;
    position.y+=projectioncameramatrix[1][3];
    position.y-=1.0;
    // 256 angle steps
    float angle = atan(position.y,position.x)/(2.*3.14159265359);
    angle -= floor(angle);
    
    float rad = length(position);
    
    float color = 0.0;
    for (int i = 0; i < 10; i++) {
     float angleFract = fract(angle*256.);
     float angleRnd = floor(angle*256.)+1.;
     float angleRnd1 = fract(angleRnd*fract(angleRnd*.7235)*45.1);
     float angleRnd2 = fract(angleRnd*fract(angleRnd*.82657)*13.724);
     float t = currenttime*.005+angleRnd1*10.;
     float radDist = sqrt(angleRnd2+float(i));
    
     float adist = radDist/rad*.1;
     float dist = (t*.1+adist);
     dist = abs(fract(dist)-.5);
     color += max(0.,.5-dist*40./adist)*(.5-abs(angleFract-.5))*5./adist/radDist;
    
     angle = fract(angle+.61);
    }
    fragData0 = texture(texture1,tcoord);
    fragData0 += vec4( color )*.3;
    }
    

    • Upvote 1
×
×
  • Create New...