Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
OpenGL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
C-Fu
OpenGL
Commits
37e9b86d
Commit
37e9b86d
authored
Jan 30, 2017
by
Anakin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug that sometimes alpha channel was not read in,
code improvement = performance,
parent
4342260e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
10 deletions
+8
-10
QtMeshViewer/Header/tga.h
QtMeshViewer/Header/tga.h
+8
-8
QtMeshViewer/Source/GeometryEngine.cpp
QtMeshViewer/Source/GeometryEngine.cpp
+0
-1
QtMeshViewer/Source/MshFile.cpp
QtMeshViewer/Source/MshFile.cpp
+0
-1
No files found.
QtMeshViewer/Header/tga.h
View file @
37e9b86d
...
...
@@ -3,7 +3,6 @@
#include <QImage>
#include <QColor>
#include "..\Header\Profiler.h"
QImage
loadTga
(
QString
filePath
,
bool
&
success
)
{
...
...
@@ -47,7 +46,7 @@ QImage loadTga(QString filePath, bool &success)
// jump to the data block
fsPicture
.
seekg
(
ui32IDLength
+
ui32PaletteLength
,
std
::
ios_base
::
cur
);
img
=
QImage
(
ui32Width
,
ui32Height
,
ui32BpP
==
32
?
QImage
::
Format_RGBA8888
:
QImage
::
Format_RGB
888
);
img
=
QImage
(
ui32Width
,
ui32Height
,
QImage
::
Format_RGBA8
888
);
// uncompressed
if
(
ui32PicType
==
2
&&
(
ui32BpP
==
24
||
ui32BpP
==
32
))
...
...
@@ -63,8 +62,11 @@ QImage loadTga(QString filePath, bool &success)
int
valr
=
vui8Pixels
.
at
(
y
*
ui32Width
*
ui32BpP
/
8
+
x
*
ui32BpP
/
8
+
2
);
int
valg
=
vui8Pixels
.
at
(
y
*
ui32Width
*
ui32BpP
/
8
+
x
*
ui32BpP
/
8
+
1
);
int
valb
=
vui8Pixels
.
at
(
y
*
ui32Width
*
ui32BpP
/
8
+
x
*
ui32BpP
/
8
);
int
vala
=
255
;
if
(
ui32BpP
==
32
)
vala
=
vui8Pixels
.
at
(
y
*
ui32Width
*
ui32BpP
/
8
+
x
*
ui32BpP
/
8
+
3
);
QColor
value
(
valr
,
valg
,
valb
);
QColor
value
(
valr
,
valg
,
valb
,
vala
);
img
.
setPixel
(
x
,
ui32Width
-
1
-
y
,
value
.
rgba
());
}
}
...
...
@@ -93,7 +95,7 @@ QImage loadTga(QString filePath, bool &success)
if
(
ui32BpP
==
32
)
color
.
setRgba
(
qRgba
(
tempData
[
2
],
tempData
[
1
],
tempData
[
0
],
tempData
[
3
]));
else
color
.
setRgb
(
qRgb
(
tempData
[
2
],
tempData
[
1
],
tempData
[
0
]
));
color
.
setRgb
a
(
qRgba
(
tempData
[
2
],
tempData
[
1
],
tempData
[
0
],
255
));
img
.
setPixel
(
tmp_pixelIndex
%
ui32Width
,
ui32Height
-
1
-
(
tmp_pixelIndex
/
ui32Width
),
color
.
rgba
());
tmp_pixelIndex
++
;
...
...
@@ -113,7 +115,7 @@ QImage loadTga(QString filePath, bool &success)
if
(
ui32BpP
==
32
)
color
.
setRgba
(
qRgba
(
tempData
[
2
],
tempData
[
1
],
tempData
[
0
],
tempData
[
3
]));
else
color
.
setRgb
(
qRgb
(
tempData
[
2
],
tempData
[
1
],
tempData
[
0
]
));
color
.
setRgb
a
(
qRgba
(
tempData
[
2
],
tempData
[
1
],
tempData
[
0
],
255
));
img
.
setPixel
(
tmp_pixelIndex
%
ui32Width
,
ui32Height
-
1
-
(
tmp_pixelIndex
/
ui32Width
),
color
.
rgba
());
tmp_pixelIndex
++
;
...
...
@@ -125,14 +127,12 @@ QImage loadTga(QString filePath, bool &success)
else
{
fsPicture
.
close
();
img
=
QImage
(
1
,
1
,
QImage
::
Format_RGB32
);
img
.
fill
(
Qt
::
red
);
success
=
false
;
return
img
;
}
fsPicture
.
close
();
success
=
true
;
return
img
;
}
QtMeshViewer/Source/GeometryEngine.cpp
View file @
37e9b86d
...
...
@@ -5,7 +5,6 @@
#include "..\Header\OutputDevice.h"
#include <QRegExp>
#include "../Header/Profiler.h"
/////////////////////////////////////////////////////////////////////////
// constructor/destructor
...
...
QtMeshViewer/Source/MshFile.cpp
View file @
37e9b86d
...
...
@@ -3,7 +3,6 @@
#include "..\Header\OutputDevice.h"
#include <QColor>
#include "..\Header\Profiler.h"
// helper function to save data from file to any variable type
#define F2V(variableName) reinterpret_cast<char*>(&variableName)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment