add 32bitlogo
This commit is contained in:
parent
3cf693adb1
commit
3474099acc
BIN
model/32bitlogo/32bitlogo.blend
Normal file
BIN
model/32bitlogo/32bitlogo.blend
Normal file
Binary file not shown.
BIN
model/32bitlogo/colors.data
Normal file
BIN
model/32bitlogo/colors.data
Normal file
Binary file not shown.
15
model/32bitlogo/colors.data.h
Normal file
15
model/32bitlogo/colors.data.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern uint32_t _binary_model_32bitlogo_colors_data_start __asm("_binary_model_32bitlogo_colors_data_start");
|
||||||
|
extern uint32_t _binary_model_32bitlogo_colors_data_end __asm("_binary_model_32bitlogo_colors_data_end");
|
||||||
|
extern uint32_t _binary_model_32bitlogo_colors_data_size __asm("_binary_model_32bitlogo_colors_data_size");
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
BIN
model/32bitlogo/colors.png
Normal file
BIN
model/32bitlogo/colors.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
4193
model/32bitlogo/model.h
Normal file
4193
model/32bitlogo/model.h
Normal file
File diff suppressed because it is too large
Load Diff
56
model/model.h
Normal file
56
model/model.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
struct polygon {
|
||||||
|
int a, b, c, d;
|
||||||
|
int material_index;
|
||||||
|
int uv_index;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mesh_material {
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct edge {
|
||||||
|
int a; // vertices index
|
||||||
|
int b; // vertices index
|
||||||
|
};
|
||||||
|
|
||||||
|
struct edge_polygon {
|
||||||
|
struct edge edge;
|
||||||
|
struct {
|
||||||
|
int a;
|
||||||
|
int b;
|
||||||
|
} polygon_index; // polygon indices
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mesh {
|
||||||
|
const vec3 * position;
|
||||||
|
const int position_length;
|
||||||
|
const vec3 * normal;
|
||||||
|
const int normal_length;
|
||||||
|
const vec3 * polygon_normal;
|
||||||
|
const int polygon_normal_length;
|
||||||
|
const polygon * polygons;
|
||||||
|
const int polygons_length;
|
||||||
|
const vec2 ** uv_layers;
|
||||||
|
const int uv_layers_length;
|
||||||
|
const mesh_material * materials;
|
||||||
|
const int materials_length;
|
||||||
|
const edge_polygon * edge_polygons;
|
||||||
|
const int edge_polygons_length;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct object {
|
||||||
|
const struct mesh * mesh;
|
||||||
|
vec3 scale;
|
||||||
|
vec4 rotation;
|
||||||
|
vec3 location;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct material {
|
||||||
|
const void * start;
|
||||||
|
const int size;
|
||||||
|
const int offset;
|
||||||
|
};
|
@ -5,9 +5,6 @@
|
|||||||
#include "systembus.hpp"
|
#include "systembus.hpp"
|
||||||
#include "systembus_bits.hpp"
|
#include "systembus_bits.hpp"
|
||||||
|
|
||||||
#include "sh7091/sh7091.hpp"
|
|
||||||
#include "sh7091/sh7091_bits.hpp"
|
|
||||||
|
|
||||||
#include "holly/background.hpp"
|
#include "holly/background.hpp"
|
||||||
#include "holly/core.hpp"
|
#include "holly/core.hpp"
|
||||||
#include "holly/core_bits.hpp"
|
#include "holly/core_bits.hpp"
|
||||||
@ -22,13 +19,12 @@
|
|||||||
#include "holly/texture_memory_alloc9.hpp"
|
#include "holly/texture_memory_alloc9.hpp"
|
||||||
#include "holly/video_output.hpp"
|
#include "holly/video_output.hpp"
|
||||||
|
|
||||||
#include "font/tandy1k.data.h"
|
|
||||||
|
|
||||||
#include "framebuffer.hpp"
|
#include "framebuffer.hpp"
|
||||||
#include "scene/scene.hpp"
|
#include "scene/scene.hpp"
|
||||||
#include "scene/tracker/scene.hpp"
|
#include "scene/tracker/scene.hpp"
|
||||||
#include "scene/logo/scene.hpp"
|
#include "scene/logo/scene.hpp"
|
||||||
#include "graphics.hpp"
|
#include "graphics.hpp"
|
||||||
|
#include "texture.hpp"
|
||||||
|
|
||||||
static volatile int ta_in_use = 0;
|
static volatile int ta_in_use = 0;
|
||||||
static volatile int core_in_use = 0;
|
static volatile int core_in_use = 0;
|
||||||
@ -78,47 +74,6 @@ void graphics_interrupt(uint32_t istnrm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void transfer_ta_fifo_texture_memory_32byte(void * dst, void * src, int length)
|
|
||||||
{
|
|
||||||
uint32_t out_addr = (uint32_t)dst;
|
|
||||||
sh7091.CCN.QACR0 = ((reinterpret_cast<uint32_t>(out_addr) >> 24) & 0b11100);
|
|
||||||
sh7091.CCN.QACR1 = ((reinterpret_cast<uint32_t>(out_addr) >> 24) & 0b11100);
|
|
||||||
|
|
||||||
volatile uint32_t * base = &store_queue[(out_addr & 0x03ffffe0) / 4];
|
|
||||||
uint32_t * src32 = reinterpret_cast<uint32_t *>(src);
|
|
||||||
|
|
||||||
length = (length + 31) & ~31; // round up to nearest multiple of 32
|
|
||||||
while (length > 0) {
|
|
||||||
base[0] = src32[0];
|
|
||||||
base[1] = src32[1];
|
|
||||||
base[2] = src32[2];
|
|
||||||
base[3] = src32[3];
|
|
||||||
base[4] = src32[4];
|
|
||||||
base[5] = src32[5];
|
|
||||||
base[6] = src32[6];
|
|
||||||
base[7] = src32[7];
|
|
||||||
asm volatile ("pref @%0"
|
|
||||||
: // output
|
|
||||||
: "r" (&base[0]) // input
|
|
||||||
: "memory");
|
|
||||||
length -= 32;
|
|
||||||
base += 8;
|
|
||||||
src32 += 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void transfer_textures()
|
|
||||||
{
|
|
||||||
system.LMMODE0 = 0; // 64-bit address space
|
|
||||||
system.LMMODE1 = 0; // 64-bit address space
|
|
||||||
|
|
||||||
uint32_t offset = texture_memory_alloc.texture.start + 0;
|
|
||||||
void * dst = reinterpret_cast<void *>(&ta_fifo_texture_memory[offset / 4]);
|
|
||||||
void * src = reinterpret_cast<void *>(&_binary_font_tandy1k_data_start);
|
|
||||||
int size = reinterpret_cast<int>(&_binary_font_tandy1k_data_size);
|
|
||||||
transfer_ta_fifo_texture_memory_32byte(dst, src, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void transfer_palettes()
|
void transfer_palettes()
|
||||||
{
|
{
|
||||||
holly.PAL_RAM_CTRL = pal_ram_ctrl::pixel_format::argb1555;
|
holly.PAL_RAM_CTRL = pal_ram_ctrl::pixel_format::argb1555;
|
||||||
@ -144,7 +99,7 @@ void graphics_init()
|
|||||||
background_parameter2(texture_memory_alloc.background[0].start,
|
background_parameter2(texture_memory_alloc.background[0].start,
|
||||||
0xff800080);
|
0xff800080);
|
||||||
|
|
||||||
transfer_textures();
|
texture::transfer_texture_memory();
|
||||||
transfer_palettes();
|
transfer_palettes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
72
src/texture.cpp
Normal file
72
src/texture.cpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#include "texture.hpp"
|
||||||
|
|
||||||
|
#include "memorymap.hpp"
|
||||||
|
|
||||||
|
#include "sh7091/sh7091.hpp"
|
||||||
|
#include "sh7091/sh7091_bits.hpp"
|
||||||
|
|
||||||
|
#include "systembus.hpp"
|
||||||
|
|
||||||
|
#include "holly/texture_memory_alloc9.hpp"
|
||||||
|
|
||||||
|
namespace texture {
|
||||||
|
|
||||||
|
struct texture textures[] = {
|
||||||
|
{
|
||||||
|
.start = reinterpret_cast<void *>(&_binary_font_tandy1k_data_start),
|
||||||
|
.size = reinterpret_cast<int>(&_binary_font_tandy1k_data_size),
|
||||||
|
.offset = offset::tandy1k,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.start = reinterpret_cast<void *>(&_binary_model_32bitlogo_colors_data_start),
|
||||||
|
.size = reinterpret_cast<int>(&_binary_model_32bitlogo_colors_data_size),
|
||||||
|
.offset = offset::logo,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const int textures_length = (sizeof (textures)) / (sizeof (textures[0]));
|
||||||
|
|
||||||
|
static inline void transfer_ta_fifo_texture_memory_32byte(void * dst, void * src, int length)
|
||||||
|
{
|
||||||
|
uint32_t out_addr = (uint32_t)dst;
|
||||||
|
sh7091.CCN.QACR0 = ((reinterpret_cast<uint32_t>(out_addr) >> 24) & 0b11100);
|
||||||
|
sh7091.CCN.QACR1 = ((reinterpret_cast<uint32_t>(out_addr) >> 24) & 0b11100);
|
||||||
|
|
||||||
|
volatile uint32_t * base = &store_queue[(out_addr & 0x03ffffe0) / 4];
|
||||||
|
uint32_t * src32 = reinterpret_cast<uint32_t *>(src);
|
||||||
|
|
||||||
|
length = (length + 31) & ~31; // round up to nearest multiple of 32
|
||||||
|
while (length > 0) {
|
||||||
|
base[0] = src32[0];
|
||||||
|
base[1] = src32[1];
|
||||||
|
base[2] = src32[2];
|
||||||
|
base[3] = src32[3];
|
||||||
|
base[4] = src32[4];
|
||||||
|
base[5] = src32[5];
|
||||||
|
base[6] = src32[6];
|
||||||
|
base[7] = src32[7];
|
||||||
|
asm volatile ("pref @%0"
|
||||||
|
: // output
|
||||||
|
: "r" (&base[0]) // input
|
||||||
|
: "memory");
|
||||||
|
length -= 32;
|
||||||
|
base += 8;
|
||||||
|
src32 += 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void transfer_texture_memory()
|
||||||
|
{
|
||||||
|
system.LMMODE0 = 0; // 64-bit address space
|
||||||
|
system.LMMODE1 = 0; // 64-bit address space
|
||||||
|
|
||||||
|
for (int i = 0; i < textures_length; i++) {
|
||||||
|
uint32_t offset = texture_memory_alloc.texture.start + textures[i].offset;
|
||||||
|
void * dst = reinterpret_cast<void *>(&ta_fifo_texture_memory[offset / 4]);
|
||||||
|
void * src = textures[i].start;
|
||||||
|
int size = textures[i].size;
|
||||||
|
transfer_ta_fifo_texture_memory_32byte(dst, src, size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
23
src/texture.hpp
Normal file
23
src/texture.hpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "font/tandy1k.data.h"
|
||||||
|
#include "model/32bitlogo/colors.data.h"
|
||||||
|
|
||||||
|
namespace texture {
|
||||||
|
struct texture {
|
||||||
|
void * start;
|
||||||
|
int size;
|
||||||
|
int offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace offset {
|
||||||
|
constexpr int tandy1k = 0;
|
||||||
|
constexpr int logo = 16384;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct texture textures[];
|
||||||
|
|
||||||
|
extern const int textures_length;
|
||||||
|
|
||||||
|
void transfer_texture_memory();
|
||||||
|
};
|
@ -2,7 +2,8 @@ XM_OBJ = \
|
|||||||
xm/milkypack01.xm.o
|
xm/milkypack01.xm.o
|
||||||
|
|
||||||
TEXTURE_OBJ = \
|
TEXTURE_OBJ = \
|
||||||
font/tandy1k.data.o
|
font/tandy1k.data.o \
|
||||||
|
model/32bitlogo/colors.data.o
|
||||||
|
|
||||||
XM_PLAYER_OBJ = \
|
XM_PLAYER_OBJ = \
|
||||||
$(LIB)/holly/core.o \
|
$(LIB)/holly/core.o \
|
||||||
@ -23,6 +24,7 @@ XM_PLAYER_OBJ = \
|
|||||||
src/xm.o \
|
src/xm.o \
|
||||||
src/malloc.o \
|
src/malloc.o \
|
||||||
src/framebuffer.o \
|
src/framebuffer.o \
|
||||||
|
src/texture.o \
|
||||||
src/graphics_primitive.o \
|
src/graphics_primitive.o \
|
||||||
src/scene/tracker/scene.o \
|
src/scene/tracker/scene.o \
|
||||||
src/scene/tracker/channel_status.o \
|
src/scene/tracker/channel_status.o \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user