Skip to content

Commit 0f845c6

Browse files
committed
fixed SRM tilts.
1 parent bceb6b9 commit 0f845c6

File tree

11 files changed

+1254
-6
lines changed

11 files changed

+1254
-6
lines changed

!files/2620001X.pdf

2.14 MB
Binary file not shown.

!files/infos/meso.txt

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,45 @@
1+
2+
http://tgftp.nws.noaa.gov/SL.us008001/DF.of/DC.radar/DS.141md/
3+
4+
5+
141
6+
Mesocyclone Detection
7+
8+
19
case NexradHeader.L3PC_DIGITAL_MESOCYCLONE /*141*/:
2-
return 10;
10+
return 10;
11+
12+
13+
149
14+
Digital Mesocyclone
15+
Detection
16+
149
17+
30
18+
Elevation Angle
19+
Degree
20+
-
21+
1.0 to + 45.0
22+
.1
23+
Digital Mesocyclone
24+
Detection
25+
149
26+
51
27+
Compression Method
28+
N/A
29+
0 or 1
30+
1
31+
Digital Mesocyclone
32+
Detection
33+
149
34+
52
35+
Uncompressed Product
36+
Data Size (MSW)
37+
Bytes
38+
120 to 300000
39+
1
40+
Digital Mesocyclone
41+
Detection
42+
149
43+
53
44+
Uncompressed Product
45+
Data Size (LSW)

!files/texture/WXGLRender.kt

Lines changed: 1004 additions & 0 deletions
Large diffs are not rendered by default.

TODOs.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
14. 8-bit SRM like in pykl3
1818
15. fix up the ability to change products in the multi-pane radar. it seem wont change products for me
1919
16. android wear support. I own android wear watches and love them.
20+
17. change the way the wX do radar pallettes - move the pallettes over to /wX/pal folder and have the app get palletes from there.
21+
will keep them in raw and copy them from there to /wX/pal on first time start up and run file check.
22+
right now, the app save custom pallettes to prefs I think.
23+
2024

2125

2226
#

