Log In  

Cart #td3d-0 | 2020-06-19 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

Ok I finally got it right.

This is pretty much a prism command that draws a rectangle as well as lines to connect it to another rectange that's a little larger.

Enjoy!

P#78299 2020-06-19 19:57

@cwiser I'm glad you got it posted.

This is close to what I'm doing with a top down view of buildings in an as yet unnamed (and very incomplete) cart. By which I mean to say - I like this. Good going!

P#78304 2020-06-19 20:10 ( Edited 2020-06-19 20:28)

@remcode With solid faces? (if so, uhh... how?)

P#78308 2020-06-19 20:41

@cwiser, that's the bit I haven't implemented yet for the buildings; my plan is to plot my own lines from the points of the ground to the points of the top of the building, then draw lines bewteen those points for the two sides of the building nearest the player. That is, lines parallel to the edges of the rectangles. Does that make sense?

P#78309 2020-06-19 20:45

Gotcha. Sounds like it might not work if the top face of the building is larger than the bottom, which I find is crucial for perspective. Good luck though. I'm excited to check it out.

P#78310 2020-06-19 20:52
1

@cwiser

This is a gif showing what I meant. It shows it in four modes - wireframe, wireframe cull, rainbow, and texture.

The rainbow mode shows best the direction of the lines I'm drawing.

The wireframe cull shows which verticals (in relation to how the buildings stand, not screen verticals) I need to find all the points on so I can join them up. They are the two or three green lines that are left attached to the roof rectangle.

I'm not ready to put this up as code (licensed or unlicensed) - there are a few things I want to improve. I'm only putting up a screen capture gif of it this early because you expressed an interest.


The algorithm goes something like:

  • for each of the lower floor corners find the upper floor corners
  • cull the corner-pairs that won't be used
  • within the culled set, for each upper floor corner, to each corresponding lower floor corner, save the points along a line (a custom line algorithm is needed)
  • for each of lines-as-points that should link up to another, for each pair of points draw a line (rainbow or textured) that links them up

The textured line is achieved with the new tline command.

P#78362 2020-06-21 08:24 ( Edited 2020-06-21 09:11)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 20:32:52 | 0.039s | Q:24