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> 1849457ac092071a8f964f7f69156093657ccdc3d0Mathias Agopian#include "Texture.h" 193f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 203f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian#ifndef SF_RENDER_ENGINE_DESCRIPTION_H_ 213f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian#define SF_RENDER_ENGINE_DESCRIPTION_H_ 223f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 233f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopiannamespace android { 243f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 253f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopianclass Program; 263f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 273f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian/* 283f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * This holds the state of the rendering engine. This class is used 293f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * to generate a corresponding GLSL program and set the appropriate 303f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * uniform. 313f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * 323f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian * Program and ProgramCache are friends and access the state directly 333f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian */ 343f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopianclass Description { 353f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian friend class Program; 363f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian friend class ProgramCache; 373f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 383f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian // value of the plane-alpha, between 0 and 1 393f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian GLclampf mPlaneAlpha; 403f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian // whether textures are premultiplied 413f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian bool mPremultipliedAlpha; 423f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian // whether this layer is marked as opaque 433f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian bool mOpaque; 443f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 4549457ac092071a8f964f7f69156093657ccdc3d0Mathias Agopian // Texture this layer uses 4649457ac092071a8f964f7f69156093657ccdc3d0Mathias Agopian Texture mTexture; 4749457ac092071a8f964f7f69156093657ccdc3d0Mathias Agopian bool mTextureEnabled; 4849457ac092071a8f964f7f69156093657ccdc3d0Mathias Agopian 493f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian // color used when texturing is disabled 503f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian GLclampf mColor[4]; 513f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian // projection matrix 52a8c386f1c36e916c1df18d41a22104d655a89817Mathias Agopian mat4 mProjectionMatrix; 533f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 54ff2ed70fa30f04b90dd1a2c06ec2319e157152d7Mathias Agopian bool mColorMatrixEnabled; 55ff2ed70fa30f04b90dd1a2c06ec2319e157152d7Mathias Agopian mat4 mColorMatrix; 56ff2ed70fa30f04b90dd1a2c06ec2319e157152d7Mathias Agopian 573f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopianpublic: 583f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian Description(); 593f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian ~Description(); 603f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 613f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian void setPlaneAlpha(GLclampf planeAlpha); 623f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian void setPremultipliedAlpha(bool premultipliedAlpha); 633f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian void setOpaque(bool opaque); 6449457ac092071a8f964f7f69156093657ccdc3d0Mathias Agopian void setTexture(const Texture& texture); 653f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian void disableTexture(); 663f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian void setColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); 67a8c386f1c36e916c1df18d41a22104d655a89817Mathias Agopian void setProjectionMatrix(const mat4& mtx); 68ff2ed70fa30f04b90dd1a2c06ec2319e157152d7Mathias Agopian void setColorMatrix(const mat4& mtx); 69f008799d3753e52c10849824ff8146985ea66284Dan Stoza const mat4& getColorMatrix() const; 703f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 713f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopianprivate: 723f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian bool mUniformsDirty; 733f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian}; 743f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 753f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian} /* namespace android */ 763f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian 773f84483382be2d528918cc1a6fbc6a7d68e0b181Mathias Agopian#endif /* SF_RENDER_ENGINE_DESCRIPTION_H_ */ 78