96 lines
2.9 KiB
C
96 lines
2.9 KiB
C
/*
|
|
* Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*/
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "a23d2.h"
|
|
|
|
|
|
uint8_t db[8192] = { 0 };
|
|
uint16_t bytes = 0;
|
|
|
|
|
|
void cube(void) {
|
|
int16_t i = 0;
|
|
uint8_t scene[] = {
|
|
STCOL, 0x04, // Red
|
|
SPNT, 0x00, 0xff, 0x00, 0xff, 0x00, 0x03, // Cube
|
|
CPNT, 0x00, 0x01, 0x00, 0xff, 0x00, 0x03,
|
|
CPNT, 0x00, 0x01, 0x00, 0x01, 0x00, 0x03,
|
|
CPNT, 0x00, 0xff, 0x00, 0x01, 0x00, 0x03,
|
|
CPNT, 0x00, 0xff, 0x00, 0xff, 0x00, 0x03,
|
|
CPNT, 0x00, 0xff, 0x00, 0xff, 0x00, 0x05,
|
|
CPNT, 0x00, 0x01, 0x00, 0xff, 0x00, 0x05,
|
|
RAY, 0x00, 0x01, 0x00, 0xff, 0x00, 0x03,
|
|
CPNT, 0x00, 0x01, 0x00, 0x01, 0x00, 0x05,
|
|
RAY, 0x00, 0x01, 0x00, 0x01, 0x00, 0x03,
|
|
CPNT, 0x00, 0xff, 0x00, 0x01, 0x00, 0x05,
|
|
RAY, 0x00, 0xff, 0x00, 0x01, 0x00, 0x03,
|
|
CPNT, 0x00, 0xff, 0x00, 0xff, 0x00, 0x05,
|
|
SPNT, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, // Edge Line
|
|
CPNT, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03,
|
|
END
|
|
};
|
|
|
|
while (scene[i] != END) {
|
|
db[bytes++] = scene[i++];
|
|
}
|
|
}
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
FILE *out;
|
|
|
|
// All scene databases need to begin with the ARRAY and EYE records.
|
|
// The CLPSW clipping setting is up to you. :-)
|
|
|
|
db[bytes++] = ARRAY; // Will be filled in by the program.
|
|
db[bytes++] = 0;
|
|
db[bytes++] = 0;
|
|
|
|
db[bytes++] = EYE; // Will be filled in by the program.
|
|
db[bytes++] = 0x00; // X
|
|
db[bytes++] = 0x00;
|
|
db[bytes++] = 0x00; // Y
|
|
db[bytes++] = 0x00;
|
|
db[bytes++] = 0x00; // Z
|
|
db[bytes++] = 0x00;
|
|
db[bytes++] = 0x00; // P
|
|
db[bytes++] = 0x00; // B
|
|
db[bytes++] = 0x00; // H
|
|
|
|
db[bytes++] = CLPSW;
|
|
db[bytes++] = 0x00;
|
|
|
|
cube();
|
|
|
|
db[bytes++] = END;
|
|
|
|
out = fopen("scene.3d", "wb");
|
|
if (out) {
|
|
fwrite(db, 1, 8192, out);
|
|
fclose(out);
|
|
}
|
|
|
|
return 0;
|
|
}
|