Skip to navigation

Revs on the BBC Micro

3D objects: objectScaffold

Name: objectScaffold [Show more] Type: Variable Category: 3D objects Summary: The scaffold used to construct each object, in a scalable format Deep dive: Scaling objects with scaffolds
Context: See this variable in context in the source code References: This variable is used as follows: * ScaleObject calls objectScaffold

This table contains an object's scaffold, in a format that supports quick and easy scaling (see the ScaleObject routine). Each object has its own scaffold, which contains all the measurements that we need to build that object. The object is constructed using only measurements from the scaffold, so if we want to scale the object, we can just scale the scaffold. Each object has a number of entries in this table, one for each scaffold measurement, in decreasing order of size (so the largest measurements come first). Each scaffold measurement is in one of these binary formats: %00000ccc %1abbbccc where a = %a, b = %bbb and c = %ccc. The value represented by %00000ccc is: 1 --------- 2^(c - 2) and the value represented by %1abbbccc is: a 1 1 - + --------- + --------- 2 2^(b - 2) 2^(c - 2) In both cases, the result is a multiple of 1/32, so each of these entries represents a fraction of the form n/32. The ScaleObject routine takes the scaffold for a specific object and scales it by multiplying each scaffold measurement by the following: scaleUp ----------- 2^scaleDown The resulting values are stored in the scaledScaffold table, which uses the same structure as the object's section in the objectScaffold table, but contains the scaled scaffold to use when drawing the scaled object.
.objectScaffold \ Object type 0 = 24, 22, 18, 17, 16, 8, 5, 4 EQUB %10011100 \ 1 0 011 100 a = 0 b = 3 c = 4 \ 0/2 + 1/2^1 + 1/2^2 = 24/32 EQUB %11101110 \ 1 1 101 110 a = 1 b = 5 c = 6 \ 1/2 + 1/2^3 + 1/2^4 = 22/32 EQUB %10011110 \ 1 0 011 110 a = 0 b = 3 c = 6 \ 0/2 + 1/2^1 + 1/2^4 = 18/32 EQUB %10011111 \ 1 0 011 111 a = 0 b = 3 c = 7 \ 0/2 + 1/2^1 + 1/2^5 = 17/32 EQUB %00000011 \ 0 0 000 011 c = 3 \ 1/2^1 = 16/32 EQUB %00000100 \ 0 0 000 100 c = 4 \ 1/2^2 = 8/32 EQUB %10101111 \ 1 0 101 111 a = 0 b = 5 c = 7 \ 0/2 + 1/2^3 + 1/2^5 = 5/32 EQUB %00000101 \ 0 0 000 101 c = 5 \ 1/2^3 = 4/32 \ Object type 1 = 20, 12, 9, 8, 6, 5, 2, 1 EQUB %10011101 \ 1 0 011 101 a = 0 b = 3 c = 5 \ 0/2 + 1/2^1 + 1/2^3 = 20/32 EQUB %10100101 \ 1 0 100 101 a = 0 b = 4 c = 5 \ 0/2 + 1/2^2 + 1/2^3 = 12/32 EQUB %10100111 \ 1 0 100 111 a = 0 b = 4 c = 7 \ 0/2 + 1/2^2 + 1/2^5 = 9/32 EQUB %00000100 \ 0 0 000 100 c = 4 \ 1/2^2 = 8/32 EQUB %10101110 \ 1 0 101 110 a = 0 b = 5 c = 6 \ 0/2 + 1/2^3 + 1/2^4 = 6/32 EQUB %10101111 \ 1 0 101 111 a = 0 b = 5 c = 7 \ 0/2 + 1/2^3 + 1/2^5 = 5/32 EQUB %00000110 \ 0 0 000 110 c = 6 \ 1/2^4 = 2/32 EQUB %00000111 \ 0 0 000 111 c = 7 \ 1/2^5 = 1/32 \ Object type 2 = 26, 24, 18, 17, 16, 5, 3, 2 EQUB %11100110 \ 1 1 100 110 a = 1 b = 4 c = 6 \ 1/2 + 1/2^2 + 1/2^4 = 26/32 EQUB %10011100 \ 1 0 011 100 a = 0 b = 3 c = 4 \ 0/2 + 1/2^1 + 1/2^2 = 24/32 EQUB %10011110 \ 1 0 011 110 a = 0 b = 3 c = 6 \ 0/2 + 1/2^1 + 1/2^4 = 18/32 EQUB %10011111 \ 1 0 011 111 a = 0 b = 3 c = 7 \ 0/2 + 1/2^1 + 1/2^5 = 17/32 EQUB %00000011 \ 0 0 000 011 c = 3 \ 1/2^1 = 16/32 EQUB %10101111 \ 1 0 101 111 a = 0 b = 5 c = 7 \ 0/2 + 1/2^3 + 1/2^5 = 5/32 EQUB %10110111 \ 1 0 110 111 a = 0 b = 6 c = 7 \ 0/2 + 1/2^4 + 1/2^5 = 3/32 EQUB %00000110 \ 0 0 000 110 c = 6 \ 1/2^4 = 2/32 \ Object type 3 = 16, 10, 6, 4, 3, 1 EQUB %00000011 \ 0 0 000 011 c = 3 \ 1/2^1 = 16/32 EQUB %10100110 \ 1 0 100 110 a = 0 b = 4 c = 6 \ 0/2 + 1/2^2 + 1/2^4 = 10/32 EQUB %10101110 \ 1 0 101 110 a = 0 b = 5 c = 6 \ 0/2 + 1/2^3 + 1/2^4 = 6/32 EQUB %00000101 \ 0 0 000 101 c = 5 \ 1/2^3 = 4/32 EQUB %10110111 \ 1 0 110 111 a = 0 b = 6 c = 7 \ 0/2 + 1/2^4 + 1/2^5 = 3/32 EQUB %00000111 \ 0 0 000 111 c = 7 \ 1/2^5 = 1/32 \ Object type 4 = 26, 17, 16, 12, 6, 5, 3, 1 EQUB %11100110 \ 1 1 100 110 a = 1 b = 4 c = 6 \ 1/2 + 1/2^2 + 1/2^4 = 26/32 EQUB %10011111 \ 1 0 011 111 a = 0 b = 3 c = 7 \ 0/2 + 1/2^1 + 1/2^5 = 17/32 EQUB %00000011 \ 0 0 000 011 c = 3 \ 1/2^1 = 16/32 EQUB %10100101 \ 1 0 100 101 a = 0 b = 4 c = 5 \ 0/2 + 1/2^2 + 1/2^3 = 12/32 EQUB %10101110 \ 1 0 101 110 a = 0 b = 5 c = 6 \ 0/2 + 1/2^3 + 1/2^4 = 6/32 EQUB %10101111 \ 1 0 101 111 a = 0 b = 5 c = 7 \ 0/2 + 1/2^3 + 1/2^5 = 5/32 EQUB %10110111 \ 1 0 110 111 a = 0 b = 6 c = 7 \ 0/2 + 1/2^4 + 1/2^5 = 3/32 EQUB %00000111 \ 0 0 000 111 c = 7 \ 1/2^5 = 1/32 \ Object type 5 = 26, 17, 3 EQUB %11100110 \ 1 1 100 110 a = 1 b = 4 c = 6 \ 1/2 + 1/2^2 + 1/2^4 = 26/32 EQUB %10011111 \ 1 0 011 111 a = 0 b = 3 c = 7 \ 0/2 + 1/2^1 + 1/2^5 = 17/32 EQUB %10110111 \ 1 0 110 111 a = 0 b = 6 c = 7 \ 0/2 + 1/2^4 + 1/2^5 = 3/32 \ Object type 6 = 16, 10, 1 EQUB %00000011 \ 0 0 000 011 c = 3 \ 1/2^1 = 16/32 EQUB %10100110 \ 1 0 100 110 a = 0 b = 4 c = 6 \ 0/2 + 1/2^2 + 1/2^4 = 10/32 EQUB %00000111 \ 0 0 000 111 c = 7 \ 1/2^5 = 1/32 \ Object type 7 = 28, 20, 18, 16, 8 EQUB %11100101 \ 1 1 100 101 a = 1 b = 4 c = 5 \ 1/2 + 1/2^2 + 1/2^3 = 28/32 EQUB %10011101 \ 1 0 011 101 a = 0 b = 3 c = 5 \ 0/2 + 1/2^1 + 1/2^3 = 20/32 EQUB %10011110 \ 1 0 011 110 a = 0 b = 3 c = 6 \ 0/2 + 1/2^1 + 1/2^4 = 18/32 EQUB %00000011 \ 0 0 000 011 c = 3 \ 1/2^1 = 16/32 EQUB %00000100 \ 0 0 000 100 c = 4 \ 1/2^2 = 8/32 \ Object type 8 = 18, 16, 3, 2 EQUB %10011110 \ 1 0 011 110 a = 0 b = 3 c = 6 \ 0/2 + 1/2^1 + 1/2^4 = 18/32 EQUB %00000011 \ 0 0 000 011 c = 3 \ 1/2^1 = 16/32 EQUB %10110111 \ 1 0 110 111 a = 0 b = 6 c = 7 \ 0/2 + 1/2^4 + 1/2^5 = 3/32 EQUB %00000110 \ 0 0 000 110 c = 6 \ 1/2^4 = 2/32 \ Object type 9 = 16, 12, 10, 3 EQUB %00000011 \ 0 0 000 011 c = 3 \ 1/2^1 = 16/32 EQUB %10100101 \ 1 0 100 101 a = 0 b = 4 c = 5 \ 0/2 + 1/2^2 + 1/2^3 = 12/32 EQUB %10100110 \ 1 0 100 110 a = 0 b = 4 c = 6 \ 0/2 + 1/2^2 + 1/2^4 = 10/32 EQUB %10110111 \ 1 0 110 111 a = 0 b = 6 c = 7 \ 0/2 + 1/2^4 + 1/2^5 = 3/32 \ Object type 10 = 10, 9, 6, 4, 1 EQUB %10100110 \ 1 0 100 110 a = 0 b = 4 c = 6 \ 0/2 + 1/2^2 + 1/2^4 = 10/32 EQUB %10100111 \ 1 0 100 111 a = 0 b = 4 c = 7 \ 0/2 + 1/2^2 + 1/2^5 = 9/32 EQUB %10101110 \ 1 0 101 110 a = 0 b = 5 c = 6 \ 0/2 + 1/2^3 + 1/2^4 = 6/32 EQUB %00000101 \ 0 0 000 101 c = 5 \ 1/2^3 = 4/32 EQUB %00000111 \ 0 0 000 111 c = 7 \ 1/2^5 = 1/32 \ Object type 11 = 10, 8, 6, 5 EQUB %10100110 \ 1 0 100 110 a = 0 b = 4 c = 6 \ 0/2 + 1/2^2 + 1/2^4 = 10/32 EQUB %00000100 \ 0 0 000 100 c = 4 \ 1/2^2 = 8/32 EQUB %10101110 \ 1 0 101 110 a = 0 b = 5 c = 6 \ 0/2 + 1/2^3 + 1/2^4 = 6/32 EQUB %10101111 \ 1 0 101 111 a = 0 b = 5 c = 7 \ 0/2 + 1/2^3 + 1/2^5 = 5/32 \ Object type 12 = 10, 8, 6, 5 EQUB %10100110 \ 1 0 100 110 a = 0 b = 4 c = 6 \ 0/2 + 1/2^2 + 1/2^4 = 10/32 EQUB %00000100 \ 0 0 000 100 c = 4 \ 1/2^2 = 8/32 EQUB %10101110 \ 1 0 101 110 a = 0 b = 5 c = 6 \ 0/2 + 1/2^3 + 1/2^4 = 6/32 EQUB %10101111 \ 1 0 101 111 c = 0 b = 5 c = 7 \ 0/2 + 1/2^3 + 1/2^5 = 5/32