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!

7


@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!


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


@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?


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.


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.



[Please log in to post a comment]