2011-10-25 05:03:10 +00:00
|
|
|
//
|
|
|
|
|
// KRTexture.h
|
2012-03-15 20:09:01 +00:00
|
|
|
// KREngine
|
2011-10-25 05:03:10 +00:00
|
|
|
//
|
2012-03-15 20:09:01 +00:00
|
|
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
2012-10-05 21:22:47 +00:00
|
|
|
//
|
2011-10-25 06:16:47 +00:00
|
|
|
// Redistribution and use in source and binary forms, with or without modification, are
|
|
|
|
|
// permitted provided that the following conditions are met:
|
2012-10-05 21:22:47 +00:00
|
|
|
//
|
2011-10-25 06:16:47 +00:00
|
|
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
|
|
|
// conditions and the following disclaimer.
|
2012-10-05 21:22:47 +00:00
|
|
|
//
|
2011-10-25 06:16:47 +00:00
|
|
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
|
|
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
|
|
|
|
// provided with the distribution.
|
2012-10-05 21:22:47 +00:00
|
|
|
//
|
2011-10-25 06:16:47 +00:00
|
|
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
|
|
|
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
|
|
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2012-10-05 21:22:47 +00:00
|
|
|
//
|
2011-10-25 06:16:47 +00:00
|
|
|
// The views and conclusions contained in the software and documentation are those of the
|
|
|
|
|
// authors and should not be interpreted as representing official policies, either expressed
|
|
|
|
|
// or implied, of Kearwood Gilbert.
|
2011-10-25 05:03:10 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef KRTEXTURE_H
|
|
|
|
|
#define KRTEXTURE_H
|
|
|
|
|
|
2012-10-05 21:50:47 +00:00
|
|
|
#import "KREngine-common.h"
|
2012-10-06 01:43:11 +00:00
|
|
|
#import "KRContextObject.h"
|
|
|
|
|
|
2012-10-05 21:22:47 +00:00
|
|
|
|
|
|
|
|
class KRDataBlock;
|
2012-09-11 03:06:35 +00:00
|
|
|
|
2012-10-06 01:43:11 +00:00
|
|
|
class KRTexture : public KRContextObject{
|
2011-10-25 05:03:10 +00:00
|
|
|
public:
|
2012-10-06 01:43:11 +00:00
|
|
|
KRTexture(KRContext &context);
|
2012-10-05 21:22:47 +00:00
|
|
|
virtual ~KRTexture();
|
2012-10-05 21:50:47 +00:00
|
|
|
|
2012-10-10 22:09:28 +00:00
|
|
|
virtual void bind(size_t &textureMemUsed, int max_dim, bool can_resize) = 0;
|
|
|
|
|
void releaseHandle(size_t &textureMemUsed);
|
2012-10-06 01:43:11 +00:00
|
|
|
long getMemSize();
|
2012-10-05 21:50:47 +00:00
|
|
|
|
|
|
|
|
|
2011-10-25 05:03:10 +00:00
|
|
|
|
2012-10-05 21:22:47 +00:00
|
|
|
protected:
|
2012-10-10 22:09:28 +00:00
|
|
|
virtual bool createGLTexture(int lod_max_dim) = 0;
|
|
|
|
|
GLuint getHandle(int max_dim, bool can_resize);
|
2012-10-06 01:43:11 +00:00
|
|
|
|
|
|
|
|
|
2012-10-10 22:09:28 +00:00
|
|
|
GLuint m_iHandle;
|
|
|
|
|
size_t m_textureMemUsed;
|
2012-10-06 01:43:11 +00:00
|
|
|
|
|
|
|
|
int m_current_lod_max_dim;
|
2011-10-25 05:03:10 +00:00
|
|
|
|
2012-10-06 01:43:11 +00:00
|
|
|
uint32_t m_max_lod_max_dim;
|
|
|
|
|
uint32_t m_min_lod_max_dim;
|
2011-10-25 05:03:10 +00:00
|
|
|
};
|
|
|
|
|
|
2012-10-05 21:22:47 +00:00
|
|
|
|
|
|
|
|
#endif /* defined(KRTEXTURE_H) */
|