This commit is contained in:
parent
f74225843d
commit
bd9f57fe3d
@ -198,6 +198,12 @@
|
|||||||
"rarity" : 0.8,
|
"rarity" : 0.8,
|
||||||
"minQuantity" : 0,
|
"minQuantity" : 0,
|
||||||
"maxQuantity" : 2
|
"maxQuantity" : 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"itemId" : "block:wood",
|
||||||
|
"rarity" : 0.8,
|
||||||
|
"minQuantity" : 0,
|
||||||
|
"maxQuantity" : 5
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,22 @@
|
|||||||
"id" : 3,
|
"id" : 3,
|
||||||
"name" : "brick_fant",
|
"name" : "brick_fant",
|
||||||
"texture" : "/Textures/block/ruin_wall_01.png"
|
"texture" : "/Textures/block/ruin_wall_01.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : 4,
|
||||||
|
"name" : "roof_1",
|
||||||
|
"texture" : "/Textures/block/roof1.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : 5,
|
||||||
|
"name" : "refined_wood",
|
||||||
|
"texture" : "/Textures/block/woodfiber.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : 6,
|
||||||
|
"name" : "glass",
|
||||||
|
"texture" : "/Textures/block/glass1.png",
|
||||||
|
"transparent" : true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ out vec4 FragColor;
|
|||||||
|
|
||||||
|
|
||||||
// function prototypes
|
// function prototypes
|
||||||
vec3 getColor(vec2 uv, vec3 normal, int samplerIndexVec, Material material);
|
vec4 getColor(vec2 uv, vec3 normal, int samplerIndexVec, Material material);
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
vec3 norm = normalize(Normal);
|
vec3 norm = normalize(Normal);
|
||||||
@ -49,7 +49,7 @@ void main(){
|
|||||||
vec3 lightIntensity = vec3(calcLightIntensityTotal(norm));
|
vec3 lightIntensity = vec3(calcLightIntensityTotal(norm));
|
||||||
|
|
||||||
//get color of base texture
|
//get color of base texture
|
||||||
vec3 textureColor = getColor(uv, norm, samplerIndexVec, material);
|
vec4 textureColor = getColor(uv, norm, samplerIndexVec, material);
|
||||||
|
|
||||||
//shadow
|
//shadow
|
||||||
float shadow = ShadowCalculation(FragPosLightSpace, normalize(-directLight.direction), -norm);
|
float shadow = ShadowCalculation(FragPosLightSpace, normalize(-directLight.direction), -norm);
|
||||||
@ -70,10 +70,10 @@ void main(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//calculate final color
|
//calculate final color
|
||||||
vec3 finalColor = textureColor * lightIntensity * max(shadow,0.4);
|
vec3 finalColor = textureColor.rgb * lightIntensity * max(shadow,0.4);
|
||||||
|
|
||||||
//this final calculation is for transparency
|
//this final calculation is for transparency
|
||||||
FragColor = vec4(finalColor, 1);
|
FragColor = vec4(finalColor, textureColor.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ void main(){
|
|||||||
* The function that gets the texture color based on the triplanar texture mapping and the voxel type at each point along the vert.
|
* The function that gets the texture color based on the triplanar texture mapping and the voxel type at each point along the vert.
|
||||||
* See the triplanar mapping wiki article for an explanation of math involved.
|
* See the triplanar mapping wiki article for an explanation of math involved.
|
||||||
*/
|
*/
|
||||||
vec3 getColor(vec2 uv, vec3 normal, int samplerIndexVec, Material material){
|
vec4 getColor(vec2 uv, vec3 normal, int samplerIndexVec, Material material){
|
||||||
|
|
||||||
//the uv of the texture clamped within the atlas
|
//the uv of the texture clamped within the atlas
|
||||||
vec2 actualUv = vec2(
|
vec2 actualUv = vec2(
|
||||||
@ -89,7 +89,7 @@ vec3 getColor(vec2 uv, vec3 normal, int samplerIndexVec, Material material){
|
|||||||
(fract(uv.y) * ATLAS_NORMALIZED_ELEMENT_WIDTH) + (round(samplerIndexVec / ATLAS_EL_PER_ROW) * ATLAS_NORMALIZED_ELEMENT_WIDTH_FULL)
|
(fract(uv.y) * ATLAS_NORMALIZED_ELEMENT_WIDTH) + (round(samplerIndexVec / ATLAS_EL_PER_ROW) * ATLAS_NORMALIZED_ELEMENT_WIDTH_FULL)
|
||||||
);
|
);
|
||||||
//albedo for the X texture
|
//albedo for the X texture
|
||||||
vec3 color = texture(material.diffuse, actualUv).rgb;
|
vec4 color = texture(material.diffuse, actualUv);
|
||||||
|
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ out vec4 FragColor;
|
|||||||
|
|
||||||
|
|
||||||
// function prototypes
|
// function prototypes
|
||||||
vec3 getColor(vec2 uv, vec3 normal, int blockIndex, Material material);
|
vec4 getColor(vec2 uv, vec3 normal, int blockIndex, Material material);
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
vec3 norm = normalize(Normal);
|
vec3 norm = normalize(Normal);
|
||||||
@ -49,7 +49,7 @@ void main(){
|
|||||||
vec3 lightIntensity = vec3(calcLightIntensityTotal(norm));
|
vec3 lightIntensity = vec3(calcLightIntensityTotal(norm));
|
||||||
|
|
||||||
//get color of base texture
|
//get color of base texture
|
||||||
vec3 textureColor = getColor(uv, norm, blockAtlasIndex, material);
|
vec4 textureColor = getColor(uv, norm, blockAtlasIndex, material);
|
||||||
|
|
||||||
//shadow
|
//shadow
|
||||||
float shadow = ShadowCalculation(FragPosLightSpace, normalize(-directLight.direction), -norm);
|
float shadow = ShadowCalculation(FragPosLightSpace, normalize(-directLight.direction), -norm);
|
||||||
@ -70,10 +70,10 @@ void main(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//calculate final color
|
//calculate final color
|
||||||
vec3 finalColor = textureColor * lightIntensity * max(shadow,0.4);
|
vec3 finalColor = textureColor.rgb * lightIntensity * max(shadow,0.4);
|
||||||
|
|
||||||
//this final calculation is for transparency
|
//this final calculation is for transparency
|
||||||
FragColor = vec4(finalColor, 1);
|
FragColor = vec4(finalColor, textureColor.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ void main(){
|
|||||||
* The function that gets the texture color based on the triplanar texture mapping and the voxel type at each point along the vert.
|
* The function that gets the texture color based on the triplanar texture mapping and the voxel type at each point along the vert.
|
||||||
* See the triplanar mapping wiki article for an explanation of math involved.
|
* See the triplanar mapping wiki article for an explanation of math involved.
|
||||||
*/
|
*/
|
||||||
vec3 getColor(vec2 uv, vec3 normal, int blockIndex, Material material){
|
vec4 getColor(vec2 uv, vec3 normal, int blockIndex, Material material){
|
||||||
|
|
||||||
//the uv of the texture clamped within the atlas
|
//the uv of the texture clamped within the atlas
|
||||||
vec2 actualUv = vec2(
|
vec2 actualUv = vec2(
|
||||||
@ -89,7 +89,7 @@ vec3 getColor(vec2 uv, vec3 normal, int blockIndex, Material material){
|
|||||||
(fract(uv.y) * ATLAS_NORMALIZED_ELEMENT_WIDTH) + (round(blockIndex / ATLAS_EL_PER_ROW) * ATLAS_NORMALIZED_ELEMENT_WIDTH_FULL)
|
(fract(uv.y) * ATLAS_NORMALIZED_ELEMENT_WIDTH) + (round(blockIndex / ATLAS_EL_PER_ROW) * ATLAS_NORMALIZED_ELEMENT_WIDTH_FULL)
|
||||||
);
|
);
|
||||||
//albedo for the X texture
|
//albedo for the X texture
|
||||||
vec3 color = texture(material.diffuse, actualUv).rgb;
|
vec4 color = texture(material.diffuse, actualUv);
|
||||||
|
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
|
|||||||
BIN
assets/Textures/block/glass1.png
Normal file
BIN
assets/Textures/block/glass1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 200 KiB |
BIN
assets/Textures/block/roof1.png
Normal file
BIN
assets/Textures/block/roof1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
BIN
assets/Textures/block/woodfiber.png
Normal file
BIN
assets/Textures/block/woodfiber.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@ -1,3 +1,3 @@
|
|||||||
#maven.buildNumber.plugin properties file
|
#maven.buildNumber.plugin properties file
|
||||||
#Sat Apr 26 21:15:56 EDT 2025
|
#Sat Apr 26 22:05:31 EDT 2025
|
||||||
buildNumber=622
|
buildNumber=623
|
||||||
|
|||||||
@ -1561,6 +1561,9 @@ Toolbar preview ui element
|
|||||||
Fab tool can place fabs
|
Fab tool can place fabs
|
||||||
Fix block items not having texture
|
Fix block items not having texture
|
||||||
Disable failing ui tests
|
Disable failing ui tests
|
||||||
|
Pine trees drop wood blocks
|
||||||
|
More block types
|
||||||
|
Transparent blocks
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,13 +4,27 @@ package electrosphere.game.data.block;
|
|||||||
* Data about a particular type of block
|
* Data about a particular type of block
|
||||||
*/
|
*/
|
||||||
public class BlockType {
|
public class BlockType {
|
||||||
//the id of this block type
|
|
||||||
|
/**
|
||||||
|
* the id of this block type
|
||||||
|
*/
|
||||||
int id;
|
int id;
|
||||||
//the name of the type
|
|
||||||
|
/**
|
||||||
|
* the name of the type
|
||||||
|
*/
|
||||||
String name;
|
String name;
|
||||||
//the texture for the block type
|
|
||||||
|
/**
|
||||||
|
* the texture for the block type
|
||||||
|
*/
|
||||||
String texture;
|
String texture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tracks whether this block type is transparent or not
|
||||||
|
*/
|
||||||
|
Boolean transparent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the id of the block type
|
* Gets the id of the block type
|
||||||
* @return The id
|
* @return The id
|
||||||
@ -34,4 +48,12 @@ public class BlockType {
|
|||||||
public String getTexture(){
|
public String getTexture(){
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether this block type is transparent or not
|
||||||
|
* @return true if it is transparent, false otherwise
|
||||||
|
*/
|
||||||
|
public Boolean isTransparent(){
|
||||||
|
return transparent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user