Almost rendering glyphs

This commit is contained in:
Willem Cazander 2022-03-16 17:47:42 +01:00
parent ad8102be3a
commit df5efd4dab
19 changed files with 629 additions and 625 deletions

View file

@ -28,104 +28,7 @@
<_dsannotations>*</_dsannotations>
<_metatypeannotations>*</_metatypeannotations>
<Import-Package>
org.osgi.framework,
org.osgi.service.packageadmin,
org.osgi.service.url,
org.osgi.service.startlevel,
org.osgi.util.tracker,
love.distributedrebirth.gdxapp4d.tos4.service,
com.badlogic.gdx,
com.badlogic.gdx.assets,
com.badlogic.gdx.assets.loaders,
com.badlogic.gdx.assets.loaders.resolvers,
com.badlogic.gdx.audio,
com.badlogic.gdx.files,
com.badlogic.gdx.graphics,
com.badlogic.gdx.graphics.g2d,
com.badlogic.gdx.graphics.g2d.freetype,
com.badlogic.gdx.graphics.g3d,
com.badlogic.gdx.graphics.g3d.attributes,
com.badlogic.gdx.graphics.g3d.decals,
com.badlogic.gdx.graphics.g3d.environment,
com.badlogic.gdx.graphics.g3d.loader,
com.badlogic.gdx.graphics.g3d.model,
com.badlogic.gdx.graphics.g3d.model.data,
com.badlogic.gdx.graphics.g3d.particles,
com.badlogic.gdx.graphics.g3d.particles.bactches,
com.badlogic.gdx.graphics.g3d.particles.emitters,
com.badlogic.gdx.graphics.g3d.particles.influencers,
com.badlogic.gdx.graphics.g3d.particles.renderers,
com.badlogic.gdx.graphics.g3d.particles.values,
com.badlogic.gdx.graphics.g3d.shaders,
com.badlogic.gdx.graphics.g3d.utils,
com.badlogic.gdx.graphics.g3d.utils.shapebuilders,
com.badlogic.gdx.graphics.glutils,
com.badlogic.gdx.graphics.profiling,
com.badlogic.gdx.input,
com.badlogic.gdx.maps,
com.badlogic.gdx.maps.objects,
com.badlogic.gdx.maps.tiled,
com.badlogic.gdx.maps.tiled.objects,
com.badlogic.gdx.maps.tiled.renderers,
com.badlogic.gdx.maps.tiled.tiles,
com.badlogic.gdx.math,
com.badlogic.gdx.math.collision,
com.badlogic.gdx.net,
com.badlogic.gdx.scenes.scene2d,
com.badlogic.gdx.scenes.scene2d.actions,
com.badlogic.gdx.scenes.scene2d.ui,
com.badlogic.gdx.scenes.scene2d.utils,
com.badlogic.gdx.utils,
com.badlogic.gdx.utils.async,
com.badlogic.gdx.utils.compression,
com.badlogic.gdx.utils.compression.lz,
com.badlogic.gdx.utils.compression.lzma,
com.badlogic.gdx.utils.compression.rangecoder,
com.badlogic.gdx.utils.reflect,
com.badlogic.gdx.utils.viewport,
imgui,
imgui.flag,
imgui.glfw,
imgui.gl3,
imgui.type,
net.spookygames.gdx.nativefilechooser,
org.x4o.xml,
org.x4o.xml.conv,
org.x4o.xml.conv.text,
org.x4o.xml.el,
org.x4o.xml.eld,
org.x4o.xml.eld.lang,
org.x4o.xml.eld.xsd,
org.x4o.xml.element,
org.x4o.xml.io,
org.x4o.xml.io.sax,
org.x4o.xml.io.sax.ext,
org.x4o.xml.lang,
org.x4o.xml.lang.phase,
org.x4o.xml.lang.task,
org.x4o.xml.lang.task.run,
javax.el,
org.apache.el,
org.apache.el.lang,
org.apache.el.parser,
org.apache.el.util,
love.distributedrebirth.bassboonyd,
love.distributedrebirth.bassboonyd.jmx,
love.distributedrebirth.numberxd,
love.distributedrebirth.numberxd.base2t,
love.distributedrebirth.numberxd.base2t.part,
love.distributedrebirth.numberxd.base2t.part.warp,
love.distributedrebirth.numberxd.base2t.type,
love.distributedrebirth.numberxd.base2t.typexl,
love.distributedrebirth.numberxd.glyph,
love.distributedrebirth.numberxd.x4o,
love.distributedrebirth.warpme,
love.distributedrebirth.warpme.core,
love.distributedrebirth.warpme.hash,
love.distributedrebirth.warpme.sea,
love.distributedrebirth.warpme.ship,
love.distributedrebirth.unicode4d,
love.distributedrebirth.unicode4d.atlas
${tos4.packages}
</Import-Package>
<Export-Package>
love.distributedrebirth.gdxapp4d.vrgem4.service,

