XRay Shader
Posted: 06 May 2008, 19:42
Right then, I noticed the Xray shader is still rendering the xray outline of the units even when the normal render of the units is using the custom icons. So I thought this would be a good excuse for me to learn some Lua hacking!
I had a look at the healthbars widget to see how to make the decision to render the full bars, the cut down ones, or nothing at all and it's a reasonably simple distance calculation between the camera and the unit/feature. All good so far. However, in my spring settings, my unit icon draw distance is set to 129. However, the healthbars widget uses code like this:
So the infoDistance variable is the one deciding how far you can be while still seeing the full bars. It's also actually the square of the distance, presumably because the sqrt on dist isn't really needed for optimisation reasons.
So the infoDistance for full text display is really representing a distance of 836 (700000 ^ 0.5). I would expect this distance to be less than the icon draw distance (129), because you need to be quite close to see the full info on the healthbars, but quite far before unit icons are drawn. So where this big difference in scales come from?
Secondly, in Lua, how do I get access to the clients graphical settings (like the unit icon draw distance)? I had a look at the wiki, but I can only see game/mod/map/server related settings, but not client settings... Am I looking in the wrong place?
I had a look at the healthbars widget to see how to make the decision to render the full bars, the cut down ones, or nothing at all and it's a reasonably simple distance calculation between the camera and the unit/feature. All good so far. However, in my spring settings, my unit icon draw distance is set to 129. However, the healthbars widget uses code like this:
Code: Select all
local infoDistance = 700000
<snip>
cx, cy, cz = GetCameraPosition()
<snip>
local ux, uy, uz = GetUnitViewPosition(unitID)
local dx, dy, dz = ux-cx, uy-cy, uz-cz
dist = dx*dx + dy*dy + dz*dz
if (dist>9000000) then
return
elseif (dist > infoDistance) then
fullText = false
end
So the infoDistance for full text display is really representing a distance of 836 (700000 ^ 0.5). I would expect this distance to be less than the icon draw distance (129), because you need to be quite close to see the full info on the healthbars, but quite far before unit icons are drawn. So where this big difference in scales come from?
Secondly, in Lua, how do I get access to the clients graphical settings (like the unit icon draw distance)? I had a look at the wiki, but I can only see game/mod/map/server related settings, but not client settings... Am I looking in the wrong place?