Ver código fonte

gpu: glGenerateMipmap is not available on the PS3, use glGenerateMipmapOES.

legacy
Sam Hocevar sam 11 anos atrás
pai
commit
9befaa5468
2 arquivos alterados com 154 adições e 0 exclusões
  1. +151
    -0
      src/gpu/renderer_private.h
  2. +3
    -0
      src/gpu/texture.cpp

+ 151
- 0
src/gpu/renderer_private.h Ver arquivo

@@ -0,0 +1,151 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

//
// The Renderer class
// ------------------
//

#if !defined __LOL_RENDERER_H__
#define __LOL_RENDERER_H__

namespace lol
{

class RendererData;

/* A safe enum to indicate the blending factors. */
struct BlendFunc
{
enum Value
{
Disabled,
Zero,
One,
SrcColor,
OneMinusSrcColor,
DstColor,
OneMinusDstColor,
SrcAlpha,
OneMinusSrcAlpha,
DstAlpha,
OneMinusDstAlpha,
ConstantColor,
OneMinusConstantColor,
ConstantAlpha,
OneMinusConstantAlpha,
}
m_value;

inline BlendFunc() : m_value(Zero) {}
inline BlendFunc(Value v) : m_value(v) {}
inline operator Value() { return m_value; }
};

/* A safe enum to indicate the face culling mode. */
struct CullMode
{
enum Value
{
Disabled,
Clockwise,
CounterClockwise,
}
m_value;

inline CullMode() : m_value(Disabled) {}
inline CullMode(Value v) : m_value(v) {}
inline operator Value() { return m_value; }
};

/* A safe enum to indicate the depth test mode. */
struct DepthFunc
{
enum Value
{
Disabled,
Never,
Less,
Equal,
LessOrEqual,
Greater,
NotEqual,
GreaterOrEqual,
Always,
}
m_value;

inline DepthFunc() : m_value(Disabled) {}
inline DepthFunc(Value v) : m_value(v) {}
inline operator Value() { return m_value; }
};

/* A safe enum to indicate the alpha test mode. */
struct AlphaFunc
{
enum Value
{
Disabled,
Never,
Less,
Equal,
LessOrEqual,
Greater,
NotEqual,
GreaterOrEqual,
Always,
}
m_value;

inline AlphaFunc() : m_value(Disabled) {}
inline AlphaFunc(Value v) : m_value(v) {}
inline operator Value() { return m_value; }
};

class Renderer
{
private:
/* Only the Video class can create a renderer for now. */
friend class Video;

Renderer();
~Renderer();

public:
void SetClearColor(vec4 color);
vec4 GetClearColor() const;

void SetClearDepth(float depth);
float GetClearDepth() const;

void SetAlphaFunc(AlphaFunc func, float alpha);
AlphaFunc GetAlphaFunc() const;
float GetAlphaValue() const;

void SetBlendFunc(BlendFunc src, BlendFunc dst);
BlendFunc GetBlendFuncSrc() const;
BlendFunc GetBlendFuncDst() const;

void SetDepthFunc(DepthFunc func);
DepthFunc GetDepthFunc() const;

void SetFaceCulling(CullMode mode);
CullMode GetFaceCulling() const;

private:
RendererData *m_data;
};

extern Renderer *g_renderer;

} /* namespace lol */

#endif // __LOL_RENDERER_H__


+ 3
- 0
src/gpu/texture.cpp Ver arquivo

@@ -295,6 +295,9 @@ void Texture::GenerateMipmaps()
{
#if defined _XBOX || defined USE_D3D9
m_data->m_texture->GenerateMipSubLevels();
#elif defined __CELLOS_LV2__
glBindTexture(GL_TEXTURE_2D, m_data->m_texture);
glGenerateMipmapOES(GL_TEXTURE_2D);
#else
glBindTexture(GL_TEXTURE_2D, m_data->m_texture);
glGenerateMipmap(GL_TEXTURE_2D);


Carregando…
Cancelar
Salvar