Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Content Count

  • Joined

  • Last visited

Community Reputation

17 Good

About whiterabbit

  • Rank
    Advanced Member

Profile Information

  • Gender
  • Location
    NSW Australia
  1. Calling it with no parameters it writes to the %appdata% (on windows) folder with a default filename, and this works fine when ran from the editor. When called from a published project it creates the file ok, but then crashes. To test just add something like this in App:Loop() if self.window:KeyHit(Key.F5) then self.context:Screenshot() end Output from running in editor: Executing "F:\LeadwerksProjects\BugTest_ScreenshotCrash\BugTest_ScreenshotCrash.exe"... Initializing Lua... Executing file "F:/LeadwerksProjects/BugTest_ScreenshotCrash/Scripts/Error.lua" Executing file "
  2. Very early video just showing the terrain and character movement. And some generated buildings. Things working/worked on so far: The 'terrain' is generated at runtime using perlin noise and Surface:AddVertex(), :SetVertexColor(), :SetVertexNormal(), etc Character controller written from scratch, not using the builtin controller. Shader for the terrain uses a combination of diffuse material, vertex colour, and triangle normal. The diffuse material is black and white, the edges are coloured by multiplying with the surface normal, and the whole triangle is coloured by adding the vert
  3. You need to get the 'length' of their velocity, that will tell you how fast they are moving. You could then multiply JUMPBOOST by that value, but you should probably limit the multiplier to a certain range. I don't know how you do it in C but Lua is easy. local Velocity = ent:GetVelocity() local Speed = Velocity:GetLength() local JumpPower = JUMPBOOST*Speed; --todo: if Speed is 0, what will you do?
  4. This is really holding up my development, can anyone confirm this is a bug or I'm doing something wrong?
  5. This map should demonstrate the bug. Start a new project and copy in the map and scripts. Move the mouse to rotate the camera. It does a trace and positions an object there so the trace is definitely working, but the triangle returned is always 0. PickInfo_BugTest.zip
  6. I first noticed this on a mesh generated using the Surface class but have also checked it against the default teapot model. The result of a pick ( World:Pick() ) will always have triangle 0 instead of whatever the correct triangle id is. I am using the latest Steam version of Leadwerks and my project is up to date. I'll try to put together a simple demonstration scene but it should be pretty easy for anyone to confirm this. It's pretty much as simple as: local Picked = PickInfo() local Hit = World:GetCurrent():Pick(StartPos,EndPos,Picked,0,true) --true for getting the 'nearest'
  7. Is it possible to attach a script to an entity created with code? My searching suggests that there was a function called Entity:SetScript() but I can't find it when searching the documentation (and I am not at the computer with LeadWerks to test it right now). EDIT: Ok it looks like Entity:SetScript() does exist but isn't documented. Some documentation would be nice, I still need to experiment to see whether Script:Start() is called automatically or not after attaching it.
  8. I've also witnessed halved FPS with a :Pause()'d emitter. I didn't report it as it was my first time using them and I thought I might be doing it wrong. Will try it again tonight.
  9. I've experienced this as well, with Lua. I didn't go so far as to check why it was being released when I had manually AddRef()'d it, but this describes it perfectly.
  10. That is C++ code, you are using Lua. Changing -> to : fixes your initial error, but you'll get another error once it gets to std::string I haven't seen the god ray script but I think this is what you need: camera:SetKeyValue("godray_pos", Vec3(-x, -y, -z));
  11. How do I actually do it in the shadow shader since it doesn't have a fragment shader just a vertex shader? As far as I know (and I don't know much about shaders) you can't discard during the vertex shader. EDIT: Should have tried it before posting. I added a very basic fragment shader to it and it works. I copied the fragment from the regular shader and took out everything I didn't need, leaving me with: #version 400 //Uniforms uniform sampler2D texture4;//noise map //Inputs in vec2 ex_texcoords0; in vec4 ex_color; void main(void) { float NoiseV = texture(texture4,ex_texc
  12. This is what I'm thinking, still need to actually test it: float NoiseV = texture(texture4,ex_texcoords0).x; //Lookup the pixel and grab its red (x) value //Assuming texture4 is the noise texture float InvAlpha = 1-ex_color.a; //Invert range from 0...1 to 1...0 //(Better logic might negate the need for this) if (InvAlpha==1) InvAlpha = 1.1; //Change 1 to 1.1 so < is true //(Better logic would negate the need for this) if (NoiseV<InvAlpha) discard; //If the red value of the pixel is less than the alpha value of the model, discard EDIT: This is what I get from the above co
  13. That's what I thought on first reading that, but if the built in rand() function is anything like the first few google results then it will return a the same value for the same input. Since the noise is greyscale you just take the R G or B value of the pixel and use that as your noise. To get the value of the pixel you need to pass your texture into the shader and look it up the same way it (for example) looks up the diffuse texture. I'm keen to give this a try myself once I get home, will post the results if you haven't got a solution working.
  14. This is my basic explanation, hopefully I'm not too wrong. When the image is drawn the color of each pixel is multiplied against the color set by context->SetColor. So for example if pixel in the image is white (RGB = 255,255,255), and the context color is white (1,1,1), then they get multplied together. R := 255 x 1.0 = 255 G := 255 x 1.0 = 255 B := 255 x 1.0 = 255 If the context color was black (0,0,0) everything would be multiplied by 0: 255x0=0 If the image pixel as red (255,0,0), and the context color was 50% grey (0.5,0.5,0.5) the final color would be a darker re
  15. World:Clear() World:Get/SetTessellationQuality() World:CountEntities() World:GetEntity() World:FindEntity()
Facebook Twitter Youtube Github Steam
  • Create New...