Opened 14 years ago

Closed 14 years ago

Last modified 8 years ago

#497 closed task (fixed)

Make square unit outlines match the ground better

Reported by: Philip Taylor Owned by: Evans
Priority: Nice to Have Milestone:
Component: UI & Simulation Keywords: simple
Cc: Patch:

Description

See ConstructSquareOnGround in simulation2/helpers/Render.cpp (used to render the outlines of selected units). Currently it constructs a 4-point square, and moves each point vertically to match the terrain. That looks a bit rubbish if a unit with a large square outline is on bumpy land.

The straight edges ought to be split into smaller segments, each of which is fitted to the terrain, so that the whole shape fits better. Rather than a fixed number of segments, I guess they should be split so each segment is slightly smaller than a tile (4 units), or whatever looks reasonable without wasting lots of vertexes.

Attachments (2)

Render.dif (2.4 KB ) - added by Evans 14 years ago.
Render.diff (2.6 KB ) - added by Evans 14 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Hemu, 14 years ago

Owner: changed from Philip Taylor to Hemu
Status: newassigned

by Evans, 14 years ago

Attachment: Render.dif added

comment:2 by Evans, 14 years ago

Owner: changed from Hemu to Evans
Status: assignednew

comment:3 by Evans, 14 years ago

Keywords: review added
Status: newassigned

comment:4 by Philip Taylor, 14 years ago

Keywords: review removed

In SplitLine, if length < 4 then pieces == 0 and it'll do a divide-by-zero and get infinities, which is a bit ugly. Could you change it to skip those divisions if pieces == 0?

Also, if pieces == 0 then pieces - 1 == 4294967295 (unsigned) and the loop will try to add four billion points, which is not good. (To test it, try selecting the siege weapons in the techdemo1 map).

Also, each SplitLine adds both the start and end points, so the points at the corners will be duplicated - it should only add the corners once.

I think it should be okay after those fixes.

by Evans, 14 years ago

Attachment: Render.diff added

comment:5 by Evans, 14 years ago

Keywords: review added

I've fixed the code as mentioned. It should be okay now, I hope. The selection box renders correctly for siege units.

comment:6 by philip, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [7788]) Fix #497 (Make square unit outlines match the ground better), based on patch from evans

comment:7 by (none), 14 years ago

Milestone: Unclassified

Milestone Unclassified deleted

comment:8 by sanderd17, 8 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.