Skip to content

Commit

Permalink
Bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tyanyuy3125 committed Jun 6, 2019
1 parent 9f20d65 commit 8ae7060
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Eric's MagicaVoxel Shaders
Shaders for MagicaVoxel including Terrain Generator, Advanced Flood System etc.

**IMPORTANT** The bugs related to the executing failure have been all fixed. Feel free to have a try if you came across the problems before.

## Internationalization
- <a href="./i18n/README-sc.md">简体中文</a> - translated by <a href="http://github.com/codingeric">CodingEric</a>, target version: `0.0.9.0`
- <a href="./i18n/README-sc.md">简体中文</a> - translated by <a href="http://github.com/codingeric">CodingEric</a>, target version: `0.1.0.0`
- <a href="./i18n/README-fr.md">Français</a> - translated by <a href="http://moiscript.weebly.com/magicavoxel.html">Pilou</a> - Authorized reproduce, target version: `0.0.7.0`

## Project Info
* Current version: `0.0.9.9`
* Current version: `0.1.0.0`
* State: `LTS`
* Tested with `MagicaVoxel 0.99.3 for Windows`
* Released under `MIT License`
Expand All @@ -26,6 +28,9 @@ Copy the .txt files from the `shader` directory in this project to the `shader`
| 0.99.2 || |
| 0.99.3 || |

## Contribution
Feel free to make a PR as long as you've followed the contributing guidelines.

## Shaders and usages
>**Note** <br> - The parameters with `<>` can be ignored. Mostly, they are set to 0 as default. <br> - The shaders are not designed for selected areas without specific explanation. <br> - The documentation of deprecated/unstable shaders can be found in their folders.
### INDEX
Expand Down Expand Up @@ -68,7 +73,7 @@ Copy the .txt files from the `shader` directory in this project to the `shader`
<img src="img/tg2_2.png" width="250px"><img src="img/tg2_1.png" width="250px">
### CAVE
<a href="#index">back to index</a>
>1. The 3d noise generator.
>1. This is the 3d noise generator.
>2. The noise generation method is provided by ashima/webgl-noise: Copyright (C) 2011 Ashima Arts. All rights reserved.
* File name: `cave.txt`
* Command-line usage: `xs cave [seed] [noise-scale] [voxel-color] [void-voxel-color (-1 for not emptying the scene)] [vertical-shifting] [x-shifting] [y-shifting]`
Expand Down
3 changes: 0 additions & 3 deletions i18n/README-fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ Installez ces shaders en copiant les fichiers du répertoire shader de ce projet
* <a href="#flow2">Flow2</a>
* <a href="#project">Project</a>
* <a href="#life-game">Life game</a>
* <a href="#blanket">Blanket</a>
* <a href="#cube-filling">Cube filling</a>
* <a href="#flood">Flood</a>
* <a href="#hyperflood">[Unstable] Hyperflood</a>
* <a href="#darker">[Deprecated] Darker Darker</a>
### TERRAIN GENERATOR
<a href="#catalogue">Retour au catalogue</a>
* Nom de fichier: `tergen.txt`
Expand Down
19 changes: 16 additions & 3 deletions i18n/README-sc.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
为MagicaVoxel设计的Shader,包含地形生成器,增强的洪流系统等。