app/src/main/java/joshuatee/wx/GlobalDictionaries.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ val NEXRAD_PRODUCT_STRING: Map<String, String> = mapOf(
4747
"HI" to "DS.p59hi",
4848
"DVL" to "DS.134il",
4949
"EET" to "DS.135et",
50+
"MDA" to "DS.141md",
5051
"TR0" to "DS.181r0",
5152
"TR1" to "DS.181r1",
5253
"TR2" to "DS.181r2",

app/src/main/java/joshuatee/wx/StartupActivity.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ class StartupActivity : Activity(), ActivityCompat.OnRequestPermissionsResultCal
8080
storagepermissionManager.checkPermissions(singleton(Manifest.permission.WRITE_EXTERNAL_STORAGE), object : PermissionManager.PermissionRequestListener {
8181
override fun onPermissionGranted() {
8282
Log.i(TAG, "Storage Permissions Granted")
83-
checkfiles(R.drawable.headingbug, "headingbug.png")
83+
checkfiles(R.drawable.headingbug, "headingbug.png")
84+
checkfiles(R.drawable.star_cyan, "star_cyan.png")
8485
checkfiles(R.drawable.location, "location.png")
8586
}
8687

app/src/main/java/joshuatee/wx/radar/OpenGLShader.kt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ import android.opengl.GLES20
44

55
// thanks! http://androidblog.reindustries.com/a-real-open-gl-es-2-0-2d-tutorial-part-1/
66

7+
//image textureing.....
8+
//http://androidblog.reindustries.com/a-real-opengl-es-2-0-2d-tutorial-part-2/
9+
710
internal object OpenGLShader {
811

912
// Program variables
1013
var sp_SolidColor: Int = 0
14+
var sp_Image: Int = 0
1115

1216
/* SHADER Solid
1317
*
@@ -32,6 +36,32 @@ internal object OpenGLShader {
3236
" gl_FragColor = vec4(v_Color,1.0);" +
3337
"}"
3438

39+
40+
/* SHADER Image
41+
*
42+
* This shader is for rendering 2D images straight from a texture
43+
* No additional effects.
44+
*
45+
*/
46+
const val vs_Image = "uniform mat4 uMVPMatrix;" +
47+
"attribute vec4 vPosition;" +
48+
"attribute vec2 a_texCoord;" +
49+
"varying vec2 v_texCoord;" +
50+
"void main() {" +
51+
" gl_Position = uMVPMatrix * vPosition;" +
52+
" v_texCoord = a_texCoord;" +
53+
"}"
54+
55+
const val fs_Image = (
56+
"precision mediump float;" +
57+
"varying vec2 v_texCoord;" +
58+
"uniform sampler2D s_texture;" +
59+
"void main() {" +
60+
" gl_FragColor = texture2D( s_texture, v_texCoord );" +
61+
"}")
62+
63+
64+
3565
fun loadShader(type: Int, shaderCode: String): Int {
3666

3767
// create a vertex shader type (GLES20.GL_VERTEX_SHADER)
@@ -45,4 +75,5 @@ internal object OpenGLShader {
4575
// return the shader
4676
return shader
4777
}
78+
4879
}

app/src/main/java/joshuatee/wx/radar/OpenGLShaderUniform.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,32 @@ internal object OpenGLShaderUniform {
3232
" gl_FragColor = v_Color;" +
3333
"}"
3434

35+
36+
37+
38+
/* SHADER Image
39+
*
40+
* This shader is for rendering 2D images straight from a texture
41+
* No additional effects.
42+
*
43+
*/
44+
const val vs_Image = "uniform mat4 uMVPMatrix;" +
45+
"attribute vec4 vPosition;" +
46+
"attribute vec2 a_texCoord;" +
47+
"varying vec2 v_texCoord;" +
48+
"void main() {" +
49+
" gl_Position = uMVPMatrix * vPosition;" +
50+
" v_texCoord = a_texCoord;" +
51+
"}"
52+
53+
const val fs_Image = (
54+
"precision mediump float;" +
55+
"varying vec2 v_texCoord;" +
56+
"uniform sampler2D s_texture;" +
57+
"void main() {" +
58+
" gl_FragColor = texture2D( s_texture, v_texCoord );" +
59+
"}")
60+
3561
fun loadShader(type: Int, shaderCode: String): Int {
3662

3763
// create a vertex shader type (GLES20.GL_VERTEX_SHADER)

app/src/main/java/joshuatee/wx/radar/UtilityTexture.kt

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ import android.graphics.Bitmap
5454
import android.opengl.GLES10
5555
import java.nio.ByteBuffer
5656
import java.nio.ByteOrder
57+
import java.nio.FloatBuffer
58+
import java.nio.ShortBuffer
5759
import javax.microedition.khronos.opengles.GL10
5860

5961

@@ -80,10 +82,70 @@ object UtilityTexture {
8082
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE.toFloat())
8183
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE.toFloat())
8284
val bitmap = BitmapFactory.decodeFile(imagefile, options)
83-
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0)
85+
if (bitmap != null) {
86+
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0)
87+
} else {
88+
Log.i(TAG, "bitmap is null")
89+
}
8490
return textures[0]
8591
}
8692

93+
private val VERTEX_COORDINATES = floatArrayOf(-1.0f, +1.0f, 0.0f, +1.0f, +1.0f, 0.0f, -1.0f, -1.0f, 0.0f, +1.0f, -1.0f, 0.0f)
94+
95+
private val TEXTURE_COORDINATES = floatArrayOf(0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f)
96+
97+
private val TEXCOORD_BUFFER = ByteBuffer.allocateDirect(TEXTURE_COORDINATES.size * 4)
98+
.order(ByteOrder.nativeOrder()).asFloatBuffer().put(TEXTURE_COORDINATES).rewind()
99+
private val VERTEX_BUFFER = ByteBuffer.allocateDirect(VERTEX_COORDINATES.size * 4)
100+
.order(ByteOrder.nativeOrder()).asFloatBuffer().put(VERTEX_COORDINATES).rewind()
101+
102+
103+
fun drawimage(gl: GL10, texture: Int) {
104+
gl.glActiveTexture(GL10.GL_TEXTURE0)
105+
gl.glBindTexture(GL10.GL_TEXTURE_2D, texture)
106+
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, VERTEX_BUFFER)
107+
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, TEXCOORD_BUFFER)
108+
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4)
109+
}
110+
111+
112+
113+
fun SetupImage(imagefile: String): Bitmap {
114+
var indices: ShortArray
115+
var uvs: FloatArray
116+
var uvBuffer: FloatBuffer
117+
// Create our UV coordinates.
118+
uvs = floatArrayOf(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f)
119+
// The texture buffer
120+
val bb = ByteBuffer.allocateDirect(uvs.size * 4)
121+
bb.order(ByteOrder.nativeOrder())
122+
uvBuffer = bb.asFloatBuffer()
123+
uvBuffer.put(uvs)
124+
uvBuffer.position(0)
125+
// Generate Textures, if more needed, alter these numbers.
126+
val texturenames = IntArray(1)
127+
GLES20.glGenTextures(1, texturenames, 0)
128+
// Temporary create a bitmap
129+
val options = BitmapFactory.Options()
130+
options.inScaled = false
131+
options.inPreferredConfig = Bitmap.Config.ARGB_8888
132+
val bmp = BitmapFactory.decodeFile(imagefile, options)
133+
// Bind texture to texturename
134+
GLES20.glActiveTexture(GLES20.GL_TEXTURE0)
135+
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texturenames[0])
136+
// Set filtering
137+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST)
138+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST)
139+
// Load the bitmap into the bound texture.
140+
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bmp, 0)
141+
142+
// We are done using the bitmap so we should recycle it.
143+
//bmp.recycle()
144+
return bmp
145+
146+
}
147+
148+
87149

88150
/*
89151

0 commit comments

Comments
 (0)