Jump to content

TylerH

Members
  • Posts

    525
  • Joined

  • Last visited

Everything posted by TylerH

  1. What's funny is Leadwerks seems to use all three: Euler Angles, Quaternions, AND Matrices. Since you can presumably get the Matrix, the Euler Angles, and the Quaternion of an entity, it makes sense.
  2. This is one of the biggest downfalls of Leadwerks. Other than the end-user (us) making calls to the FreeXYZ() commands, Leadwerks seems to not handle any of its own memory; it leaves everything up to the Blitzmax Garbage Collector. In the real world of programming, alas C/C++/C99, and non managed/BASIC languages, there is no garbage collector, thus you must either manage your memory well or suffer from obvious leaks. I believe that if Leadwerks Engine managed its own memory, and smartly handled references, pointers, etc. and freed things on its own when appropriate, and not having any dependence at all on the BMX Garbage Collector, it would finally be on an equal plane to other engines on the market today.
  3. TylerH

    Light color?

    Ah, ok. But again, I think Josh needs to look into this more. There is obviously something wrong.
  4. Argh, it isn't like anyone else here can't make a 5 minute demo with 20 character controllers, or for Josh to try it himself...
  5. I am a bit annoyed by the fact the things like lights, emitters, and other "info" type entities need to have a gmf model and phy file. This is a waste of objects the scenegraph has to go through, and they aren't even removed when loaded in a game, causing issues with anything from doing line picks, to causing slow downs. I would like to formally request the ability to have entities that don't have to have a model with them. A light should be able to just be a light entity, an emitter be an emitter. If you want to attach an entity to a mesh, go right ahead, but it shouldn't be required... This is a major problem, and it should be dealt with timely.
  6. The code to his shaders for the chromatic dispersion is included in the HNPHAN folder in every single Leadwerks distro.
  7. I still get it in game mode, it affects anything to do with AppTime or AppSpeed or intense physics, i.e. animation.
  8. TylerH

    MumblesLib

    Thanks for this, will make a save game format easier and more space-conservative.
  9. TylerH

    Light color?

    I am getting sick of this. We need an explanation for all this "bugs occur and fix randomly" and such.
  10. This is the same problem I am getting, which is casing the animation issues in Weaponwerks.
  11. I was working on one that supported animation, but I couldn't get the triangles to export properly. I will release my code if anyone wants it.
  12. This is on hold for a number of bugs in 2.3 single state: 1) Half of the sounds no longer play at the proper frame / at all 2) Animations are running as if the FPS is 5, when the FPS is 60 to 80. Not sure what is causing this.
  13. Well, considering the speed drop you get when using directional lights, and the fact having more than one causes the scene to be squished, they might as well be rendering the scene 16 times...
  14. TylerH

    What's missing?

    Lumooja's shot seems more fun than yours. Your shot, Ubu, just looks like every single other Leadwerks shot. No one seems to vary the ambiance enough to get a unique look. Lumooja seems pretty close to a nice, dramatic look, but it is a bit dark.
  15. Bytes Per Pixel x (Shadowmap Resolution ^2) x (# Light Projections) / (ShadowMapResolution*2) = Total Video Memory Used?
  16. 16 for directional lights I thought?
  17. xD. No headaches so far, other than the one from my cold + sinus congestion. I actually found it easier, since I can bypass the entity key system and just set values directly to the Lua object (see SetKey and GetKey for material, aperture, and tessellation )
  18. Here is the newest version. This supports just about everything I want, except the vertices are not UV Mapped, so materials do not appear properly. It supports customizable aperture (like radius, but in geometry terms for square), tessellation (if you have a larger sized decal, you may need to increase tessellation, otherwise you will experience issues with the decal aligning to the terrain). The terrain alignment code now also uses TerrainElevation as opposed to TerrainHeight, so the decal can be smaller than a terrain tile and still be aligned relatively accurately. Ofcourse someone may come along and find an even better approahc to align the decal to the terrain, so I applaud everyone who wishes to improve this. Things that need done before this is usable: 1) UV Coordinates Code: require("Scripts/class") require("Scripts/Math/math") require("Scripts/Primitives/Patch") require("Scripts/Math/Plane") require("Scripts/linkedlist") local class=CreateClass(...) function class:GetTerrain(world) local terrain for terrain in iterate(world.terrains) do return terrain end end function class:InitDialog(grid) self.super:InitDialog(grid) group=grid:AddGroup("Terrain Decal") group:AddProperty("aperture",PROPERTY_FLOAT,"0.5,10,1","Aperture") group:AddProperty("tessellation",PROPERTY_FLOAT,"1,10,0","Tessellation") group:Expand(1) end function class:CreateObject(model) local object=self.super:CreateObject(model) function object:CreateTerrainAlignedPatch() if (object.patch ~= nil) then object.patch:Free() end local terrain = self.class:GetTerrain(self.model.world) local meterspertile=2.0 if terrain~=nil then self.terrain = terrain meterspertile=terrain.scale.x end local pos = self.model.position cx = pos.x - (self.aperture/2) cz = pos.z - (self.aperture/2) w = 1.0 d = 1.0 patch=CreatePatch(w*self.tessellation,d*self.tessellation) patchsurf=patch:GetSurface(1) patchsurf:Scale(Vec3(meterspertile*w*self.aperture,1.0,meterspertile*d*self.aperture)) patchsurf:Translate(Vec3((cx-Round(w/meterspertile/meterspertile)*meterspertile),0,(cz-Round(d/meterspertile/meterspertile)*meterspertile))) --end if terrain~=nil then for v=0,patchsurf:CountVertices()-1 do local t=patchsurf:GetVertexPosition(v) t.y = TerrainElevation(terrain,t.x,t.z)+0.025--*terrain.scale.y+0.01 patchsurf:SetVertexPosition(v,t) end end patch:UpdateLocalAABB() patch:UpdateAABB() --calculate texcoords/normals for n=0,patchsurf:CountVertices()-1 do t=patchsurf:GetVertexPosition(n) if terrain~=nil then patchsurf:SetVertexNormal(n,terrain:CalcNormal(t.x,t.z)) else patchsurf:SetVertexNormal(n,Vec3(0,1,0)) end end patchsurf:UpdateTangentsAndBinormals() if (self.material ~= nil) then patch:Paint(self.material,0) end patch:SetParent(self.model,1) self.patch = patch end function object:UnlockKeys() self.super:UnlockKeys() end function object:SetKey(key,value) if key=="material" then self.materialname = value self.material = LoadMaterial("abstract::"..value) if (self.patch ~= nil) then self.patch:Paint(self.material,0) end elseif key=="aperture" then self.aperture = tonumber(value) self:CreateTerrainAlignedPatch() elseif key=="tessellation" then self.tessellation = tonumber(value) self:CreateTerrainAlignedPatch() else return self.super:SetKey(key,value) end end function object:GetKey(key,value) if key=="material" then return self.materialname elseif key=="aperture" then return self.aperture elseif key=="tessellation" then return self.tessellation else return self.super:GetKey(key,value) end end function object:SetTarget(target,index) end function object:UpdateMatrix() self:CreateTerrainAlignedPatch() end function object:ReceiveMessage(message,extra) self.super:ReceiveMessage(message,extra) end function object:Free(model) self.super:Free() end object.aperture = 0.5 object.tessellation = 1.0 object:CreateTerrainAlignedPatch() end function class:Free() self.super:Free() end
  19. Here is the working code. I need to figure out how to calculate the UV Coords properly, and scale the entire system down so the patch can be much smaller (for small decals, ofcourse B)) require("Scripts/class") require("Scripts/Math/math") require("Scripts/Primitives/Patch") require("Scripts/Math/Plane") require("Scripts/linkedlist") require("Scripts/hooks") require("Scripts/loop") local class=CreateClass(...) function class:GetTerrain(world) local terrain for terrain in iterate(world.terrains) do return terrain end end function class:InitDialog(grid) self.super:InitDialog(grid) end function class:CreateObject(model) local object=self.super:CreateObject(model) function object:CreateTerrainAlignedPatch() if (object.patch ~= nil) then object.patch:Free() end local terrain = self.class:GetTerrain(self.model.world) local meterspertile=2.0 if terrain~=nil then self.terrain = terrain meterspertile=terrain.scale.x end local pos = self.model.position if meterspertile==1 then --[[x0=math.floor(self.model.aabb.x0) x1=math.ceil(self.model.aabb.x1) z0=math.floor(self.model.aabb.z0) z1=math.ceil(self.model.aabb.z1)]] x0=math.floor(pos.x)-1 x1=math.ceil(pos.x)+1 z0=math.floor(pos.z)-1 z1=math.ceil(pos.z)+1 cx=x0 cz=z0 w=x1-x0 d=z1-z0 patch=CreatePatch(w,d) patchsurf=patch:GetSurface(1) patchsurf:Scale(Vec3(w,1.0,d)) patchsurf:Translate(Vec3(x0,0,z0)) else --[[x0=math.floor(self.model.aabb.x0/meterspertile)*meterspertile x1=math.ceil(self.model.aabb.x1/meterspertile)*meterspertile z0=math.floor(self.model.aabb.z0/meterspertile)*meterspertile z1=math.ceil(self.model.aabb.z1/meterspertile)*meterspertile]] x0=math.floor((pos.x-1)/meterspertile)*meterspertile x1=math.ceil((pos.x+1)/meterspertile)*meterspertile z0=math.floor((pos.z-1)/meterspertile)*meterspertile z1=math.ceil((pos.z+1)/meterspertile)*meterspertile cx=x0 cz=z0 w=x1-x0 d=z1-z0 patch=CreatePatch(w,d) patchsurf=patch:GetSurface(1) patchsurf:Scale(Vec3(meterspertile*w,1.0,meterspertile*d)) patchsurf:Translate(Vec3((cx-Round(w/meterspertile/meterspertile)*meterspertile),0,(cz-Round(d/meterspertile/meterspertile)*meterspertile))) end if terrain~=nil then for v=0,patchsurf:CountVertices()-1 do local t=patchsurf:GetVertexPosition(v) local px,pz px = t.x/meterspertile+terrain.resolution/2.0 pz = t.z/meterspertile+terrain.resolution/2.0 t.y = terrain:GetHeight(px,pz)*terrain.scale.y+0.01 patchsurf:SetVertexPosition(v,t) end end patch:UpdateLocalAABB() patch:UpdateAABB() --calculate texcoords/normals for n=0,patchsurf:CountVertices()-1 do t=patchsurf:GetVertexPosition(n) if terrain~=nil then patchsurf:SetVertexNormal(n,terrain:CalcNormal(t.x,t.z)) else patchsurf:SetVertexNormal(n,Vec3(0,1,0)) end end patchsurf:UpdateTangentsAndBinormals() if (self.material ~= nil) then patch:Paint(self.material,0) end patch:SetParent(self.model,1) self.patch = patch end function object:UnlockKeys() self.super:UnlockKeys() end function object:SetKey(key,value) if key=="material" then self.materialname = value self.material = LoadMaterial("abstract::"..value) if (self.patch ~= nil) then self.patch:Paint(self.material,0) end else return self.super:SetKey(key,value) end end function object:GetKey(key,value) if key=="material" then return self.materialname else return self.super:GetKey(key,value) end end function object:SetTarget(target,index) end function object:UpdateMatrix() self:CreateTerrainAlignedPatch() end function object:ReceiveMessage(message,extra) self.super:ReceiveMessage(message,extra) end function object:Free(model) self.super:Free() end object:CreateTerrainAlignedPatch() end function class:Free() self.super:Free() end Images are in the gallery.
  20. It is all good. I created a new entity from scratch in the single-state 2.3 Editor, and got everything working great. I just need to setup UV coordinates, grab a material for a cool terrain decal, place some, and grab some screenshots.
  21. That is strange, because I don't get that at all.
×
×
  • Create New...