## 项目信息
* 当前版本: `0.0.9.0`
* 当前版本: `0.1.0.0`
* 状态: `长期支持`
* 使用 `MagicaVoxel 0.99.3 for Windows` 测试
*`MIT License` 下发行
Expand All @@ -31,6 +31,7 @@
### <p id="index">目录</p>
* <a href="#terrain-generator">Terrain generator</a>
* <a href="#terrain-generator-2">Terrain generator 2</a>
* <a href="#cave">Cave</a>
* <a href="#flow">Flow</a>
* <a href="#flow2">Flow2</a>
* <a href="#project">Project</a>
Expand All @@ -40,7 +41,7 @@
### TERRAIN GENERATOR
<a href="#index">回到目录</a>
>1. 更旧的版本由于不支持一些古老的GLSL版本已经被舍弃,十分感谢bug提交者的贡献。
>2. 噪波生成提供方为 ashima/webgl-noise: Copyright (C) 2011 Ashima Arts 保留所有权利
>2. 噪波生成提供方为 ashima/webgl-noise: Copyright (C) 2011 Ashima Arts 保留所有权利
* 文件名称: `tergen.txt`
* 命令行用法: `xs tergen [seed] [altitude]
[noise-scale] [voxel-color] <void-voxel-color> <vertical-shifting> <x-shifting> <y-shifting>`
Expand All @@ -55,7 +56,7 @@
### TERRAIN GENERATOR 2
<a href="#index">回到目录</a>
>1. 在地形生成器2中,地形覆盖在已存在的体素上。
>2. 噪波生成提供方为 ashima/webgl-noise: Copyright (C) 2011 Ashima Arts 保留所有权利
>2. 噪波生成提供方为 ashima/webgl-noise: Copyright (C) 2011 Ashima Arts 保留所有权利
* 文件名称: `tergen2.txt`
* 命令行用法: `xs tergen2 [seed] [altitude]
[noise-scale] [voxel-color] <void-voxel-color> <vertical-shifting> <x-shifting> <y-shifting>`
Expand All @@ -65,6 +66,18 @@
* 图片预览:

<img src="../img/tg2_2.png" width="250px"><img src="../img/tg2_1.png" width="250px">
### CAVE
<a href="#index">回到目录</a>
>1. 这是三维噪波生成器。
>2. 噪波生成提供方为 ashima/webgl-noise: Copyright (C) 2011 Ashima Arts 保留所有权利。
* 文件名称: `cave.txt`
* 命令行用法: `xs cave [seed] [noise-scale] [voxel-color] <void-voxel-color (-1 for not emptying the scene)> <vertical-shifting> <x-shifting> <y-shifting>`
* 命令行用法示例: `xs cave 19260817 75 1 -1 10 10 10`
* 命令行用法最简示例: `xs cave 19260817 75 1 -1`
>把 void-voxel-color 设置为 -1 将不会清空场景。
* 图片预览:

<img width="250px" src="../img/cave.png">
### FLOW
<a href="#index">回到目录</a>
> 该shader模拟自然界中的水流效果。
Expand Down
12 changes: 6 additions & 6 deletions shader/cubefill.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ MIT License

