889 added rays texture atlas

This commit is contained in:
Michael Gevlich 2025-10-20 15:14:44 +04:00
parent c4ecd32f6a
commit cda09a6564
3 changed files with 35 additions and 24 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@openglobus/og",
"version": "0.27.12",
"version": "0.27.16",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@openglobus/og",
"version": "0.27.12",
"version": "0.27.16",
"license": "MIT",
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",

View File

@ -215,26 +215,26 @@ class Renderer {
protected _initialized: boolean;
/**
* Texture atlas for the billboards images. One atlas per node.
* Texture atlas for the billboards images.
* @public
* @type {TextureAtlas}
*/
public billboardsTextureAtlas: TextureAtlas;
/**
* Texture atlas for the billboards images. One atlas per node.
* @public
* @type {TextureAtlas}
*/
public geoObjectsTextureAtlas: TextureAtlas;
/**
* Texture font atlas for the font families and styles. One atlas per node.
* Texture font atlas for the font families and styles.
* @public
* @type {FontAtlas}
*/
public fontAtlas: FontAtlas;
/**
* Texture atlas for the rays, polylines and strips entities.
* @public
* @type {TextureAtlas}
*/
public strokeTextureAtlas: TextureAtlas;
protected _entityCollections: EntityCollection[][];
protected _currentOutput: string;
@ -335,26 +335,26 @@ class Renderer {
this._initialized = false;
/**
* Texture atlas for the billboards images. One atlas per node.
* Texture atlas for the billboards images.
* @public
* @type {TextureAtlas}
*/
this.billboardsTextureAtlas = new TextureAtlas();
/**
* Texture atlas for the billboards images. One atlas per node.
* @public
* @type {TextureAtlas}
*/
this.geoObjectsTextureAtlas = new TextureAtlas();
/**
* Texture font atlas for the font families and styles. One atlas per node.
* Texture font atlas for the font families and styles.
* @public
* @type {FontAtlas}
*/
this.fontAtlas = new FontAtlas(params.fontsSrc);
/**
* Texture atlas for the rays, polylines and strips.
* @public
* @type {TextureAtlas}
*/
this.strokeTextureAtlas = new TextureAtlas();
this._entityCollections = [[]];
this._currentOutput = "screen";
@ -586,9 +586,8 @@ class Renderer {
this.handler.initialize();
this.billboardsTextureAtlas.assignHandler(this.handler);
this.geoObjectsTextureAtlas.assignHandler(this.handler);
this.fontAtlas.assignHandler(this.handler);
this.strokeTextureAtlas.assignHandler(this.handler);
this.handler.setFrameCallback(() => {
this.draw();
@ -886,7 +885,9 @@ class Renderer {
}
}
//
// billboards pass
//
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, this.billboardsTextureAtlas.texture!);
@ -896,7 +897,9 @@ class Renderer {
eci._fadingOpacity && eci.billboardHandler.draw();
}
//
// labels pass
//
let fa = this.fontAtlas.atlasesArr;
for (i = 0; i < fa.length; i++) {
gl.activeTexture(gl.TEXTURE0 + i);
@ -908,6 +911,12 @@ class Renderer {
ec[i]._fadingOpacity && ec[i].labelHandler.draw();
}
//
// Lines, Rays and Strips
//
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, this.strokeTextureAtlas.texture!);
// rays
i = ec.length;
while (i--) {
@ -1475,8 +1484,8 @@ class Renderer {
// todo
//this.billboardsTextureAtlas.clear();
//this.geoObjectsTextureAtlas.clear()
//this.fontAtlas.clear();
//this.strokeTextureAtlas.clear();
this._entityCollections = [[]];

View File

@ -11,9 +11,11 @@ export function rayScreen(): Program {
eyePositionHigh: "vec3",
eyePositionLow: "vec3",
resolution: "float",
uOpacity: "float"
uOpacity: "float",
texAtlas: "sampler2d"
},
attributes: {
a_texCoords: "vec2",
a_vertices: "vec2",
a_startPosHigh: "vec3",
a_startPosLow: "vec3",