Oolite
Loading...
Searching...
No Matches
OOPixMapTextureLoader Class Reference

#include <OOPixMapTextureLoader.h>

Inheritance diagram for OOPixMapTextureLoader:
Collaboration diagram for OOPixMapTextureLoader:

Instance Methods

(id) - initWithPixMap:textureOptions:freeWhenDone:
(void) - dealloc [implementation]
(void) - loadTexture [implementation]
(uint32_t) - textureOptions [implementation]
Instance Methods inherited from OOTextureGenerator
(GLfloat) - anisotropy
(GLfloat) - lodBias
(NSString *) - cacheKey
(BOOL) - enqueue
Instance Methods inherited from OOTextureLoader
(BOOL) - isReady
(BOOL) - getResult:format:originalWidth:originalHeight:
(id) - initWithPath:options:
(NSString *) - path
(NSString *) - descriptionComponents [implementation]
(NSString *) - shortDescriptionComponents [implementation]
(void) - performAsyncTask [implementation]
(void) - generateMipMapsForCubeMap [implementation]
(void) - applySettings [implementation]
(void) - getDesiredWidth:andHeight: [implementation]
(void) - completeAsyncTask [implementation]

Private Attributes

OOPixMap _pixMap
uint32_t _texOptions

Additional Inherited Members

Class Methods inherited from OOTextureLoader
(id) + loaderWithPath:options:
(id) + loaderWithTextureSpecifier:extraOptions:folder:
(void) + setUp [implementation]
Protected Attributes inherited from OOTextureLoader
NSString * _path
OOTextureFlags _options
uint8_t _generateMipMaps: 1
uint8_t _scaleAsNormalMap: 1
uint8_t _avoidShrinking: 1
uint8_t _noScalingWhatsoever: 1
uint8_t _extractChannel: 1
uint8_t _allowCubeMap: 1
uint8_t _isCubeMap: 1
uint8_t _ready: 1
uint8_t _extractChannelIndex
OOTextureDataFormat _format
void * _data
uint32_t _width
uint32_t _height
uint32_t _originalWidth
uint32_t _originalHeight
uint32_t _shrinkThreshold
uint32_t _maxSize
size_t _rowBytes

Detailed Description

Definition at line 33 of file OOPixMapTextureLoader.h.

Method Documentation

◆ dealloc

- (void) dealloc
implementation

Reimplemented from OOTextureLoader.

Definition at line 50 of file OOPixMapTextureLoader.m.

51{
53
54 [super dealloc];
55}
void OOFreePixMap(OOPixMap *ioPixMap)
Definition OOPixMap.m:80

References _pixMap, dealloc, OOTextureLoader::dealloc, and OOFreePixMap().

Referenced by dealloc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initWithPixMap:textureOptions:freeWhenDone:

- (id) initWithPixMap: (OOPixMap) pixMap
textureOptions: (uint32_t) options
freeWhenDone: (BOOL) freeWhenDone 

Definition at line 33 of file OOPixMapTextureLoader.m.

33 :(OOPixMap)pixMap textureOptions:(uint32_t)options freeWhenDone:(BOOL)freeWhenDone
34{
35 if ((self = [super initWithPath:[NSString stringWithFormat:@"OOPixMap@%p", self] options:options])) {
36 if (freeWhenDone)
37 _pixMap = pixMap;
38 else
40
42
44 DESTROY(self);
45 }
46
47 return self;
48}
#define DESTROY(x)
BOOL OOIsValidPixMap(OOPixMap pixMap)
Definition OOPixMap.m:39
OOPixMap OODuplicatePixMap(OOPixMap srcPixMap, size_t desiredSize)
Definition OOPixMap.m:89
struct OOPixMap OOPixMap
OOTextureFlags OOApplyTextureOptionDefaults(OOTextureFlags options)
Definition OOTexture.m:819

References _pixMap, _texOptions, DESTROY, OOApplyTextureOptionDefaults(), OODuplicatePixMap(), and OOIsValidPixMap().

Here is the call graph for this function:

◆ loadTexture

- (void) loadTexture
implementation

Reimplemented from OOTextureLoader.

Definition at line 57 of file OOPixMapTextureLoader.m.

58{
59 // Generate mip maps if needed.
61 size_t size = OOMinimumPixMapBufferSize(_pixMap) * 4 / 3;
62 BOOL generateMipMaps = OOExpandPixMap(&_pixMap, size);
63 if (generateMipMaps) {
64 OOGenerateMipMaps(_pixMap.pixels, _pixMap.width, _pixMap.height, _pixMap.format);
65 } else {
66 _texOptions = (_texOptions & ~kOOTextureMinFilterMask) | kOOTextureMinFilterMipMap;
67 }
68 }
69
70 // Set up output ivars as per OOTextureLoader contract.
71 _data = _pixMap.pixels;
72 _width = _pixMap.width;
73 _height = _pixMap.height;
74 _rowBytes = _pixMap.rowBytes;
75 _format = _pixMap.format;
76
77 // Explicitly do not free pixels - ownership passes to texture.
78 _pixMap.pixels = NULL;
79}
OOINLINE size_t OOMinimumPixMapBufferSize(OOPixMap pixMap)
Definition OOPixMap.h:55
BOOL OOExpandPixMap(OOPixMap *ioPixMap, size_t desiredSize)
Definition OOPixMap.m:125
BOOL OOGenerateMipMaps(void *textureBytes, OOPixMapDimension width, OOPixMapDimension height, OOPixMapFormat format)
@ kOOTextureMinFilterMask
Definition OOTexture.h:72
@ kOOTextureMinFilterMipMap
Definition OOTexture.h:48
OOTextureDataFormat _format
voidpf void uLong size
Definition ioapi.h:126

References OOTextureLoader::_data, OOTextureLoader::_format, OOTextureLoader::_height, _pixMap, OOTextureLoader::_rowBytes, _texOptions, OOTextureLoader::_width, kOOTextureMinFilterMask, kOOTextureMinFilterMipMap, loadTexture, OOExpandPixMap(), OOGenerateMipMaps(), and OOMinimumPixMapBufferSize().

Referenced by loadTexture.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textureOptions

- (uint32_t) textureOptions
implementation

Reimplemented from OOTextureGenerator.

Definition at line 81 of file OOPixMapTextureLoader.m.

82{
83 return _texOptions;
84}

References _texOptions, and textureOptions.

Referenced by textureOptions.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _pixMap

- (OOPixMap) _pixMap
private

◆ _texOptions

- (uint32_t) _texOptions
private

The documentation for this class was generated from the following files: