Skip to content

Commit be58010

Browse files
committed
Drop lightmap support.
1 parent 8b1c295 commit be58010

File tree

2 files changed

+1
-110
lines changed

2 files changed

+1
-110
lines changed

adventure-editor/src/main/java/com/bladecoder/engineeditor/ui/EditSceneDialog.java

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ public class EditSceneDialog extends EditModelDialog<World, Scene> {
6262
private InputPanel id;
6363
private InputPanel backgroundAtlas;
6464
private InputPanel backgroundRegion;
65-
private InputPanel lightmapAtlas;
66-
private InputPanel lightmapRegion;
6765
private InputPanel depthVector;
6866
private InputPanel state;
6967
private InputPanel music;
@@ -82,10 +80,6 @@ public EditSceneDialog(Skin skin, World parent, Scene e) {
8280
"The atlas where the background for the scene is located", atlasList, false);
8381
backgroundRegion = InputPanelFactory.createInputPanel(skin, "Background Region Id",
8482
"The region id for the background.", new String[0], false);
85-
lightmapAtlas = InputPanelFactory.createInputPanel(skin, "Lightmap Atlas",
86-
"The atlas where the lightmap for the scene is located", atlasList, false);
87-
lightmapRegion = InputPanelFactory.createInputPanel(skin, "Lightmap Region Id",
88-
"The region id for the lightmap", new String[0], false);
8983
depthVector = InputPanelFactory.createInputPanel(skin, "Depth Vector",
9084
"X: the actor 'y' position for a 0.0 scale, Y: the actor 'y' position for a 1.0 scale.",
9185
Param.Type.VECTOR2, false);
@@ -122,25 +116,13 @@ public void changed(ChangeEvent event, Actor actor) {
122116
}
123117
});
124118

125-
((SelectBox<String>) lightmapAtlas.getField()).addListener(new ChangeListener() {
126-
127-
@Override
128-
public void changed(ChangeEvent event, Actor actor) {
129-
try {
130-
fillLightmapRegions(lightmapAtlas, lightmapAtlas);
131-
} catch (Exception e) {
132-
Message.showMsg(getStage(), "Error loading regions from selected atlas", 4);
133-
}
134-
}
135-
});
136-
137119
try {
138120
fillBGRegions(backgroundAtlas, backgroundRegion);
139121
} catch (Exception e2) {
140122
EditorLogger.error("Error loading regions from selected atlas");
141123
}
142124

