Jump to content

Josh

Staff
  • Posts

    24,155
  • Joined

  • Last visited

Everything posted by Josh

  1. Try this for the firepit script and it will work: require("scripts/class") local class=CreateClass(...) class.sound=LoadSound('abstract::campfire_01_15.wav') function class:CreateObject(model) local object=self.super:CreateObject(model) object.model.aabb.x0=-5 object.model.aabb.x1=5 object.model.aabb.y0=-5 object.model.aabb.y1=5 object.model.aabb.z0=-5 object.model.aabb.z1=5 --Create light object.light=CreatePointLight(4,model) object.light:SetColorf(1,0.6,0.25,1,1) object.light:SetPositionf(0,1.2,0,0) object.light:SetShadowOffset(0,0.91,0) --Create emitters if fw~=nil then SetWorld(fw.transparency.world) object.heathaze=CreateEmitter(10,4500,Vec3(0,1,0),0,object.model) object.heathaze:SetPositionf(-136,52,-662,0) object.material_heathaze=LoadMaterial('abstract::heathaze.mat',0) object.heathaze:Paint(object.material_heathaze,0) object.heathaze:SetRadius(0.25,0.25) object.heathaze:SetWaver(0) object.heathaze:SetOrder(1,0) object.heathaze:SetVelocity(Vec3(0,0.375,0),Vec3(0,0.05,0)) object.heathaze:SetRotationSpeed(0.01) object.heathaze:SetArea(Vec3(0.2,0.0,0.2)) object.heathaze:SetPositionf(0,0.25,0,0) object.fire=CreateEmitter(25,750,Vec3(0,1,0),0,object.model) object.fire:SetPositionf(0,0.25,0,0) object.fire:Paint(LoadMaterial('abstract::fire.mat'),0) object.fire:SetRadius(0.4,0.1) object.fire:SetColorf(0.2,0.2,0.2,1,1) object.fire:SetWaver(1) object.fire:SetVelocity(Vec3(0,1.5,0),Vec3(0,0.05,0)) object.fire:SetRotationSpeed(0.01) object.fire:SetArea(Vec3(0.2,0.1,0.2)) object.sparks=CreateEmitter(5,800,Vec3(0,1,0),0,object.model) object.sparks:Paint(LoadMaterial('abstract::fire.mat'),0) object.sparks:SetRadius(0.01,0.01) object.sparks:SetColorf(1,0.6,0.25,1,1) object.sparks:SetVelocity(Vec3(0,1.5,0),Vec3(0.05,0.5,0.05)) object.sparks:SetRotationSpeed(0.1) object.sparks:SetArea(Vec3(0.4,0.0,0.4)) object.sparks:SetWaver(5) object.sparks:SetPositionf(0,0.25,0,0) SetWorld(fw.main.world) end --Emit fire sound if class.sound~=nil then object.model:EmitSound(class.sound,10,1,1) end --Declare initial values object.fluctuation=1.0 object.smoothedfluctuation=1.0 function object:SetKey(key,value) if key=="color" then elseif key=="intensity" then else return self.super:SetKey(model,key,value) end return 1 end --Force the bounding box to be bigger --[[function object:UpdateMatrix() object.model.aabb.x0=object.model.mat.tx-5 object.model.aabb.x1=object.model.mat.tx+5 object.model.aabb.y0=object.model.mat.ty-5 object.model.aabb.y1=object.model.mat.ty+5 object.model.aabb.z0=object.model.mat.tz-5 object.model.aabb.z1=object.model.mat.tz+5 object.model.aabb:Update() end]]-- function object:GetKey(key,value) if key=="color" then elseif key=="intensity" then else return self.super:GetKey(model,key,value) end return value end function object:Render() self.fluctuation=self.fluctuation+math.random(-100,100)/1000.0*AppSpeed() self.fluctuation=math.min(1.8,self.fluctuation) self.fluctuation=math.max(0.2,self.fluctuation) self.smoothedfluctuation=Curve(self.fluctuation,self.smoothedfluctuation,5.0/AppSpeed()) self.light:SetColorf(1.0*self.smoothedfluctuation,0.6*self.smoothedfluctuation,0.25*self.smoothedfluctuation,1,0) end end
  2. You probably mean 2.1, not 1.2.
  3. Increase the range of the directional light. The huge mountains are intersecting the near camera frustum when the shadow is rendered, resulting in the camera terrain passing in and out of the shadow.
  4. I agree it is annoying, but you can always stick with the module. I don't understand your question about OSX.
  5. I'll add a mechanism whereby you can add a postfilter effect into the renderer. Lua's OO implementation is a bit weird, but in the end you can still go entity:SetPosition(), so I am happy with it.
  6. This option is not quite ready.
  7. Josh

    POO1

    Post the obj file. It appears as if your vertices don't have three components listed: Case "v" If line.length<3 Notify "POO1" AppendFloat position,Float(line[1]) AppendFloat position,Float(line[2]) AppendFloat position,-Float(line[3])
  8. Good eyes! The StringToVec2() thing won't make any difference, but it is fixed.
  9. It will take you a few seconds to change those vec2 range parameters to floats. I agree it is annoying, but I made the change with the approach of "what will result in a better engine six months from now?".
  10. I made a small fix to the waterplane script and uploaded. The SetWaterVisibility arguments were wrong: require("scripts/class") local class=CreateClass(...) function class:InitDialog(grid) self.super:InitDialog(grid) local group=grid:AddGroup("Water") group:AddProperty("submersioncolor",PROPERTY_COLOR,"","Submersion Color") group:AddProperty("Softness",PROPERTY_FLOAT,"0,50") group:AddProperty("Visibility",PROPERTY_VEC2) group:AddProperty("Amplitude",PROPERTY_FLOAT,"0,16") group:AddProperty("WaveSpeed",PROPERTY_FLOAT,"0,10","Wave speed") group:Expand(1) end function class:CreateObject(model) local object=self.super:CreateObject(model) object.height=model.mat.ty object.submersioncolor=Vec4(0.5,0.5,0.5,1.0) object.softness=1 object.visibility=Vec2(0,20) object.amplitude=1 object.wavespeed=1 object.model:SetKey("submersioncolor","128,128,128,255") object.model:SetKey("softness","1.0") object.model:SetKey("visibility","0,20") object.model:SetKey("amplitude","1.0") object.model:SetKey("wavespeed","1.0") function object:Refresh() if fw~=nil then fw.renderer:SetWater(1) fw.renderer:SetWaterHeight(self.height) fw.renderer:SetWaterColor(self.model.color,self.submersioncolor) fw.renderer:SetWaterSoftness(self.softness) fw.renderer:SetWaterVisibility(self.visibility.x,self.visibility.y) fw.renderer:SetWaterAmplitude(self.amplitude) fw.renderer:SetWaterWaveSpeed(self.wavespeed) end end function object:UpdateMatrix() self.height=self.model.mat.ty self:Refresh() end function object:UnlockKeys(model) object:Refresh() end function object:SetKey(key,value) if key=="softness" then self.softness=tonumber(value) elseif key=="submersioncolor" then self.submersioncolor=StringToColor(value) elseif key=="visibility" then self.visibility=StringToVec2(value) elseif key=="wavespeed" then self.wavespeed=tonumber(value) elseif key=="amplitude" then self.amplitude=tonumber(value) elseif key=="position" then local t t=StringToVec3(value) self.height=t.y return self.super:SetKey(key,value) else return self.super:SetKey(key,value) end return 1 end function object:Free() local model,object self.class:RestoreDefaults() for model,object in pairs(self.class.instances) do if object~=self then object:Refresh() break end end self.super:Free() end object:Refresh() end function class:RestoreDefaults() if fw~=nil then fw.renderer:SetWater(0) fw.renderer:SetWaterHeight(0.0) fw.renderer:SetWaterColor(Vec4(1,1,1,1),Vec4(0.5,0.5,0.5,1.0)) fw.renderer:SetWaterSoftness(1.0) fw.renderer:SetWaterVisibility(Vec2(0,50)) fw.renderer:SetWaterAmplitude(1.0) fw.renderer:SetWaterWaveSpeed(1.0) end if fw.renderer.waterpatch~=nil then fw.renderer.waterpatch:SetParent(nil,1) end end function class:Free() self:RestoreDefaults() self.super:Free() end
  11. Josh

    Model request

    Blasphemy! Just kidding. The texturing looks really nice. It seems like it would fit in with a variety of scenes and not look out of place. You can make a drawer shape out of multiple objects. Each object has to be a convex hull, but you can make the phy shape out of multiple convex hulls in one obj file.
  12. I really recommend using the model name, because it is pretty redundant to have to add a classname property any time you add a new class.
  13. Nothing. A lot of the Vec2 arguments in the framework commands were redundant, because you would never have those values as Vec2's in the first place, unlike colors and positions, which often already come in a vector object. The parameters are all documented here: http://leadwerks.com/wiki/index.php?title=Framework If you do not want to mess around with this, just use the existing framewerk module, which will work fine.
  14. The problem with the SBX properties not loading is fixed in the DLL which has been uploaded. If you want the file name of a model, there is a command for that: http://leadwerks.com...odels#ModelName If you want to add a "classname" property for parsing, just open the model .ini file and add something like this: classname="light_directional" That is how it is done in SDK 2.25. I think it is easier to just rely on the model name, because then there is not an extra property to add. Instead of looking for a classname value called "light_directional" look for a file name called "light_directional" (with the file path and extension removed).
  15. It is questionable whether another instance of Lua opened in C can use the lua state created by the engine. The best bet is probably to use the Lua API declared in the engine DLL. Right now the exposed Lua commands are minimal, but I'll add more with time.
  16. Josh

    Model request

    You will need to sync before running the script. The CreateJointSlider() command was missing.
  17. Josh

    Model request

    Drawer 5 and 6 seem to still use triangle mesh collision, so I have them disabled for now. The drawers tend to droop a bit with gravity. This might be due to the way they are positioned. I created the slider joint at (0,0,0) since there are no pivots in the desk mesh to place them. I think the drawers should be centered at their rear center, and then a pivot added to the desk mesh I can use to position them. That might make the slider joint more accurate. Here's the script: require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) local joint local n object.model:SetMass(20) object.model:SetCollisionType(COLLISION_PROP) object.drawer={} for n=1,4 do object.drawer[n]=LoadModel("abstract::0d_drawer_0"..n..".gmf",object.model) object.drawer[n]:SetMass(0.1) object.drawer[n]:SetCollisionType(COLLISION_PROP) joint=CreateJointSlider(object.model,object.drawer[n],Vec3(0,0,0),Vec3(0,0,1)) joint:SetLimits(-0.5,0) end function object:Reset() local n for n=1,6 do if self.drawer[n]~=nil then self.drawer[n]:SetMatrix(self.model.mat) end end end function object:Free() local n for n=1,6 do if self.drawer[n]~=nil then self.drawer[n]:Free() self.drawer[n]=nil end end self.super:Free() end end
  18. How is that rude? I have no control of it. If enough people complain to BRL, maybe it will change. I already wrote on their forum, but they don't care if only I complain about something.
  19. A BSOD when overclocking is not a bug, it's a feature...it keeps your GPU from melting!
  20. 1. Replacing o's with e's is cute, but I don't think the engine API commands should be misspelled. 2. You can use the existing leadwerks.framewerk module if you want. It's the same code. 3. BlitzMax can't compile a module named "framework" so it isn't going to be distributed as a module. Complain to BRL if you don't like this. All in all, this really makes no difference to BMX users, so nothing was gained or lost.
  21. You could still use the buffer commands to write your own rendering routines, though I doubt anyone will do that in Lua. I'm glad we are moving upwards, and not wallowing around in the fundamentals anymore.
  22. Josh

    Model request

    Can you make physics shapes using convex hulls? The triangle mesh can't work with dynamic physics. The mesh looks good.
  23. Josh

    PROPERTY_CHOICE

    Use the choice edit property style.
  24. That's cool, I like having physical books for programming.
  25. Josh

    pak files

    What doesn't happen like it should? Your coffee maker starts squirting gravy? The purple cats outside your window fly upside-down? Be specific. If you mean that your script has no effect, Lua can't run a file from a .pak file, since that is our convention, and Lua doesn't know what it is. I think the best solution is probably to have the engine search for any script by the right name, if one is not found in the same folder as the model. There are reasons for doing the file directly instead of loading the string and passing that to Lua. Only the lua_dofile() command can run a compiled Lua script. It also make debugging easier, because Lua knows what file it is running, and can pass that information back in any error messages that occur.
×
×
  • Create New...