3D: texturas e materiais (albedo) nos 3 renderizadores
Fase 2 da API de 3D: agora dá para criar uma textura a partir de uma
imagem, juntar num material (com cor) e usar no objeto. O albedo é
amostrado no uv (bilinear, uv repetido) e a amostra chega ao shader com
o novo bloco "textura do pixel".
- 3D: "crie a textura %1 da imagem %2", "crie o material %1",
"no material %1 use a textura %2 como albedo" (e "como normal", já
guardado), "no material %1 use a cor %2" e "use o material %1 no
objeto %2". A textura converte a imagem para RGBA8 e mantém um cache
por nome; o material tem albedo + normal map + tint (a cor multiplica).
- Tb3dDraw ganhou albedo/normaltex; Tb3dTexture (id + version + RGBA).
- Shader: a assinatura tb_shade/tb_vert passou a ter vec3 tex, e o
bloco Shader.Texture ("textura do pixel") expõe o albedo à pilha.
- Software, OpenGL e Vulkan amostram o mesmo albedo (branco quando não
há textura); no Vulkan entram descriptor set para o sampler e um
staging buffer por textura. TB_3D_RENDERER_VERSION 5 -> 6.
- test-3d: novo caso de textura (imagem 2x2 vermelho/azul no quad);
os três renderizadores batem (diferença média 0.016).
- O editor passa a carregar PPM/BMP/PNG/Imagem por padrão (a 3D usa
imagens) e o link ganhou -lpng.
- Exemplo examples/jogo-3d/textura.sb (cubo com tijolo.png) e docs.
O normal map ainda não muda a iluminação: fica para a fase do relevo.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d5c16a5237
commit
0c4c107244
20 files changed
+664
-127
No files matched your search
@@ -57,16 +57,16 @@ void tb_android_boot(void); /* cwd, TINYBLOCKS_APPDIR, fonte e certificados (p
|
||||
entram no executavel e sao registradas aqui */
|
||||
# include <tb_base64.h>
|
||||
# include <tb_curves.h>
|
||||
# include <tb_ppm.h>
|
||||
# include <tb_bmp.h>
|
||||
# include <tb_png.h>
|
||||
# include <tb_imglib.h>
|
||||
# include <tb_vg.h>
|
||||
# include <tb_svg.h>
|
||||
# include <tb_regex.h>
|
||||
# include <tb_markdown.h>
|
||||
# include <tb_opentype.h>
|
||||
#endif
|
||||
#include <tb_ppm.h>
|
||||
#include <tb_bmp.h>
|
||||
#include <tb_png.h>
|
||||
#include <tb_imglib.h>
|
||||
|
||||
/* Registra uma library de categoria: se existir o .so dela no disco, carrega
|
||||
* por ali (assim "make libs" + hot reload recarrega a lista de blocos na
|
||||
@@ -115,6 +115,10 @@ int main(int argc, char** argv) {
|
||||
reg_core(rt, "tinyblocks-variables", tb_variables_get_library);
|
||||
reg_core(rt, "tinyblocks-vector", tb_vector_get_library);
|
||||
reg_core(rt, "tinyblocks-appearance", tb_appearance_get_library);
|
||||
reg_core(rt, "tinyblocks-ppm", tb_ppm_get_library);
|
||||
reg_core(rt, "tinyblocks-bmp", tb_bmp_get_library);
|
||||
reg_core(rt, "tinyblocks-png", tb_png_get_library);
|
||||
reg_core(rt, "tinyblocks-image", tb_imglib_get_library);
|
||||
reg_core(rt, "tinyblocks-pen", tb_pen_get_library);
|
||||
reg_core(rt, "tinyblocks-fs", tb_fs_get_library);
|
||||
reg_core(rt, "tinyblocks-os", tb_os_get_library);
|
||||
@@ -136,7 +140,6 @@ int main(int argc, char** argv) {
|
||||
#ifdef TB_STATIC_EXTRAS
|
||||
{
|
||||
const TinyBlocks_LibraryDescriptor* (*extras[])(void) = {
|
||||
tb_ppm_get_library, tb_bmp_get_library, tb_png_get_library, tb_imglib_get_library,
|
||||
tb_base64_get_library, tb_curves_get_library, tb_vg_get_library, tb_svg_get_library,
|
||||
tb_regex_get_library, tb_markdown_get_library, tb_opentype_get_library };
|
||||
for (size_t i = 0; i < sizeof(extras) / sizeof(extras[0]); i++) tb_library_register(rt, extras[i]());
|
||||
|
||||
Reference in new issue
Block a user