View file

@ -19,12 +19,14 @@ import love.distributedrebirth.unicode4d.atlas.FontAtlas;
import love.distributedrebirth.unicode4d.atlas.FontAtlasDriver;
import love.distributedrebirth.unicode4d.atlas.FontAtlasStore;
import love.distributedrebirth.unicode4d.atlas.FontAtlasStoreGlyph;
import love.distributedrebirth.unicode4d.draw.DrawCharacter;
@Component
public class VrGem4Unicode4DServiceImpl implements VrGem4Unicode4DService {
private final FontAtlas masterFontAtlas;
private final Map<Integer, FontAtlasStoreGlyph> unicodeMap;
private final Map<Integer, DrawCharacter> unicodeCharMap;
@Reference
private SystemGdxLog log;
@ -36,6 +38,7 @@ public class VrGem4Unicode4DServiceImpl implements VrGem4Unicode4DService {
public VrGem4Unicode4DServiceImpl() {
masterFontAtlas = new FontAtlas();
unicodeMap = new HashMap<>();
unicodeCharMap = new HashMap<>();
}
@Activate
@ -53,16 +56,26 @@ public class VrGem4Unicode4DServiceImpl implements VrGem4Unicode4DService {
}
log.info(this, "Master font atlas size: {}", masterFontAtlas.getStores().size());
int dup = 0;
for (FontAtlasStore fontStore:masterFontAtlas.getStores()) {
log.info(this,"Map unicode: {} size: {}", fontStore.getName(), fontStore.getGlyphs().size());
for (FontAtlasStoreGlyph glyph: fontStore.getGlyphs()) {
int unicode = CodePointᶻᴰ.INSTANCE.searchUnicode(glyph.getTongs());
if (unicodeMap.containsKey(unicode)) {
dup++;
continue;
}
if (unicode > 0) {
unicodeMap.put(unicode, glyph);
try {
unicodeCharMap.put(unicode, new DrawCharacter(glyph));
} catch (Exception e) {
log.error(this, e.getMessage(), e);
}
}
}
}
log.info(this, "unicode map size: {}", unicodeMap.size());
log.info(this, "unicode map size: {} dups: {}", unicodeMap.size(), dup);
}
@Deactivate
@ -71,12 +84,17 @@ public class VrGem4Unicode4DServiceImpl implements VrGem4Unicode4DService {
}
@Override
public FontAtlas getMasterFontAtlas() {
public FontAtlas getFontAtlas() {
return masterFontAtlas;
}
@Override
public FontAtlasStoreGlyph getGlyphForUnicode(int unicode) {
return unicodeMap.get(unicode);
}
@Override
public DrawCharacter getCharacterForUnicode(int unicode) {
return unicodeCharMap.get(unicode);
}
}

View file

@ -2,10 +2,13 @@ package love.distributedrebirth.gdxapp4d.vrgem4.service;
import love.distributedrebirth.unicode4d.atlas.FontAtlas;
import love.distributedrebirth.unicode4d.atlas.FontAtlasStoreGlyph;
import love.distributedrebirth.unicode4d.draw.DrawCharacter;
public interface VrGem4Unicode4DService {
FontAtlas getMasterFontAtlas();
FontAtlas getFontAtlas();
FontAtlasStoreGlyph getGlyphForUnicode(int unicode);
DrawCharacter getCharacterForUnicode(int unicode);
}