Merge pull request #21 from luzpaz/typos
Fix misc. typos
Assiduous authored 2 years ago
GitHub committed 2 years ago
0 | 0 | # Asset Loader |
1 | 1 | |
2 | The asset loading libary currently supports GLTF 2.0 format. | |
2 | The asset loading library currently supports GLTF 2.0 format. | |
3 | 3 | |
4 | 4 | ## GLTF 2.0 |
5 | 5 |
219 | 219 | if (pSkin != nullptr) |
220 | 220 | { |
221 | 221 | // Update join matrices |
222 | auto InverseTransform = pMesh->Transforms.matrix.Inverse(); // TODO: do not use inverse tranform here | |
222 | auto InverseTransform = pMesh->Transforms.matrix.Inverse(); // TODO: do not use inverse transform here | |
223 | 223 | if (pMesh->Transforms.jointMatrices.size() != pSkin->Joints.size()) |
224 | 224 | pMesh->Transforms.jointMatrices.resize(pSkin->Joints.size()); |
225 | 225 | for (size_t i = 0; i < pSkin->Joints.size(); i++) |
122 | 122 | m_ShaderType = SHADER_TYPE_COMPUTE; |
123 | 123 | else |
124 | 124 | { |
125 | LOG_ERROR_MESSAGE("Unknow shader type ", argv[a], "; Allowed values: vs,gs,ps,ds,hs,cs"); | |
125 | LOG_ERROR_MESSAGE("Unknown shader type ", argv[a], "; Allowed values: vs,gs,ps,ds,hs,cs"); | |
126 | 126 | return -1; |
127 | 127 | } |
128 | 128 | } |
136 | 136 | } |
137 | 137 | else |
138 | 138 | { |
139 | LOG_ERROR_MESSAGE("Unknow command line option ", argv[a]); | |
139 | LOG_ERROR_MESSAGE("Unknown command line option ", argv[a]); | |
140 | 140 | return -1; |
141 | 141 | } |
142 | 142 | } |
1092 | 1092 | void *context, |
1093 | 1093 | ArAvailability *out_availability); |
1094 | 1094 | |
1095 | /// Initiates installation of ARCore if needed. When your apllication launches | |
1095 | /// Initiates installation of ARCore if needed. When your application launches | |
1096 | 1096 | /// or enters an AR mode, it should call this method with @c |
1097 | 1097 | /// user_requested_install = 1. |
1098 | 1098 | /// |
1995 | 1995 | /// @param[in] session The ARCore session |
1996 | 1996 | /// @param[in] pose The pose to convert |
1997 | 1997 | /// @param[out] out_matrix_col_major_4x4 Pointer to an array of 16 floats, to be |
1998 | /// filled with a column-major homogenous transformation matrix, as used by | |
1998 | /// filled with a column-major homogeneous transformation matrix, as used by | |
1999 | 1999 | /// OpenGL. |
2000 | 2000 | void ArPose_getMatrix(const ArSession *session, |
2001 | 2001 | const ArPose *pose, |
2075 | 2075 | /// @param[in] session The ARCore session |
2076 | 2076 | /// @param[in] camera The session's camera. |
2077 | 2077 | /// @param[inout] out_col_major_4x4 Pointer to an array of 16 floats, to be |
2078 | /// filled with a column-major homogenous transformation matrix, as used by | |
2078 | /// filled with a column-major homogeneous transformation matrix, as used by | |
2079 | 2079 | /// OpenGL. |
2080 | 2080 | void ArCamera_getViewMatrix(const ArSession *session, |
2081 | 2081 | const ArCamera *camera, |
2121 | 2121 | /// @param[in] near Specifies the near clip plane, in meters |
2122 | 2122 | /// @param[in] far Specifies the far clip plane, in meters |
2123 | 2123 | /// @param[inout] dest_col_major_4x4 Pointer to an array of 16 floats, to |
2124 | /// be filled with a column-major homogenous transformation matrix, as used | |
2124 | /// be filled with a column-major homogeneous transformation matrix, as used | |
2125 | 2125 | /// by OpenGL. |
2126 | 2126 | void ArCamera_getProjectionMatrix(const ArSession *session, |
2127 | 2127 | const ArCamera *camera, |
224 | 224 | /* |
225 | 225 | * Retrieve external file directory through JNI call |
226 | 226 | * |
227 | * return: std::string containing external file diretory | |
227 | * return: std::string containing external file directory | |
228 | 228 | */ |
229 | 229 | std::string GetExternalFilesDir(); |
230 | 230 |
211 | 211 | } |
212 | 212 | |
213 | 213 | //---------------------------------------------------------- |
214 | // Pinch controll | |
214 | // Pinch control | |
215 | 215 | //---------------------------------------------------------- |
216 | 216 | void TapCamera::BeginPinch(const Vec2& v1, const Vec2& v2) { |
217 | 217 | if (dragging_) EndDrag(); |
288 | 288 | } |
289 | 289 | |
290 | 290 | //---------------------------------------------------------- |
291 | // Trackball controll | |
291 | // Trackball control | |
292 | 292 | //---------------------------------------------------------- |
293 | 293 | void TapCamera::BallUpdate() { |
294 | 294 | if (dragging_) { |
89 | 89 | { |
90 | 90 | [super prepareOpenGL]; |
91 | 91 | |
92 | // Application must be initialized befor display link is started | |
92 | // Application must be initialized before display link is started | |
93 | 93 | [self initGL]; |
94 | 94 | |
95 | 95 | CVDisplayLinkRef displayLink; |
147 | 147 | // cost of framerate and battery life due to the GPU needing to render more |
148 | 148 | // pixels. |
149 | 149 | |
150 | // Any calculations the renderer does which use pixel dimentions, must be | |
150 | // Any calculations the renderer does which use pixel dimensions, must be | |
151 | 151 | // in "retina" space. [NSView convertRectToBacking] converts point sizes |
152 | 152 | // to pixel sizes. Thus the renderer gets the size in pixels, not points, |
153 | 153 | // so that it can set it's viewport and perform and other pixel based |
117 | 117 | // this controller (self) |
118 | 118 | [self setWindow:[self standardWindow]]; |
119 | 119 | |
120 | // Set the content of the orginal window to the view | |
120 | // Set the content of the original window to the view | |
121 | 121 | [[self window] setContentView: [self fullscreenWindow].contentView]; |
122 | 122 | |
123 | 123 | // Show the window and make it the key window for input |
84 | 84 | // Set it to our _animationFrameInterval |
85 | 85 | [_displayLink setPreferredFramesPerSecond:_preferredFramesPerSecond]; |
86 | 86 | |
87 | // Have the display link run on the default runn loop (and the main thread) | |
87 | // Have the display link run on the default run loop (and the main thread) | |
88 | 88 | [_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; |
89 | 89 | |
90 | 90 | [super startAnimation]; |
109 | 109 | /// Called by the framework to request the desired initial window size. |
110 | 110 | |
111 | 111 | /// This method is called before the platform-specific window is created. |
112 | /// An application may override this method to speciy required initial | |
112 | /// An application may override this method to specify required initial | |
113 | 113 | /// window width and height. |
114 | 114 | virtual void GetDesiredInitialWindowSize(int& width, int& height) |
115 | 115 | { |
55 | 55 | public: |
56 | 56 | /// Called when GL context is initialized |
57 | 57 | |
58 | /// An application must override this method to perform requred | |
58 | /// An application must override this method to perform required | |
59 | 59 | /// initialization operations after OpenGL context has been initialized |
60 | 60 | /// by the framework |
61 | 61 | /// \param [in] display - XLib display. |
76 | 76 | } |
77 | 77 | #else |
78 | 78 | |
79 | # error Usnupported paltform | |
79 | # error Usnupported platform | |
80 | 80 | |
81 | 81 | #endif |
82 | 82 |
51 | 51 | // Notifies the app that it is being suspended. |
52 | 52 | virtual void OnSuspending() {} |
53 | 53 | |
54 | // Notifes the app that it is no longer suspended. | |
54 | // Notifies the app that it is no longer suspended. | |
55 | 55 | virtual void OnResuming() {} |
56 | 56 | |
57 | 57 | // Notifies renderers that device resources need to be released. |
2 | 2 | This module implements additional functionality on top of the [Diligent Engine](https://github.com/DiligentGraphics/DiligentEngine)'s core module |
3 | 3 | and contains the following libraries: |
4 | 4 | |
5 | * [Texture loader](TextureLoader): a texture loading libary. The following formats are currently supported: jpg, png, tiff, dds, ktx. | |
6 | * [Asset Loader](AssetLoader): an asset loading libary. The library currently supports GLTF 2.0. | |
5 | * [Texture loader](TextureLoader): a texture loading library. The following formats are currently supported: jpg, png, tiff, dds, ktx. | |
6 | * [Asset Loader](AssetLoader): an asset loading library. The library currently supports GLTF 2.0. | |
7 | 7 | * To enable Draco compression, download [Draco repository](https://github.com/google/draco) and include it into |
8 | 8 | your project. Make sure that Draco source folder is processed by CMake *before* DiligentTools folder. |
9 | 9 | Alternatively, you can specify a path to the Draco installation folder using `DRACO_PATH` CMake variable. |
47 | 47 | and you agree that the content is free of any Intellectual Property claims and you have the right to license it under those terms. |
48 | 48 | |
49 | 49 | Diligent Engine uses [clang-format](https://clang.llvm.org/docs/ClangFormat.html) to ensure |
50 | consistent source code style throught the code base. The format is validated by appveyor and travis | |
50 | consistent source code style throughout the code base. The format is validated by appveyor and travis | |
51 | 51 | for each commit and pull request, and the build will fail if any code formatting issue is found. Please refer |
52 | 52 | to [this page](https://github.com/DiligentGraphics/DiligentCore/blob/master/doc/code_formatting.md) for instructions |
53 | 53 | on how to set up clang-format and automatic code formatting. |
33 | 33 | /// PNG decoding result. |
34 | 34 | DILIGENT_TYPED_ENUM(DECODE_PNG_RESULT, Uint32) |
35 | 35 | { |
36 | /// Decoding was successfull. | |
36 | /// Decoding was successful. | |
37 | 37 | DECODE_PNG_RESULT_OK = 0, |
38 | 38 | |
39 | 39 | /// Invalid arguments (e.g. null pointer). |
484 | 484 | case DXGI_FORMAT_BC7_UNORM: return TEX_FORMAT_BC7_UNORM; |
485 | 485 | case DXGI_FORMAT_BC7_UNORM_SRGB: return TEX_FORMAT_BC7_UNORM_SRGB; |
486 | 486 | |
487 | default: UNEXPECTED( "Unsupported DXGI formate" ); return TEX_FORMAT_UNKNOWN; | |
487 | default: UNEXPECTED( "Unsupported DXGI format" ); return TEX_FORMAT_UNKNOWN; | |
488 | 488 | } |
489 | 489 | } |
490 | 490 | |
618 | 618 | // No DXGI format maps to ISBITMASK(0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000) aka D3DFMT_X8B8G8R8 |
619 | 619 | |
620 | 620 | // Note that many common DDS reader/writers (including D3DX) swap the |
621 | // the RED/BLUE masks for 10:10:10:2 formats. We assumme | |
621 | // the RED/BLUE masks for 10:10:10:2 formats. We assume | |
622 | 622 | // below that the 'backwards' header mask is being used since it is most |
623 | 623 | // likely written by D3DX. The more robust solution is to use the 'DX10' |
624 | 624 | // header extension and specify the DXGI_FORMAT_R10G10B10A2_UNORM format directly |
158 | 158 | //Array of row pointers. One for every row. |
159 | 159 | rowPtrs = malloc(sizeof(png_bytep) * pDstImgDesc->Height); |
160 | 160 | |
161 | //Alocate a buffer with enough space. | |
161 | //Allocate a buffer with enough space. | |
162 | 162 | pDstImgDesc->RowStride = pDstImgDesc->Width * (Uint32)bit_depth * pDstImgDesc->NumComponents / 8u; |
163 | 163 | // Align stride to 4 bytes |
164 | 164 | pDstImgDesc->RowStride = (pDstImgDesc->RowStride + 3u) & ~3u; |
168 | 168 | for (size_t i = 0; i < pDstImgDesc->Height; i++) |
169 | 169 | rowPtrs[i] = pRow0 + i * pDstImgDesc->RowStride; |
170 | 170 | |
171 | //Read the imagedata and write it to the adresses pointed to | |
171 | //Read the imagedata and write it to the addresses pointed to | |
172 | 172 | //by rowptrs (in other words: our image databuffer) |
173 | 173 | png_read_image(png, rowPtrs); |
174 | 174 |