From bd1968ba02a64055e53e7be9c2e2c0ce93b0bf14 Mon Sep 17 00:00:00 2001 From: "U-METAL103\\103" Date: Wed, 1 May 2024 01:27:12 -0500 Subject: [PATCH] removed un-needed conus codes --- .../joshuatee/wx/radar/NexradRenderData.kt | 1 - .../wx/radar/NexradRenderUtilities.kt | 45 ------------ .../java/joshuatee/wx/radar/OpenGLShader.kt | 68 +------------------ 3 files changed, 2 insertions(+), 112 deletions(-) diff --git a/app/src/main/java/joshuatee/wx/radar/NexradRenderData.kt b/app/src/main/java/joshuatee/wx/radar/NexradRenderData.kt index 0dd48865..18a5b16a 100644 --- a/app/src/main/java/joshuatee/wx/radar/NexradRenderData.kt +++ b/app/src/main/java/joshuatee/wx/radar/NexradRenderData.kt @@ -68,5 +68,4 @@ class NexradRenderData(val context: Context) { val warningBuffers = mutableMapOf() //elys mod val userPointsBuffers = OglBuffers(PolygonType.USERPOINTS, zoomToHideMiscFeatures) - val conusRadarBuffers = OglBuffers() } diff --git a/app/src/main/java/joshuatee/wx/radar/NexradRenderUtilities.kt b/app/src/main/java/joshuatee/wx/radar/NexradRenderUtilities.kt index 94cb3f45..259939c2 100644 --- a/app/src/main/java/joshuatee/wx/radar/NexradRenderUtilities.kt +++ b/app/src/main/java/joshuatee/wx/radar/NexradRenderUtilities.kt @@ -312,45 +312,6 @@ internal object NexradRenderUtilities { } } - /* - //elys mod - keeping this for now. - fun generate4326Projection(inBuff: ByteBuffer, outBuff: ByteBuffer, pn: ProjectionNumbers, count: Int) { - val pnXFloat = pn.xFloat - val pnYFloat = pn.yFloat - val pnXCenter = pn.xCenter - val pnYCenter = pn.yCenter - val pnScaleFloat = pn.scaleFloat - if (count * 4 <= outBuff.limit()) { - for (iCount in 0 until count step 2) { - outBuff.putFloat(iCount * 4, (-((inBuff.getFloat(iCount * 4 + 4) - pnYFloat) * pnScaleFloat) + pnXCenter.toFloat())) - outBuff.putFloat(iCount * 4 + 4, -(-((inBuff.getFloat(iCount * 4) - pnXFloat) * pnScaleFloat) + pnYCenter.toFloat())) - } - } - } - */ - - //elys mods - fun genConus(buffers: OglBuffers, pn: ProjectionNumbers, x: Double, y: Double) { - buffers.setToPositionZero() - val pixYD: Float - val pixXD = (-((y - pn.yDbl) * pn.oneDegreeScaleFactor) + pn.xCenter).toFloat() - var ixCount = 0 - val test1 = M_180_DIV_PI * log(tan(M_PI_DIV_4 + x * M_PI_DIV_360), E).toFloat() - val test2 = M_180_DIV_PI * log(tan(M_PI_DIV_4 + pn.xDbl * M_PI_DIV_360), E).toFloat() - val len = 1 //buffers.lenInit * 2.0f - val triangleAmount = 1 //buffers.triangleCount - pixYD = -((test1 - test2) * pn.oneDegreeScaleFactorFloat) + pn.yCenter.toFloat() - (0 until triangleAmount).forEach { - buffers.putFloat(pixXD + len * cos((it * TWICE_PI / triangleAmount).toDouble()).toFloat()) - buffers.putFloat(-pixYD + len * sin((it * TWICE_PI / triangleAmount).toDouble()).toFloat()) - buffers.putFloat(pixXD + len * cos(((it + 1) * TWICE_PI / triangleAmount).toDouble()).toFloat()) - buffers.putFloat(-pixYD + len * sin(((it + 1) * TWICE_PI / triangleAmount).toDouble()).toFloat()) - buffers.putIndex(ixCount.toShort()) - buffers.putIndex((ixCount + 1).toShort()) - ixCount += 2 - } - } - //for single images fun genMarker(buffers: OglBuffers, pn: ProjectionNumbers, x: Double, y: Double) { buffers.setToPositionZero() @@ -415,14 +376,8 @@ internal object NexradRenderUtilities { buffers.putIndex(iI, (ixCount + 2).toShort()) iI += 2 ixCount += 3 - } iCount += 1 } } - - - - - } diff --git a/app/src/main/java/joshuatee/wx/radar/OpenGLShader.kt b/app/src/main/java/joshuatee/wx/radar/OpenGLShader.kt index e013a5e4..6293d03c 100644 --- a/app/src/main/java/joshuatee/wx/radar/OpenGLShader.kt +++ b/app/src/main/java/joshuatee/wx/radar/OpenGLShader.kt @@ -19,8 +19,6 @@ internal object OpenGLShader { // Program variables var sp_SolidColor: Int = 0 var sp_loadimage: Int = 0 - var sp_loadconus: Int = 0 - var sp_conus: Int = 0 /* SHADER Solid * @@ -44,11 +42,7 @@ internal object OpenGLShader { "void main() {" + " gl_FragColor = vec4(v_Color,1.0);" + "}" - - - - - + //Thanks to this for point sprite shader and codes //http://opengles2learning.blogspot.com/2011/05/applying-texture-to-point-sprite.html //This is my modified shader :) ELY M. @@ -67,49 +61,7 @@ internal object OpenGLShader { "void main() {" + " gl_FragColor = texture2D(u_texture, gl_PointCoord);" + "}" - - -/* - - - val vs_conus = "uniform mat4 uMVPMatrix;" + - "attribute vec4 vPosition;" + - "attribute vec2 a_texCoords;" + - "varying vec2 v_texCoords;" + - "void main() {" + - " gl_Position = uMVPMatrix * vPosition;" + - " v_texCoords = a_texCoords;" + - "}" - - val fs_conus = ( - "precision mediump float;" + - "varying vec2 v_texCoords;" + - "uniform sampler2D u_texture;" + - "void main() {" + - " gl_FragColor = texture2D(u_texture, v_texCoords);" + - "}") - - - */ - - val vs_conus = "uniform mat4 uMVPMatrix;" + - "attribute vec4 vPosition;" + - "attribute vec2 a_texCoords;" + - "varying vec2 v_texCoords;" + - "void main() {" + - " gl_Position = uMVPMatrix * vPosition;" + - " v_texCoords = a_texCoords;" + - "}" - - val fs_conus = ( - "precision mediump float;" + - "varying vec2 v_texCoords;" + - "uniform sampler2D u_texture;" + - "void main() {" + - " gl_FragColor = texture2D(u_texture, v_texCoords);" + - "}") - - + fun loadShader(type: Int, shaderCode: String): Int { // create a vertex shader type (GLES20.GL_VERTEX_SHADER) @@ -124,7 +76,6 @@ internal object OpenGLShader { return shader } - fun LoadImage(imagefile: String) { val texturenames = IntArray(1) GLES20.glGenTextures(1, texturenames, 0) @@ -140,16 +91,12 @@ internal object OpenGLShader { GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE.toFloat()) GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bmp, 0) ///UtilityLog.d("wx-elys", "Loaded texture" + ":H:" + bmp.height + ":W:" + bmp.width) - try { bmp.recycle() } catch (e: NullPointerException) { UtilityLog.handleException(e) } - } - - fun LoadTexture(imagefile: String): Int { var img: Bitmap? = null val textures = IntArray(1) @@ -169,16 +116,13 @@ internal object OpenGLShader { } catch (e: Exception) { UtilityLog.handleException(e) } - try { img!!.recycle() } catch (e: NullPointerException) { UtilityLog.handleException(e) } - return textures[0] } - fun LoadBitmap(imagefile: String): Bitmap? { var img: Bitmap? = null try { @@ -186,20 +130,17 @@ internal object OpenGLShader { options.inScaled = false options.inPreferredConfig = Bitmap.Config.ARGB_8888 img = BitmapFactory.decodeFile(imagefile, options) - } catch (e: NullPointerException) { UtilityLog.handleException(e) } return img } - fun resizeBitmap(imagefile: String, size: Double): Bitmap { val bitmap: Bitmap? = LoadBitmap(imagefile) val newWidth: Double = (bitmap!!.getWidth() * (size / 100)) val newHeight: Double = (bitmap!!.getHeight() * (size / 100)) return Bitmap.createScaledBitmap(bitmap, newWidth.toInt(), newHeight.toInt(), true) } - fun RotateBitmap(imagefile: String, d: Double): Bitmap { //UtilityLog.d("wx-elys", "rotating bitmap: "+ imagefile + " to: "+d) val bitmap: Bitmap? = LoadBitmap(imagefile) @@ -208,7 +149,6 @@ internal object OpenGLShader { matrix.postTranslate(0.0f, bitmap!!.width.toFloat()) return Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true) } - fun LoadBitmapTexture(img: Bitmap): Int { val textures = IntArray(1) try { @@ -223,15 +163,11 @@ internal object OpenGLShader { } catch (e: Exception) { UtilityLog.handleException(e) } - try { img.recycle() } catch (e: NullPointerException) { UtilityLog.handleException(e) } - return textures[0] } - - } \ No newline at end of file