Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
cd17050c
S
stb
项目概览
itdan3344
/
stb
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
stb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cd17050c
编写于
2月 22, 2015
作者:
S
Sean Barrett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
split render.c into cave_mesher.c and cave_render.c
上级
2770c921
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
1727 addition
and
13 deletion
+1727
-13
stb_voxel_render.h
stb_voxel_render.h
+9
-0
tests/caveview/cave_mesher.c
tests/caveview/cave_mesher.c
+724
-0
tests/caveview/cave_render.c
tests/caveview/cave_render.c
+924
-0
tests/caveview/caveview.dsp
tests/caveview/caveview.dsp
+17
-13
tests/caveview/caveview.h
tests/caveview/caveview.h
+48
-0
tests/caveview/main.c
tests/caveview/main.c
+5
-0
未找到文件。
stb_voxel_render.h
浏览文件 @
cd17050c
...
...
@@ -224,6 +224,8 @@
#ifndef INCLUDE_STB_VOXEL_RENDER_H
#define INCLUDE_STB_VOXEL_RENDER_H
#include <stdlib.h>
#ifdef STBVOX_BLOCKTYPE_SHORT
...
...
@@ -287,6 +289,13 @@ extern void stbvox_set_input_stride(stbvox_mesh_maker *mm, int x_stride_in_bytes
extern
void
stbvox_config_use_gl
(
stbvox_mesh_maker
*
mm
,
int
use_tex_buffer
,
int
use_gl_modelview
,
int
use_gl_fragment
);
extern
void
stbvox_config_set_z_precision
(
stbvox_mesh_maker
*
mm
,
int
z_fractional_bits
);
extern
stbvox_input_description
*
stbvox_get_input_description
(
stbvox_mesh_maker
*
mm
);
extern
int
stbvox_get_vertex_shader
(
stbvox_mesh_maker
*
mm
,
char
*
buffer
,
size_t
buffer_size
);
extern
int
stbvox_get_fragment_shader
(
stbvox_mesh_maker
*
mm
,
char
*
buffer
,
size_t
buffer_size
);
extern
void
stbvox_set_default_mesh
(
stbvox_mesh_maker
*
mm
,
int
mesh
);
extern
int
stbvox_get_quad_count
(
stbvox_mesh_maker
*
mm
,
int
mesh
);
extern
void
stbvox_get_transform
(
stbvox_mesh_maker
*
mm
,
float
transform
[
3
][
3
]);
extern
void
stbvox_get_bounds
(
stbvox_mesh_maker
*
mm
,
float
bounds
[
2
][
3
]);
extern
void
stbvox_set_mesh_coordinates
(
stbvox_mesh_maker
*
mm
,
int
x
,
int
y
,
int
z
);
// meshing API
...
...
tests/caveview/cave_mesher.c
0 → 100644
浏览文件 @
cd17050c
此差异已折叠。
点击以展开。
tests/caveview/render.c
→
tests/caveview/
cave_
render.c
浏览文件 @
cd17050c
此差异已折叠。
点击以展开。
tests/caveview/caveview.dsp
浏览文件 @
cd17050c
...
...
@@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib sdl2.lib opengl32.lib glu32.lib winmm.lib sdl2_mixer.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386
/out:"Release/caveview.exe"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib sdl2.lib opengl32.lib glu32.lib winmm.lib sdl2_mixer.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT LINK32 /map
!ELSEIF "$(CFG)" == "caveview - Win32 Debug"
...
...
@@ -91,6 +91,10 @@ LINK32=link.exe
# Name "caveview - Win32 Debug"
# Begin Source File
SOURCE=.\cave_mesher.c
# End Source File
# Begin Source File
SOURCE=.\cave_parse.c
# End Source File
# Begin Source File
...
...
@@ -99,6 +103,14 @@ SOURCE=.\cave_parse.h
# End Source File
# Begin Source File
SOURCE=.\cave_render.c
# End Source File
# Begin Source File
SOURCE=.\caveview.h
# End Source File
# Begin Source File
SOURCE=.\game.c
# End Source File
# Begin Source File
...
...
@@ -119,19 +131,15 @@ SOURCE=.\main.c
# End Source File
# Begin Source File
SOURCE=.\render.c
# End Source File
# Begin Source File
SOURCE=.\win32\SDL_windows_main.c
# End Source File
# Begin Source File
SOURCE=.\stb.h
SOURCE=.
.\..
\stb.h
# End Source File
# Begin Source File
SOURCE=.\stb_easy_font.h
SOURCE=.
.\..
\stb_easy_font.h
# End Source File
# Begin Source File
...
...
@@ -143,15 +151,11 @@ SOURCE=.\stb_glprog.h
# End Source File
# Begin Source File
SOURCE=.\stb_image.h
# End Source File
# Begin Source File
SOURCE=.\stb_image_write.h
SOURCE=..\..\stb_image.h
# End Source File
# Begin Source File
SOURCE=.\stb_voxel_render.h
SOURCE=.
.\..
\stb_voxel_render.h
# End Source File
# End Target
# End Project
tests/caveview/caveview.h
0 → 100644
浏览文件 @
cd17050c
#ifndef INCLUDE_CAVEVIEW_H
#define INCLUDE_CAVEVIEW_H
#include "stb.h"
#define STBVOX_ROTATION_IN_LIGHTING
#include "stb_voxel_render.h"
typedef
struct
{
int
cx
,
cy
;
stbvox_mesh_maker
mm
;
uint8
*
build_buffer
;
uint8
*
face_buffer
;
int
num_quads
;
float
transform
[
3
][
3
];
float
bounds
[
2
][
3
];
uint8
sv_blocktype
[
34
][
34
][
18
];
uint8
sv_lighting
[
34
][
34
][
18
];
}
raw_mesh
;
// a 3D checkerboard of empty,solid would be: 32x32x255x6/2 ~= 800000
// an all-leaf qchunk would be: 32 x 32 x 255 x 6 ~= 1,600,000
#define BUILD_QUAD_MAX 800000
#define BUILD_BUFFER_SIZE (4*4*BUILD_QUAD_MAX) // 4 bytes per vertex, 4 vertices per quad
#define FACE_BUFFER_SIZE ( 4*BUILD_QUAD_MAX) // 4 bytes per quad
extern
void
mesh_init
(
void
);
extern
void
render_init
(
void
);
extern
void
world_init
(
void
);
extern
void
ods
(
char
*
fmt
,
...);
// output debug string
extern
void
reset_cache_size
(
int
size
);
#include "cave_parse.h" // fast_chunk
extern
fast_chunk
*
get_converted_fastchunk
(
int
chunk_x
,
int
chunk_y
);
extern
void
build_chunk
(
int
chunk_x
,
int
chunk_y
,
fast_chunk
*
fc_table
[
4
][
4
],
raw_mesh
*
rm
);
extern
void
reset_cache_size
(
int
size
);
extern
void
deref_fastchunk
(
fast_chunk
*
fc
);
#endif
\ No newline at end of file
tests/caveview/main.c
浏览文件 @
cd17050c
...
...
@@ -20,6 +20,8 @@
#define STB_DEFINE
#include "stb.h"
#include "caveview.h"
#define SCALE 2
void
error
(
char
*
s
)
...
...
@@ -336,6 +338,9 @@ int SDL_main(int argc, char **argv)
SDL_GL_SetSwapInterval
(
0
);
// only when profiling
render_init
();
mesh_init
();
world_init
();
init_game
();
//editor_init();
initialized
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录