opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
liboscar
formats
image_loading_flags.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
liboscar/utilities/flags.h
>
4
5
namespace
osc
6
{
7
// Represents a flag that affects how an image is loaded from disk.
8
enum class
ImageLoadingFlag
{
9
None
= 0,
10
11
// Makes the image loading implementation flip the image vertically.
12
//
13
// By default, the image-loading implementation will load image data according
14
// to the underlying data format (e.g. PNG, JPEG) and then adjust it to follow
15
// liboscar's internal format (right-handed, bottom-to-top). This flag causes
16
// the implementation to flip the final adjusted image such that, the returned
17
// image is flipped vertically.
18
//
19
// BEWARE: This will flip pixels vertically (in Y) but leaves the pixel's components
20
// (e.g. RGB) untouched. That's fine if the pixels represent colors, but can
21
// cause surprising behavior if the pixels represent vectors (e.g. normal maps).
22
//
23
// Therefore, if you are flipping (e.g.) normal maps, you may *also* need to flip
24
// the pixel content appropriately. If RGB represents XYZ vectors then you might
25
// need to negate each G.
26
FlipVertically
= 1<<0,
27
28
// Makes the image loading implementation handle the image's components as-if they were
29
// spatial vectors.
30
//
31
// By default, the image-loading implementation will load image data according to the
32
// underlying data format (e.g. PNG, JPEG) and then adjust it to follow liboscar's internal
33
// format (right-handed, bottom-to-top). The adjustment may require internally flipping the
34
// image (e.g. because PNG's are encoded top-to-bottom), which is problematic if the pixels
35
// encode vectors because the flipping operation mirrors the coordinate space that the pixels
36
// are encoded in. To fix that, the implementation needs to flip the green (Y) component of
37
// each pixel in the image. It shouldn't perform this fix if the pixels encode colors, though,
38
// which is why this flag is necessary.
39
//
40
// NOTE: This assumes that the encoded vectors are right-handed in the first place, because
41
// that is how liboscar defines tangent space. If the vectors are left-handed (e.g.
42
// because you baked the texture in Unreal Engine or 3ds Max) then you should _also_
43
// manually negate the green components in shaders, or memory.
44
//
45
// - see: http://wiki.polycount.com/wiki/Normal_Map_Technical_Details
46
TreatComponentsAsSpatialVectors
= 1<<1,
47
};
48
using
ImageLoadingFlags
=
Flags<ImageLoadingFlag>
;
49
}
osc::Flags
Definition
flags.h:20
flags.h
osc
Definition
custom_decoration_generator.h:5
osc::ImageLoadingFlag
ImageLoadingFlag
Definition
image_loading_flags.h:8
osc::ImageLoadingFlag::TreatComponentsAsSpatialVectors
@ TreatComponentsAsSpatialVectors
osc::ImageLoadingFlag::FlipVertically
@ FlipVertically
osc::ImageLoadingFlag::None
@ None
Generated by
1.9.8