-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f36a10f
commit b473da8
Showing
18 changed files
with
276 additions
and
68 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 0 additions & 38 deletions
38
app/src/main/java/io/github/kenneycode/fusion/demo/Util.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
libfusion/src/main/java/io/github/kenneycode/fusion/parameter/BitmapTexture2DParameter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.github.kenneycode.fusion.parameter | ||
|
||
import android.graphics.Bitmap | ||
import android.opengl.GLES20.* | ||
import android.util.Log | ||
import io.github.kenneycode.fusion.util.GLUtil | ||
import io.github.kenneycode.fusion.util.Util | ||
|
||
/** | ||
* | ||
* Coded by kenney | ||
* | ||
* http://www.github.com/kenneycode/fusion | ||
* | ||
* Bitmap shader uniform sampler2D 参数 | ||
* | ||
*/ | ||
|
||
class BitmapTexture2DParameter(key: String, private var value: Bitmap, index: Int) : Texture2DParameter(key, 0, index) { | ||
|
||
override fun onBind(location: Int) { | ||
Util.assert(!value.isRecycled) | ||
if (!glIsTexture(getValue() as Int)) { | ||
super.update(GLUtil.bitmap2Texture(value, true)) | ||
} | ||
super.onBind(location) | ||
} | ||
|
||
override fun update(value: Any) { | ||
(value as? Bitmap)?.let { | ||
if (this.value != it) { | ||
GLUtil.deleteTexture(getValue() as Int) | ||
} | ||
this.value = it | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.