Description.h revision 3f84483382be2d528918cc1a6fbc6a7d68e0b181
13f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian/*
23f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * Copyright 2013 The Android Open Source Project
33f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian *
43f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
53f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * you may not use this file except in compliance with the License.
63f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * You may obtain a copy of the License at
73f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian *
83f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
93f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian *
103f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * Unless required by applicable law or agreed to in writing, software
113f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
123f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * See the License for the specific language governing permissions and
143f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * limitations under the License.
153f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian */
163f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
173f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian#include <GLES2/gl2.h>
183f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
193f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian#ifndef SF_RENDER_ENGINE_DESCRIPTION_H_
203f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian#define SF_RENDER_ENGINE_DESCRIPTION_H_
213f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
223f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopiannamespace android {
233f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
243f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopianclass Program;
253f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
263f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian/*
273f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * This holds the state of the rendering engine. This class is used
283f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * to generate a corresponding GLSL program and set the appropriate
293f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * uniform.
303f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian *
313f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * Program and ProgramCache are friends and access the state directly
323f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian */
333f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopianclass Description {
343f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    friend class Program;
353f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    friend class ProgramCache;
363f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
373f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    // value of the plane-alpha, between 0 and 1
383f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    GLclampf mPlaneAlpha;
393f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    // whether textures are premultiplied
403f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    bool mPremultipliedAlpha;
413f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    // whether this layer is marked as opaque
423f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    bool mOpaque;
433f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    // texture target, TEXTURE_2D or TEXTURE_EXTERNAL
443f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    GLenum mTextureTarget;
453f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
463f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    // name of the texture
473f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    GLuint mTextureName;
483f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    // color used when texturing is disabled
493f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    GLclampf mColor[4];
503f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    // projection matrix
513f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    GLfloat mProjectionMatrix[16];
523f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    // texture matrix
533f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    GLfloat mTextureMatrix[16];
543f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
553f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopianpublic:
563f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    Description();
573f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    ~Description();
583f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
593f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    void setPlaneAlpha(GLclampf planeAlpha);
603f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    void setPremultipliedAlpha(bool premultipliedAlpha);
613f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    void setOpaque(bool opaque);
623f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    void setTextureName(GLenum target, GLuint tname);
633f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    void disableTexture();
643f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    void setColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
653f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    void setProjectionMatrix(GLfloat const* mtx);
663f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    void setTextureMatrix(GLfloat const* mtx);
673f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
683f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopianprivate:
693f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian    bool mUniformsDirty;
703f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian};
713f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
723f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian} /* namespace android */
733f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian
743f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian#endif /* SF_RENDER_ENGINE_DESCRIPTION_H_ */
75