diff --git a/assets/Data/entity/foliage/trees.json b/assets/Data/entity/foliage/trees.json index 75dfeb7e..a759e8f5 100644 --- a/assets/Data/entity/foliage/trees.json +++ b/assets/Data/entity/foliage/trees.json @@ -198,6 +198,12 @@ "rarity" : 0.8, "minQuantity" : 0, "maxQuantity" : 2 + }, + { + "itemId" : "block:wood", + "rarity" : 0.8, + "minQuantity" : 0, + "maxQuantity" : 5 } ] } diff --git a/assets/Data/game/blockTypes.json b/assets/Data/game/blockTypes.json index f17be9ac..4e0401e1 100644 --- a/assets/Data/game/blockTypes.json +++ b/assets/Data/game/blockTypes.json @@ -18,6 +18,22 @@ "id" : 3, "name" : "brick_fant", "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 } ] } \ No newline at end of file diff --git a/assets/Shaders/entities/block/block.fs b/assets/Shaders/entities/block/block.fs index 70db1fb0..ef80d9f3 100644 --- a/assets/Shaders/entities/block/block.fs +++ b/assets/Shaders/entities/block/block.fs @@ -39,7 +39,7 @@ out vec4 FragColor; // function prototypes -vec3 getColor(vec2 uv, vec3 normal, int samplerIndexVec, Material material); +vec4 getColor(vec2 uv, vec3 normal, int samplerIndexVec, Material material); void main(){ vec3 norm = normalize(Normal); @@ -49,7 +49,7 @@ void main(){ vec3 lightIntensity = vec3(calcLightIntensityTotal(norm)); //get color of base texture - vec3 textureColor = getColor(uv, norm, samplerIndexVec, material); + vec4 textureColor = getColor(uv, norm, samplerIndexVec, material); //shadow float shadow = ShadowCalculation(FragPosLightSpace, normalize(-directLight.direction), -norm); @@ -70,10 +70,10 @@ void main(){ } //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 - 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. * 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 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) ); //albedo for the X texture - vec3 color = texture(material.diffuse, actualUv).rgb; + vec4 color = texture(material.diffuse, actualUv); return color; diff --git a/assets/Shaders/entities/blocksingle/block.fs b/assets/Shaders/entities/blocksingle/block.fs index 9906fadb..5f20e658 100644 --- a/assets/Shaders/entities/blocksingle/block.fs +++ b/assets/Shaders/entities/blocksingle/block.fs @@ -39,7 +39,7 @@ out vec4 FragColor; // function prototypes -vec3 getColor(vec2 uv, vec3 normal, int blockIndex, Material material); +vec4 getColor(vec2 uv, vec3 normal, int blockIndex, Material material); void main(){ vec3 norm = normalize(Normal); @@ -49,7 +49,7 @@ void main(){ vec3 lightIntensity = vec3(calcLightIntensityTotal(norm)); //get color of base texture - vec3 textureColor = getColor(uv, norm, blockAtlasIndex, material); + vec4 textureColor = getColor(uv, norm, blockAtlasIndex, material); //shadow float shadow = ShadowCalculation(FragPosLightSpace, normalize(-directLight.direction), -norm); @@ -70,10 +70,10 @@ void main(){ } //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 - 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. * 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 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) ); //albedo for the X texture - vec3 color = texture(material.diffuse, actualUv).rgb; + vec4 color = texture(material.diffuse, actualUv); return color; diff --git a/assets/Textures/block/glass1.png b/assets/Textures/block/glass1.png new file mode 100644 index 00000000..f1476c28 Binary files /dev/null and b/assets/Textures/block/glass1.png differ diff --git a/assets/Textures/block/roof1.png b/assets/Textures/block/roof1.png new file mode 100644 index 00000000..2dc2b3ca Binary files /dev/null and b/assets/Textures/block/roof1.png differ diff --git a/assets/Textures/block/woodfiber.png b/assets/Textures/block/woodfiber.png new file mode 100644 index 00000000..ce4cffb3 Binary files /dev/null and b/assets/Textures/block/woodfiber.png differ diff --git a/buildNumber.properties b/buildNumber.properties index f4c898cd..b0d02ea2 100644 --- a/buildNumber.properties +++ b/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Sat Apr 26 21:15:56 EDT 2025 -buildNumber=622 +#Sat Apr 26 22:05:31 EDT 2025 +buildNumber=623 diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 9a87e8a6..2147e593 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1561,6 +1561,9 @@ Toolbar preview ui element Fab tool can place fabs Fix block items not having texture Disable failing ui tests +Pine trees drop wood blocks +More block types +Transparent blocks diff --git a/src/main/java/electrosphere/game/data/block/BlockType.java b/src/main/java/electrosphere/game/data/block/BlockType.java index 8755d8c8..8a64adc3 100644 --- a/src/main/java/electrosphere/game/data/block/BlockType.java +++ b/src/main/java/electrosphere/game/data/block/BlockType.java @@ -4,13 +4,27 @@ package electrosphere.game.data.block; * Data about a particular type of block */ public class BlockType { - //the id of this block type + + /** + * the id of this block type + */ int id; - //the name of the type + + /** + * the name of the type + */ String name; - //the texture for the block type + + /** + * the texture for the block type + */ String texture; + /** + * Tracks whether this block type is transparent or not + */ + Boolean transparent; + /** * Gets the id of the block type * @return The id @@ -34,4 +48,12 @@ public class BlockType { public String getTexture(){ return texture; } + + /** + * Checks whether this block type is transparent or not + * @return true if it is transparent, false otherwise + */ + public Boolean isTransparent(){ + return transparent; + } }