Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
92de5ecb
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,发现更多精彩内容 >>
提交
92de5ecb
编写于
4月 01, 2015
作者:
S
Sean Barrett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
youtube link
上级
3bb82957
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
35 deletion
+37
-35
stb_voxel_render.h
stb_voxel_render.h
+37
-35
未找到文件。
stb_voxel_render.h
浏览文件 @
92de5ecb
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
// in this case, one with blocks that can have textures and that
// in this case, one with blocks that can have textures and that
// can also be a few shapes other than cubes.
// can also be a few shapes other than cubes.
//
//
// Video introduction: https://www.youtube.com/watch?v=2vnTtiLrV1w
//
// It works by creating triangle meshes. The library includes
// It works by creating triangle meshes. The library includes
//
//
// - converter from dense 3D arrays of block info to vertex mesh
// - converter from dense 3D arrays of block info to vertex mesh
...
@@ -31,48 +33,48 @@
...
@@ -31,48 +33,48 @@
//
//
// FEATURES
// FEATURES
//
//
//
- you can choose textured blocks with the features below,
// - you can choose textured blocks with the features below,
//
or colored voxels with 2^24 colors and no textures.
// or colored voxels with 2^24 colors and no textures.
//
//
//
- voxels are mostly just cubes, but there's support for
// - voxels are mostly just cubes, but there's support for
//
half-height cubes and diagonal slopes, half-height
// half-height cubes and diagonal slopes, half-height
//
diagonals, and even odder shapes especially for doing
// diagonals, and even odder shapes especially for doing
//
more-continuous "ground".
// more-continuous "ground".
//
//
//
- texture coordinates are projections along one of the major
// - texture coordinates are projections along one of the major
//
axes, with the per-texture scaling.
// axes, with the per-texture scaling.
//
//
//
- a number of aspects of the shader and the vertex format
// - a number of aspects of the shader and the vertex format
//
are configurable; the library generally takes care of
// are configurable; the library generally takes care of
//
coordinating the vertex format with the mesh for you.
// coordinating the vertex format with the mesh for you.
//
//
//
//
// FEATURES (SHADER PERSPECTIVE)
// FEATURES (SHADER PERSPECTIVE)
//
//
//
- vertices aligned on integer lattice, z on multiples of 0.5
// - vertices aligned on integer lattice, z on multiples of 0.5
//
- per-vertex "lighting" or "ambient occlusion" value (6 bits)
// - per-vertex "lighting" or "ambient occlusion" value (6 bits)
//
- per-vertex texture crossfade (3 bits)
// - per-vertex texture crossfade (3 bits)
//
//
//
- per-face texture #1 id (8-bit index into array texture)
// - per-face texture #1 id (8-bit index into array texture)
//
- per-face texture #2 id (8-bit index into second array texture)
// - per-face texture #2 id (8-bit index into second array texture)
//
- per-face color (6-bit palette index, 2 bits of per-texture boolean enable)
// - per-face color (6-bit palette index, 2 bits of per-texture boolean enable)
//
- per-face 5-bit normal for lighting calculations & texture coord computation
// - per-face 5-bit normal for lighting calculations & texture coord computation
//
- per-face 2-bit texture matrix rotation to rotate faces
// - per-face 2-bit texture matrix rotation to rotate faces
//
//
//
- indexed-by-texture-id scale factor (separate for texture #1 and texture #2)
// - indexed-by-texture-id scale factor (separate for texture #1 and texture #2)
//
- indexed-by-texture-#2-id blend mode (alpha composite or modulate/multiply);
// - indexed-by-texture-#2-id blend mode (alpha composite or modulate/multiply);
//
the first is good for decals, the second for detail textures, "light maps",
// the first is good for decals, the second for detail textures, "light maps",
//
etc; both modes are controlled by texture #2's alpha, scaled by the
// etc; both modes are controlled by texture #2's alpha, scaled by the
//
per-vertex texture crossfade and the per-face color (if enabled on texture #2)
// per-vertex texture crossfade and the per-face color (if enabled on texture #2)
//
//
//
- ambient lighting: half-lambert directional plus constant, all scaled by vertex ao
// - ambient lighting: half-lambert directional plus constant, all scaled by vertex ao
//
- face can be fullbright (emissive), controlled by per-face color
// - face can be fullbright (emissive), controlled by per-face color
//
- installable lighting, with default single-point-light
// - installable lighting, with default single-point-light
//
- installable fog, with default hacked smoothstep
// - installable fog, with default hacked smoothstep
//
//
//
Note that all the variations of lighting selection and texture
// Note that all the variations of lighting selection and texture
//
blending are run-time conditions in the shader, so they can be
// blending are run-time conditions in the shader, so they can be
//
intermixed in a single mesh.
// intermixed in a single mesh.
//
//
//
//
// INTEGRATION ARC
// INTEGRATION ARC
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录