Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
  You are not logged in - nap
Wire Frame Demo   [2014]

Wire Frame Demo Released by :
Color Bar

Release Date :
28 January 2014

Type :
C64 One-File Demo

Videosystem: any

User rating:awaiting 8 votes (3 left)   See votestatistics

Credits :
Code .... Color Bar

Download :

Look for downloads on external sites:
 Pokefinder.org


Production Info
Submitted by Rastah Bar on 28 January 2014
A couple of remarks about the code:

Rotations are around one axis at a time. I used the following tricks to make them fast:

Rotations are over a fixed small angle. The angle is chosen such that sin(phi)=1/8 or -1/8, then cos(phi) is very close to 1-1/128-1/32768. Rotations are calculated with 24 bits accuracy. Further, suppose you rotate first around the x-axis and then around the z-axis, then you can write:

x(i+2)=z(i)+(x(i+1)-z(i+1))*cos(phi)
y(i+2)=y(i)+(x(i+1)-z(i+1))*sin(phi)

where e.g. y(i) is the y-coord after the i-th rotation.
Now you need to calculate only 2 cos/sin terms, while with the rotation matrix there are 4 of such terms.

Similar equations can be derived for 2 consecutive rotations around any 2 axes.

All lines are composed of short segments where either the x or y coordinate doesn't change. I stored for each full line (in one octant) the lengths of the short segments. Then when drawing a line, I read the segment lengths from the table and decreased a counter (the x- or y-register usually), and when it is zero, I have to increase/decrease the x- or y- coordinate. I tried to make the code as efficient as possible. For example, for longer horizontal segments you can plot 1 whole byte at a time instead of 1 bit at a time. And I actually subtracted 1 from all segment lengths in the table, because I can then branch off with an 'beq' to plot just the one point when the segment has length 1. I considered several variations, but found that often you win some for flat lines and then you lose some for steeper lines, or there is some compromise between shorter and longer lines. It will probably help to write separate routines for different line slopes, but I did not want to go that far.

I keep track of the maximum x and y coordinates in a plot, so that I only have to clear the used part of the screen when starting to draw a new plot.

To calculate the projections (in "perspective" mode) I used the so-called log-exp method, with carefully designed tables.
Search CSDb
Advanced
Navigate
Prev - Random - Next
Detailed Info
· Summaries
· User Comments (8)
· Production Notes (1)
Fun Stuff
· Goofs
· Hidden Parts
· Trivia
Forum
· Discuss this release
Support CSDb
Help keep CSDb running:



Funding status:




About this site:
CSDb (Commodore 64 Scene Database) is a website which goal is to gather as much information and material about the scene around the commodore 64 computer - the worlds most popular home computer throughout time. Here you can find almost anything which was ever made for the commodore 64, and more is being added every day. As this website is scene related, you can mostly find demos, music and graphics made by the people who made the scene (the sceners), but you can also find a lot of the old classic games here. Try out the search box in the top right corner, or check out the CSDb main page for the latest additions.
Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.085 sec.