Jump to content

Josh

Staff
  • Posts

    24,625
  • Joined

  • Last visited

Everything posted by Josh

  1. Enter your reg key in both fields.
  2. Rewrote the scripts that needed to be done with the OO single-state system. Just a few things to wrap up now and I will have it available.
  3. I had a dream, but it had nothing to do with coding.
  4. Newton doesn't like scaled matrices. That's it.
  5. Josh

    Why Apple Fails

    Even the $7000 Mac can't run Crysis because it has a budget card. I have tried a GEForce 9800M laptop and was really fast, faster than a full-size 8800. I wouldn't complain so much if Macs had good hardware at ridiculous prices, but the laptop GPUs are about as powerful as a GEForce 6800 and they are selling them for thousands of dollars. And Mac fanboys always brag about how Apple doesn't cut corners with their hardware. Yes they do!
  6. A lua table can't be sent back to the main program. If you think about how Lua has memory management, this makes sense.
  7. Josh

    FAQ LUA

    Local position: model.position.x Global position: model.mat.tx
  8. Josh

    Why Apple Fails

    The 9400M gets 13 FPS with Crysis. The ATI 4670 seems to get decent performance, and that is what they are using in all but the worst IMacs. Too bad the only way to get the 4670 is to pay an extra $300! I could buy a much better GPU for less than half the price increase. The 21.5" iMac with the ATI 4670 is probably the best choice. At $1499, it's more than twice what I would pay for a much better PC.
  9. Josh

    Why Apple Fails

    Their prices are more than 250% the price of a comparable PC. Even their "most expensive" laptop is using a budget GPU! So for less than half the price, you can actually get a laptop with a much better GPU! $999: http://www.newegg.co...=laptop%209800m $2499: http://store.apple.c...mco=MTM3NDcyOTc Just for fun, I checked all the most expensive options. The grand total was $7305.35. Who spends $7000 on a laptop with a budget GPU??? I can't believe how dense their management is. It's as if they don't want to succeed.
  10. Increased to 1024. I didn't even know this setting existed.
  11. Josh

    December 7, 2009

    So you want global variables, but you don't? I suggest storing any per-class variable as member of the class: class.myglobal=3 That should keep your per-class variables out of trouble, and your other scripts can still access them.
  12. You could use model:GetKey() or you could set an internal value when the Lua script calls SetKey(). function SetKey(model,key,value) if key=="pickable" then entity.pickable=tonumber(value) else end end
  13. Uncompressed is required for editing, because the terrain editing is performed on the GPU.
  14. Why would you want to only check for objects that can be picked up? If there is a wall between you and the object, the raycast won't see it. Use collision types for this.
  15. It's 12:30 in the morning, but I have the model scripts working the way I want. Thanks to "Nilium" for his tips, and to everyone who gave their feedback. I am confident in this revision. I have a lot of scripts that need to be slightly altered, but it's just a matter of adjusting the function structure, not really changing any existing code. Here's the light_ambient script: require("scripts/class") require("scripts/linkedlist") local class=CreateClass(...) function class:Spawn(model) local object=self.super:Spawn(model) function object:Update() AmbientLight(self.model.color) end function object:SetKey(key,value) if key=="color" then local returnvalue=self.super:SetKey(key,value) self:Update() return returnvalue elseif key=="intensity" then local returnvalue=self.super:SetKey(key,value) self:Update() return returnvalue else return self.super:SetKey(key,value) end return 1 end function object:Kill(model) local model,object --Iterate through all instances of this class. --If any instances are found, use them to set --the ambient light value. for model,object in pairs(self.class.instances) do if object~=self then object:Update() break end end self.super:Kill() end object.model:SetKey("intensity","0.5") --Call the update function before finishing. --This can only be called after the function is declared. --We don't actually need to call it here since setting the intensity key --will do that for us, but it's still a good idea as a general rule. object:Update() end function class:Cleanup() --Restore default ambient light setting. AmbientLight(Vec3(0.5,0.5,0.5)) self.super:Cleanup() end
  16. Josh

    Single-state Lua

    It's like calling base_whatever().
  17. Josh

    Single-state Lua

    I've got it working now. Here's what it looks like: require("scripts/class") local class=CreateClass(...) function class:InitDialog(grid) self.super:InitDialog(grid) group=grid:AddGroup("Light") group:AddProperty("Resolution",PROPERTY_CHOICE,"256,512,1024,2048") group:AddProperty("linearoffset",PROPERTY_VEC3,"0,1,2","Linear offset" ) group:AddProperty("shadowdistance",PROPERTY_VEC3,"","Shadow distance" ) group:AddProperty("Range",PROPERTY_FLOAT) group:Expand(1) end function class:Spawn(model) local object=self.super:Spawn(model) object.model:SetKey("resolution","2") object.light=CreateDirectionalLight(object.model) function object:SetKey(key,value) if key=="resolution" then if value=="0" then self.light:SetShadowmapSize(256) elseif value=="1" then self.light:SetShadowmapSize(512) elseif value=="2" then self.light:SetShadowmapSize(1024) elseif value=="3" then self.light:SetShadowmapSize(2048) end elseif key=="range" then self.light:SetRange(value) elseif key=="shadowdistance" then local offset=string.Explode(value,",") x=tonumber(offset[1]) y=tonumber(offset[2]) z=tonumber(offset[3]) if x==nil then x=0 end if y==nil then y=0 end if z==nil then z=0 end self.light:SetShadowDistance(x,0) self.light:SetShadowDistance(y,1) self.light:SetShadowDistance(z,2) elseif key=="linearoffset" then local offset=string.Explode(value,",") x=tonumber(offset[1]) y=tonumber(offset[2]) z=tonumber(offset[3]) if x==nil then x=0 end if y==nil then y=0 end if z==nil then z=0 end self.light:SetShadowOffset(x,1.0,0) self.light:SetShadowOffset(y,1.0,1) self.light:SetShadowOffset(z,1.0,2) else return self.super:SetKey(key,value) end end function object:GetKey(key,value) if key=="linearoffset" then return self.light:GetShadowOffset(0,0)..","..self.light:GetShadowOffset(0,1)..","..self.light:GetShadowOffset(0,2) elseif key=="shadowdistance" then return self.light:GetShadowDistance(0)..","..self.light:GetShadowDistance(1)..","..self.light:GetShadowDistance(2) elseif key=="range" then return self.light:GetRange() elseif key=="shadowresolution" then resolution=self.light:GetShadowmapSize() if resolution==256 then return 0 elseif resolution==512 then return 1 elseif resolution==1024 then return 2 elseif resolution==2048 then return 3 else return -1 end else return self.super:GetKey(key,value) end end function object:Kill(model) if self.light~=nil then self.light:Free() self.light=nil end self.super:Kill() end return object end
  18. I think the main point is C# has memory management which can make complex apps a lot easier. However, most third party libraries you will find are written in C++, so I am not sure what the point of using C# is. There are easier languages that are cross-platform compatible like Java and BlitzMax. I think C# is still Windows-only. There might be some workarounds, but since it is MS you know they are probably never going to put real effort into Linux and Mac. There are other people who know a lot more about C# than me, so take that with a grain of salt.
  19. Josh

    Scripted GUI

    File Name: Scripted GUI File Submitter: Josh File Submitted: 06 Dec 2009 File Category: Lua Scripts Here's a GUI system with support for windows, panels, drop down boxes, buttons, sliders, labels, and checkboxes. It could still use some improvement, but it's pretty functional and provides a good base to work with. Click here to download this file
  20. That post is referring to textures that have partial mipmaps. Mipmaps should not be required, but if they are present, the texture should have all of them down to 1x1.
  21. Josh

    Single-state Lua

    I have something else wrong here...
×
×
  • Create New...