143-
init(parent, e, new InputPanel[] { id, backgroundAtlas, backgroundRegion, lightmapAtlas, lightmapRegion,
125+
init(parent, e, new InputPanel[] { id, backgroundAtlas, backgroundRegion,
144126
depthVector, state, music, loopMusic, initialMusicDelay, repeatMusicDelay });
145127
}
146128

@@ -190,31 +172,6 @@ private void fillBGRegions(InputPanel atlasInput, InputPanel regionInput) {
190172
showBgImage(regionInput.getText());
191173
}
192174

193-
private void fillLightmapRegions(InputPanel atlasInput, InputPanel regionInput) {
194-
@SuppressWarnings("unchecked")
195-
SelectBox<String> cb = (SelectBox<String>) regionInput.getField();
196-
197-
// cb.clearItems();
198-
cb.getItems().clear();
199-
200-
TextureAtlas atlas = new TextureAtlas(Gdx.files.absolute(Ctx.project.getProjectPath() + Project.ATLASES_PATH
201-
+ "/" + Ctx.project.getResDir() + "/" + atlasInput.getText() + ".atlas"));
202-
203-
Array<AtlasRegion> regions = atlas.getRegions();
204-
205-
for (AtlasRegion r : regions)
206-
if (cb.getItems().indexOf(r.name, false) == -1)
207-
cb.getItems().add(r.name);
208-
209-
cb.getList().setItems(cb.getItems());
210-
if (cb.getItems().size > 0)
211-
cb.setSelectedIndex(0);
212-
213-
cb.invalidateHierarchy();
214-
215-
atlas.dispose();
216-
}
217-
218175
@Override
219176
protected void inputsToModel(boolean create) {
220177

@@ -247,8 +204,6 @@ protected void inputsToModel(boolean create) {
247204

248205
e.setBackgroundAtlas(backgroundAtlas.getText());
249206
e.setBackgroundRegionId(backgroundRegion.getText());
250-
e.setLightMapAtlas(lightmapAtlas.getText());
251-
e.setLightMapRegionId(lightmapRegion.getText());
252207
e.setDepthVector(Param.parseVector2(depthVector.getText()));
253208
e.setState(state.getText());
254209

@@ -276,8 +231,6 @@ protected void modelToInputs() {
276231
id.setText(e.getId());
277232
backgroundAtlas.setText(e.getBackgroundAtlas());
278233
backgroundRegion.setText(e.getBackgroundRegionId());
279-
lightmapAtlas.setText(e.getLightMapAtlas());
280-
lightmapRegion.setText(e.getLightMapRegionId());
281234
if (e.getDepthVector() != null)
282235
depthVector.setText(Param.toStringParam(e.getDepthVector()));
283236
state.setText(e.getState());

blade-engine/src/com/bladecoder/engine/model/Scene.java

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import com.badlogic.gdx.audio.Music;
2323
import com.badlogic.gdx.graphics.Color;
24-
import com.badlogic.gdx.graphics.GL20;
2524
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
2625
import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
2726
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
@@ -63,11 +62,8 @@ public class Scene implements Serializable, AssetConsumer {
6362
private SceneCamera camera = new SceneCamera();
6463

6564
private Array<AtlasRegion> background;
66-
private Array<AtlasRegion> lightMap;
6765
private String backgroundAtlas;
6866
private String backgroundRegionId;
69-
private String lightMapAtlas;
70-
private String lightMapRegionId;
7167

7268
/** For polygonal PathFinding */
7369
private PolygonalNavGraph polygonalNavGraph;
@@ -292,24 +288,6 @@ public void draw(SpriteBatch batch) {
292288
layer.draw(batch);
293289
batch.end();
294290
}
295-
296-
// Draw the light map
297-
if (lightMap != null) {
298-
// Multiplicative blending for light maps
299-
batch.setBlendFunction(GL20.GL_DST_COLOR, GL20.GL_ZERO);
300-
batch.setProjectionMatrix(camera.calculateParallaxMatrix(1, 1));
301-
batch.begin();
302-
303-
float x = 0;
304-
305-
for (AtlasRegion tile : lightMap) {
306-
batch.draw(tile, x, 0f);
307-
x += tile.getRegionWidth();
308-
}
309-
310-
batch.end();
311-
batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
312-
}
313291
}
314292

315293
public void drawBBoxLines(ShapeRenderer renderer) {
@@ -392,8 +370,6 @@ public void addActor(BaseActor actor) {
392370
public void setBackground(String bgAtlas, String bgId, String lightMapAtlas, String lightMapId) {
393371
this.backgroundAtlas = bgAtlas;
394372
this.backgroundRegionId = bgId;
395-
this.lightMapAtlas = lightMapAtlas;
396-
this.lightMapRegionId = lightMapId;
397373
}
398374

399375
/**
@@ -547,22 +523,6 @@ public void setBackgroundRegionId(String backgroundRegionId) {
547523
this.backgroundRegionId = backgroundRegionId;
548524
}
549525

550-
public String getLightMapAtlas() {
551-
return lightMapAtlas;
552-
}
553-
554-
public void setLightMapAtlas(String lightMapAtlas) {
555-
this.lightMapAtlas = lightMapAtlas;
556-
}
557-
558-
public String getLightMapRegionId() {
559-
return lightMapRegionId;
560-
}
561-
562-
public void setLightMapRegionId(String lightMapRegionId) {
563-
this.lightMapRegionId = lightMapRegionId;
564-
}
565-
566526
public String getMusicFilename() {
567527
return musicFilename;
568528
}
@@ -630,11 +590,6 @@ public void loadAssets() {
630590
EngineAssetManager.getInstance().loadAtlas(backgroundAtlas);
631591
}
632592

633-
// LOAD LIGHT MAP
634-
if (lightMapAtlas != null && !lightMapAtlas.isEmpty()) {
635-
EngineAssetManager.getInstance().loadAtlas(lightMapAtlas);
636-
}
637-
638593
if (musicFilename != null)
639594
EngineAssetManager.getInstance().loadMusic(musicFilename);
640595

@@ -672,11 +627,6 @@ public void retrieveAssets() {
672627
// camera.updatePos(followActor);
673628
}
674629

675-
// RETRIEVE LIGHT MAP
676-
if (lightMapAtlas != null && !lightMapAtlas.isEmpty()) {
677-
lightMap = EngineAssetManager.getInstance().getRegions(lightMapAtlas, lightMapRegionId);
678-
}
679-
680630
// RETRIEVE ACTORS
681631
for (BaseActor a : actors.values()) {
682632
if (a instanceof AssetConsumer)
@@ -704,11 +654,6 @@ public void dispose() {
704654
EngineAssetManager.getInstance().disposeAtlas(backgroundAtlas);
705655
}
706656

707-
// LOAD LIGHT MAP
708-
if (lightMapAtlas != null && !lightMapAtlas.isEmpty()) {
709-
EngineAssetManager.getInstance().disposeAtlas(lightMapAtlas);
710-
}
711-
712657
// orderedActors.clear();
713658

714659
for (BaseActor a : actors.values()) {
@@ -750,11 +695,6 @@ public void write(Json json) {
750695
json.writeValue("backgroundRegionId", backgroundRegionId);
751696
}
752697

753-
if (lightMapAtlas != null) {
754-
json.writeValue("lightMapAtlas", lightMapAtlas);
755-
json.writeValue("lightMapRegionId", lightMapRegionId);
756-
}
757-
758698
if (musicFilename != null) {
759699
json.writeValue("musicFilename", musicFilename);
760700
json.writeValue("loopMusic", loopMusic);
@@ -823,8 +763,6 @@ public void read(Json json, JsonValue jsonData) {
823763

824764
backgroundAtlas = json.readValue("backgroundAtlas", String.class, jsonData);
825765
backgroundRegionId = json.readValue("backgroundRegionId", String.class, jsonData);
826-
lightMapAtlas = json.readValue("lightMapAtlas", String.class, jsonData);
827-
lightMapRegionId = json.readValue("lightMapRegionId", String.class, jsonData);
828766

829767
musicFilename = json.readValue("musicFilename", String.class, jsonData);
830768

0 commit comments

Comments
 (0)