float map(vec3 v){
if(iArgs[6]!=0.){
if(iArgs[0]==0&&((v.x>=iArgs[1]&&v.x<=iArgs[4]||v.x>=iArgs[4]&&v.x<=iArgs[1])&&(v.y>=iArgs[2]&&v.y<=iArgs[5]||v.y>=iArgs[5]&&v.y<=iArgs[2])&&(v.z>=iArgs[3]&&v.z<=iArgs[6]||v.z>=iArgs[6]&&v.z<=iArgs[3]))){
if(iArgs[0]==0.&&((v.x>=iArgs[1]&&v.x<=iArgs[4]||v.x>=iArgs[4]&&v.x<=iArgs[1])&&(v.y>=iArgs[2]&&v.y<=iArgs[5]||v.y>=iArgs[5]&&v.y<=iArgs[2])&&(v.z>=iArgs[3]&&v.z<=iArgs[6]||v.z>=iArgs[6]&&v.z<=iArgs[3]))){
return iArgs[7];
}
else if(iArgs[0]==1&&(((v.x==iArgs[1]||v.x==iArgs[4])&&(v.y==iArgs[5]||v.y==iArgs[2])&&(v.z<=iArgs[6]&&v.z>=iArgs[3]||v.z<=iArgs[3]&&v.z>=iArgs[6]))||((v.z==iArgs[3]||v.z==iArgs[6])&&(v.y==iArgs[5]||v.y==iArgs[2])&&(v.x<=iArgs[4]&&v.x>=iArgs[1]||v.x<=iArgs[1]&&v.x>=iArgs[4]))||((v.z==iArgs[3]||v.z==iArgs[6])&&(v.x==iArgs[4]||v.x==iArgs[1])&&(v.y<=iArgs[5]&&v.y>=iArgs[2]||v.y<=iArgs[2]&&v.y>=iArgs[5])))){
else if(iArgs[0]==1.&&(((v.x==iArgs[1]||v.x==iArgs[4])&&(v.y==iArgs[5]||v.y==iArgs[2])&&(v.z<=iArgs[6]&&v.z>=iArgs[3]||v.z<=iArgs[3]&&v.z>=iArgs[6]))||((v.z==iArgs[3]||v.z==iArgs[6])&&(v.y==iArgs[5]||v.y==iArgs[2])&&(v.x<=iArgs[4]&&v.x>=iArgs[1]||v.x<=iArgs[1]&&v.x>=iArgs[4]))||((v.z==iArgs[3]||v.z==iArgs[6])&&(v.x==iArgs[4]||v.x==iArgs[1])&&(v.y<=iArgs[5]&&v.y>=iArgs[2]||v.y<=iArgs[2]&&v.y>=iArgs[5])))){
return iArgs[7];
}
else{
Expand All @@ -30,7 +30,7 @@ float map(vec3 v){
float cte1=-1.;
float a3=iArgs[4];
float p1X,p1Y,p1Z,p2X,p2Y,p2Z;
if(int(a3)&1){
if(floor(a3/2.)*2.!=a3){
cte=(a3-1.)/2.;
cte1+=a3-cte;
p1X=iArgs[1]-cte;
Expand All @@ -42,18 +42,18 @@ float map(vec3 v){
}
else{
cte=a3/2.;
cte1+=a3/2;
cte1+=a3/2.;
p1X=iArgs[1]-cte;
p1Y=iArgs[2]-cte;
p1Z=iArgs[3]-cte;
p2X=iArgs[1]+cte1;
p2Y=iArgs[2]+cte1;
p2Z=iArgs[3]+cte1;
}
if(iArgs[0]==0&&((v.x>=p1X&&v.x<=p2X||v.x>=p2X&&v.x<=p1X)&&(v.y>=p1Y&&v.y<=p2Y||v.y>=p2Y&&v.y<=p1Y)&&(v.z>=p1Z&&v.z<=p2Z||v.z>=p2Z&&v.z<=p1Z))){
if(iArgs[0]==0.&&((v.x>=p1X&&v.x<=p2X||v.x>=p2X&&v.x<=p1X)&&(v.y>=p1Y&&v.y<=p2Y||v.y>=p2Y&&v.y<=p1Y)&&(v.z>=p1Z&&v.z<=p2Z||v.z>=p2Z&&v.z<=p1Z))){
return iArgs[5];
}
else if(iArgs[0]==1&&(((v.x==p1X||v.x==p2X)&&(v.y==p2Y||v.y==p1Y)&&(v.z<=p2Z&&v.z>=p1Z||v.z<=p1Z&&v.z>=p2Z))||((v.z==p1Z||v.z==p2Z)&&(v.y==p2Y||v.y==p1Y)&&(v.x<=p2X&&v.x>=p1X||v.x<=p1X&&v.x>=p2X))||((v.z==p1Z||v.z==p2Z)&&(v.x==p2X||v.x==p1X)&&(v.y<=p2Y&&v.y>=p1Y||v.y<=p1Y&&v.y>=p2Y)))){
else if(iArgs[0]==1.&&(((v.x==p1X||v.x==p2X)&&(v.y==p2Y||v.y==p1Y)&&(v.z<=p2Z&&v.z>=p1Z||v.z<=p1Z&&v.z>=p2Z))||((v.z==p1Z||v.z==p2Z)&&(v.y==p2Y||v.y==p1Y)&&(v.x<=p2X&&v.x>=p1X||v.x<=p1X&&v.x>=p2X))||((v.z==p1Z||v.z==p2Z)&&(v.x==p2X||v.x==p1X)&&(v.y<=p2Y&&v.y>=p1Y||v.y<=p1Y&&v.y>=p2Y)))){
return iArgs[5];
}
else{
Expand Down

0 comments on commit 8ae7060

Please sign in to comment.