This file contains hidden or 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
| android { | |
| sourceSets { | |
| main.jni.srcDirs = ['../../cpp'] | |
| main.assets.srcDirs = ['../../assets'] | |
| } | |
| } |
This file contains hidden or 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
| public class Helper { | |
| private static Context context; | |
| public static void setContext(Context c) { context = c; } | |
| public static byte[] loadIntoBytes(String fileName) { | |
| AssetManager assetManager = context.getAssets(); | |
| try { | |
| InputStream is = assetManager.open(fileName); | |
| byte buf[] = new byte[is.available()]; | |
| is.read(buf); |
This file contains hidden or 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
| class Helper { | |
| ... | |
| public static int loadTexture(String s){ | |
| Bitmap img; | |
| try { | |
| img = BitmapFactory.decodeStream(context.getAssets().open(s)); | |
| } catch (IOException e) { | |
| return -1; |
This file contains hidden or 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
| namespace Gdiplus { | |
| using std::min; | |
| using std::max; | |
| } | |
| #include <gdiplus.h> | |
| #pragma comment(lib, "gdiplus.lib") | |
| static GLuint LoadTextureViaOS(const char* name) | |
| { | |
| Gdiplus::GdiplusStartupInput gdiplusStartupInput; |
This file contains hidden or 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
| // HLSL (DirectX11) | |
| cbuffer MyContantBuffer : register(b2) | |
| { | |
| float4x4 matW; | |
| } |
This file contains hidden or 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
| // DirectX11 | |
| #define POS 2 | |
| pDeviceContext->VSSetConstantBuffers(POS, 1, &buffer); |
This file contains hidden or 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
| #define POS 2 | |
| glUniformBlockBinding(program, glGetUniformBlockIndex(program, "MyUBO"), POS); |
This file contains hidden or 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
| uniform vec4 uniformBuffer[9]; | |
| void main() { | |
| mat4 matV = mat4(uniformBuffer[0], uniformBuffer[1], uniformBuffer[2], uniformBuffer[3]); | |
| mat4 matP = mat4(uniformBuffer[4], uniformBuffer[5], uniformBuffer[6], uniformBuffer[7]); | |
| float etc1 = uniformBuffer[8].x; | |
| float etc2 = uniformBuffer[8].y; | |
| float etc3 = uniformBuffer[8].z; | |
| } |
This file contains hidden or 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
| call gradlew build | |
| pause |
This file contains hidden or 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
| double GetTime() | |
| { | |
| timespec t; | |
| clock_gettime(CLOCK_MONOTONIC, &t); | |
| return (double)t.tv_sec + (double)t.tv_nsec / 1000000000; | |
| } |