Skip to content

Commit 1489c8d

Browse files
committed
wasm: update environment texture loading method
1 parent ad3c8bf commit 1489c8d

File tree

9 files changed

+24
-11
lines changed

9 files changed

+24
-11
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python3
2+
from http.server import HTTPServer, SimpleHTTPRequestHandler, test
3+
import sys
4+
5+
class SimpleHTTPServer_SharedArrayBuffer (SimpleHTTPRequestHandler):
6+
def end_headers (self):
7+
self.send_header('Cross-Origin-Opener-Policy', 'same-origin')
8+
self.send_header('Cross-Origin-Embedder-Policy', 'require-corp')
9+
SimpleHTTPRequestHandler.end_headers(self)
10+
11+
if __name__ == '__main__':
12+
test(SimpleHTTPServer_SharedArrayBuffer, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000)

application/application.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ macx {
8888
QMAKE_BUNDLE_DATA += RESOURCE_FILES
8989
}
9090

91+
QMAKE_LFLAGS += -sFULL_ES3=1
92+
QMAKE_LFLAGS += -sASYNCIFY -Os
93+
9194
RESOURCES += resources.qrc
9295

9396
INCLUDEPATH += ../

application/shaders/model.frag

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#version 100
21
precision highp float;
32
precision highp int;
43
uniform sampler2D environmentIrradianceMapId[6];

application/shaders/model.vert

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#version 100
21
attribute vec4 vertex;
32
attribute vec3 normal;
43
attribute vec3 color;

application/shaders/monochrome.frag

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#version 100
21
precision highp float;
32
precision highp int;
43
varying vec3 pointPosition;

application/shaders/monochrome.vert

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#version 100
21
attribute vec4 vertex;
32
attribute vec3 color;
43
attribute float alpha;

application/sources/dds_file.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -488,13 +488,8 @@ std::unique_ptr<std::vector<std::unique_ptr<QOpenGLTexture>>> DdsFileReader::cre
488488
for (quint32 face = 0; face < faces; ++face) {
489489
for (quint32 level = 0; level < mipMapCount; ++level) {
490490
if (0 == layer && 0 == level) {
491-
QOpenGLTexture* texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
492-
texture->setMinificationFilter(QOpenGLTexture::NearestMipMapNearest);
493-
texture->setMagnificationFilter(QOpenGLTexture::Nearest);
494-
texture->setFormat(QOpenGLTexture::RGBA16F);
495-
texture->setSize(width, height, depth);
496-
texture->allocateStorage(QOpenGLTexture::RGBA, QOpenGLTexture::Float16);
497-
texture->setData(QOpenGLTexture::RGBA, QOpenGLTexture::Float16, data.constData() + dataOffset);
491+
QImage image((uchar *)(data.constData() + dataOffset), width, height, QImage::Format_RGBA16FPx4);
492+
QOpenGLTexture* texture = new QOpenGLTexture(image);
498493
textures->at(face).reset(texture);
499494
}
500495
dataOffset += calculateOneFaceSizeAtLevel(level);

application/sources/document_window.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,8 @@ void DocumentWindow::checkExportWaitingList()
11681168

11691169
void DocumentWindow::generateComponentPreviewImages()
11701170
{
1171+
return;
1172+
11711173
if (nullptr != m_componentPreviewImagesGenerator) {
11721174
m_isComponentPreviewImagesObsolete = true;
11731175
return;

application/sources/main.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ int main(int argc, char* argv[])
1313
{
1414
QApplication app(argc, argv);
1515

16+
QSurfaceFormat format;
17+
format.setDepthBufferSize(24);
18+
format.setSamples(4);
19+
QSurfaceFormat::setDefaultFormat(format);
20+
1621
//QSurfaceFormat format = QSurfaceFormat::defaultFormat();
1722
//format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
1823
//format.setVersion(3, 3);

0 commit comments

Comments
 (0)