Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fadecandy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scanlime
Fadecandy
Commits
353969cd
Commit
353969cd
authored
11 years ago
by
Micah Elizabeth Scott
Browse files
Options
Downloads
Patches
Plain Diff
Big-endian portability fix
Tested on MIPS OpenWRT router
parent
fe637308
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/cpp/lib/texture.h
+7
-7
7 additions, 7 deletions
examples/cpp/lib/texture.h
with
7 additions
and
7 deletions
examples/cpp/lib/texture.h
+
7
−
7
View file @
353969cd
...
...
@@ -53,7 +53,7 @@ public:
Vec3
sample
(
float
x
,
float
y
);
// Raw sampling, integer pixel coordinates.
uint
32
_t
sampleIntRGBA32
(
int
x
,
int
y
);
uint
8
_t
*
sampleIntRGBA32
(
int
x
,
int
y
);
Vec3
sampleInt
(
int
x
,
int
y
);
private:
...
...
@@ -130,7 +130,7 @@ inline bool Texture::isLoaded()
return
width
&&
height
;
}
inline
uint
32
_t
Texture
::
sampleIntRGBA32
(
int
x
,
int
y
)
inline
uint
8
_t
*
Texture
::
sampleIntRGBA32
(
int
x
,
int
y
)
{
if
(
!
isLoaded
())
{
return
0
;
...
...
@@ -138,16 +138,16 @@ inline uint32_t Texture::sampleIntRGBA32(int x, int y)
x
=
std
::
max
<
int
>
(
0
,
std
::
min
<
int
>
(
width
-
1
,
x
));
y
=
std
::
max
<
int
>
(
0
,
std
::
min
<
int
>
(
height
-
1
,
y
));
return
((
uint32_t
*
)(
&
pixels
[
0
]))[
x
+
y
*
width
];
return
&
pixels
[
(
x
+
y
*
width
)
<<
2
];
}
inline
Vec3
Texture
::
sampleInt
(
int
x
,
int
y
)
{
uint
32
_t
rgba
=
sampleIntRGBA32
(
x
,
y
);
uint
8
_t
*
rgba
=
sampleIntRGBA32
(
x
,
y
);
return
Vec3
(
(
(
rgba
)
&
0xFF
)
/
255.0
f
,
(
(
rgba
>>
8
)
&
0xFF
)
/
255.0
f
,
(
(
rgba
>>
16
)
&
0xFF
)
/
255.0
f
);
(
rgba
[
0
]
&
0xFF
)
/
255.0
f
,
(
rgba
[
1
]
&
0xFF
)
/
255.0
f
,
(
rgba
[
2
]
&
0xFF
)
/
255.0
f
);
}
inline
Vec3
Texture
::
sample
(
Vec2
texcoord
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment