Skip to content

Commit

Permalink
Alternate variation, bundle entries
Browse files Browse the repository at this point in the history
  • Loading branch information
GlennFolker committed Mar 21, 2024
1 parent 67d7f3e commit d242866
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 91 deletions.
18 changes: 18 additions & 0 deletions assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
confictura = Confictura

block.confictura-ludellyte.name = Ludellyte
block.confictura-eroded-slate.name = Eroded Slate
block.confictura-infused-eroded-slate.name = Infused Eroded Slate
block.confictura-archaic-eroded-slate.name = Archaic Eroded Slate
block.confictura-eroded-eneraphyte-vent.name = Eroded Eneraphyte Vent
block.confictura-eroded-slate-wall.name = Eroded Slate Wall
block.confictura-infused-eroded-slate-wall.name = Infused Eroded Slate Wall
block.confictura-archaic-eroded-slate-wall.name = Archaic Eroded Slate Wall
block.confictura-sharp-slate.name = Sharp Slate
block.confictura-infused-sharp-slate.name = Infused Sharp Slate
block.confictura-archaic-sharp-slate.name = Archaic Sharp Slate
block.confictura-eneraphyte-vent.name = Eneraphyte Vent
block.confictura-sharp-slate-wall.name = Sharp Slate Wall
block.confictura-infused-sharp-slate-wall.name = Infused Sharp Slate Wall
block.confictura-archaic-sharp-slate-wall.name = Archaic Sharp Slate Wall
block.confictura-eroded-spire.name = Eroded Slate Spire
block.confictura-sharp-spire.name = Slate Spire

planet.confictura-portal.name = Portal
planet.confictura-portal.description =

Expand Down
Binary file modified assets/maps/confictura-test.msav
Binary file not shown.
Binary file modified assets/scenes/confictura/spires.bin
Binary file not shown.
104 changes: 79 additions & 25 deletions assets/scenes/confictura/spires.gltf
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,88 @@
{
"name":"Scene",
"nodes":[
0
0,
1
]
}
],
"nodes":[
{
"mesh":0,
"name":"Spire"
"name":"SpireSmall1"
},
{
"mesh":1,
"name":"SpireSmall2",
"translation":[
3,
0,
0
]
}
],
"meshes":[
{
"name":"Spire",
"name":"SpireSmall1",
"primitives":[
{
"attributes":{
"COLOR_0":0,
"POSITION":1,
"NORMAL":2
"POSITION":0,
"NORMAL":1
},
"indices":3
"indices":2
}
]
},
{
"name":"SpireSmall2",
"primitives":[
{
"attributes":{
"POSITION":3,
"NORMAL":4
},
"indices":5
}
]
}
],
"accessors":[
{
"bufferView":0,
"componentType":5123,
"count":67,
"normalized":true,
"type":"VEC4"
"componentType":5126,
"count":70,
"max":[
1,
4,
1
],
"min":[
-1,
0,
-1
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":67,
"count":70,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5123,
"count":90,
"type":"SCALAR"
},
{
"bufferView":3,
"componentType":5126,
"count":38,
"max":[
1,
4,
2,
1
],
"min":[
Expand All @@ -59,47 +101,59 @@
"type":"VEC3"
},
{
"bufferView":2,
"bufferView":4,
"componentType":5126,
"count":67,
"count":38,
"type":"VEC3"
},
{
"bufferView":3,
"bufferView":5,
"componentType":5123,
"count":84,
"count":42,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":536,
"byteLength":840,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":804,
"byteOffset":536,
"byteLength":840,
"byteOffset":840,
"target":34962
},
{
"buffer":0,
"byteLength":180,
"byteOffset":1680,
"target":34963
},
{
"buffer":0,
"byteLength":456,
"byteOffset":1860,
"target":34962
},
{
"buffer":0,
"byteLength":804,
"byteOffset":1340,
"byteLength":456,
"byteOffset":2316,
"target":34962
},
{
"buffer":0,
"byteLength":168,
"byteOffset":2144,
"byteLength":84,
"byteOffset":2772,
"target":34963
}
],
"buffers":[
{
"byteLength":2312,
"byteLength":2856,
"uri":"spires.bin"
}
]
Expand Down
2 changes: 1 addition & 1 deletion assets/shaders/confictura/model-prop.vert
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
attribute vec4 a_color;
attribute vec3 a_position;
attribute vec3 a_normal;
attribute vec4 a_color;

uniform mat4 u_proj;
uniform vec3 u_lightDir;
Expand Down
Binary file added assets/sprites-raw/blocks/props/eroded-spire.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites-raw/blocks/props/sharp-spire.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/sprites-raw/blocks/props/slate-spire.png
Binary file not shown.
72 changes: 45 additions & 27 deletions proc/src/confictura/proc/list/BlockProc.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
import arc.util.*;
import arc.util.serialization.*;
import arc.util.serialization.Jval.*;
import confictura.*;
import confictura.proc.*;
import confictura.proc.GenAtlas.*;
import confictura.world.blocks.*;
import confictura.world.blocks.environment.*;
import mindustry.world.blocks.environment.*;

import java.io.*;
import java.nio.charset.*;

import static confictura.ConficturaMod.*;
import static confictura.proc.ConficturaProc.*;
import static confictura.util.StructUtils.*;
import static mindustry.Vars.*;
Expand All @@ -26,7 +27,7 @@ public void init(Cons<Runnable> async){
blockColors = Jval.newObject();

var packer = new GenPacker();
content.blocks().each(ConficturaMod::isConfictura, block -> async.get(() -> {
content.blocks().each(b -> isConfictura(b) && b.generateIcons, block -> async.get(() -> {
try{
block.init();
block.loadIcon();
Expand Down Expand Up @@ -60,44 +61,61 @@ public void init(Cons<Runnable> async){
}

block.load();
var icon = atlas.conv(block.fullIcon).pixmap();

boolean hollow = false;
Color average = new Color(), col = new Color();

for(int x = 0, width = icon.width; x < width; x++){
for(int y = 0, height = icon.height; y < height; y++){
col.set(icon.getRaw(x, y));
average.r += col.r;
average.g += col.g;
average.b += col.b;
average.a += col.a;
if(col.a < 0.9f) hollow = true;

if(block instanceof DelegateMapColor map){
synchronized(BlockProc.class){
var sub = map.substitute();
if(isConfictura(sub)){
blockColors.put(block.name.substring("confictura-".length()), sub.name.substring("confictura-".length()));
}else{
throw new IllegalArgumentException(Strings.format("Block '@' has non-Confictura map color substitution '@'.", block.name, sub.name));
}
}
}else{
var icon = atlas.conv(block.fullIcon).pixmap();

boolean hollow = false;
Color average = new Color(), col = new Color();

for(int x = 0, width = icon.width; x < width; x++){
for(int y = 0, height = icon.height; y < height; y++){
col.set(icon.getRaw(x, y));
average.r += col.r;
average.g += col.g;
average.b += col.b;
average.a += col.a;
if(col.a < 0.9f) hollow = true;
}
}
}

float a = average.a;
average.mul(1f / a);
float a = average.a;
average.mul(1f / a);

if(block instanceof Floor floor && !floor.wallOre){
average.mul(0.77f);
}else{
average.mul(1.1f);
}
if(block instanceof Floor floor && !floor.wallOre){
average.mul(0.77f);
}else{
average.mul(1.1f);
}

average.a = hollow ? 0f : 1f;
synchronized(BlockProc.class){
blockColors.put(block.name.substring("confictura-".length()), average.rgba());
average.a = hollow ? 0f : 1f;
synchronized(BlockProc.class){
blockColors.put(block.name.substring("confictura-".length()), average.rgba());
}
}
}catch(Throwable t){
Log.warn("Skipping '@': @", block.name, Strings.getFinalMessage(t));
Log.warn("Skipping '@': @", block.name.substring("confictura-".length()), Strings.getFinalMessage(t));
}
}));
}

@Override
public void finish(){
synchronized(BlockProc.class){
var map = blockColors.asObject();
for(var e : map){
if(e.value.isString()) map.put(e.key, map.get(e.value.asString()));
}

var out = assetsDir.child("meta").child("confictura").child("block-colors.json");
try(var writer = new OutputStreamWriter(out.write(false, 4096), StandardCharsets.UTF_8)){
blockColors.writeTo(writer, Jformat.formatted);
Expand Down
13 changes: 13 additions & 0 deletions src/confictura/DevBuildImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
import arc.util.*;
import arc.util.Log.*;
import confictura.util.*;
import mindustry.ctype.*;
import mindustry.ui.dialogs.*;

import static arc.Core.*;
import static confictura.ConficturaMod.*;
import static mindustry.Vars.*;

/**
* Implementation class for {@link DevBuild}. This class is excluded in the built JARs for non-developer builds.
* @author GlennFolker
Expand All @@ -18,5 +23,13 @@ public DevBuildImpl(){
@Override
public void init(){
ScriptUtils.importDefaults(ScriptUtils.vanillaScope);
for(var type : ContentType.all) content.getBy(type).each(c -> c instanceof MappableContent && isConfictura(c), (MappableContent c) -> {
if(!bundle.has(type.name() + "." + c.name + ".name")){
Log.debug("Content '@' of type '@' has no localized name.", c.name, type.name());
}
if(c instanceof UnlockableContent u && !u.isHidden() && !bundle.has(type.name() + "." + c.name + ".description")){
Log.debug("Content '@' of type '@' has no localized description.", c.name, type.name());
}
});
}
}
6 changes: 4 additions & 2 deletions src/confictura/content/CBlocks.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package confictura.content;

import arc.graphics.*;
import confictura.*;
import confictura.graphics.*;
import confictura.world.blocks.environment.*;
Expand All @@ -18,7 +19,7 @@ public final class CBlocks{
ludellyte,
erodedSlate, infErodedSlate, archErodedSlate, erodedEneraphyteVent, erodedSlateWall, infErodedSlateWall, archErodedSlateWall,
sharpSlate, infSharpSlate, archSharpSlate, eneraphyteVent, sharpSlateWall, infSharpSlateWall, archSharpSlateWall,
slateSpire,
erodedSpire, sharpSpire,
eneraphyteCrystal;

private CBlocks(){
Expand Down Expand Up @@ -105,6 +106,7 @@ public static void load(){
lightRadius = 48f;
}};

slateSpire = new ModelProp("slate-spire", () -> CModels.slateSpire);
erodedSpire = new ModelProp("eroded-spire", erodedSlateWall, new Color(0x454858ff), () -> CModels.spireSmall1, () -> CModels.spireSmall2);
sharpSpire = new ModelProp("sharp-spire", sharpSlateWall, new Color(0x6e7080ff), () -> CModels.spireSmall1, () -> CModels.spireSmall2);
}
}
10 changes: 6 additions & 4 deletions src/confictura/graphics/CModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public final class CModels{
public static Scenes3D portal;

public static Node portalBase, portalCage;
public static Mesh slateSpire;
public static Mesh spireSmall1, spireSmall2;

private CModels(){
throw new AssertionError();
Expand All @@ -37,9 +37,11 @@ public static void load(){
assets
.load("scenes/confictura/portal.gltf#Cage", Node.class)
.loaded = node -> portalCage = node;

assets
.load("scenes/confictura/spires.gltf#Spire", MeshSet.class)
.loaded = set -> slateSpire = set.containers.first().mesh;
.load("scenes/confictura/spires.gltf", Scenes3D.class)
.loaded = scene -> {
spireSmall1 = scene.meshNames.get("SpireSmall1").containers.first().mesh;
spireSmall2 = scene.meshNames.get("SpireSmall2").containers.first().mesh;
};
}
}
Loading

0 comments on commit d242866

Please sign in to comment.