rsProgramVertex.h revision 383e5b1f68c321a77bfd7466fa1171a9bfab4a6f
1/* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef ANDROID_RS_PROGRAM_VERTEX_H 18#define ANDROID_RS_PROGRAM_VERTEX_H 19 20#include "rsProgram.h" 21 22// --------------------------------------------------------------------------- 23namespace android { 24namespace renderscript { 25 26class ProgramVertexState; 27 28class ProgramVertex : public Program 29{ 30public: 31 ProgramVertex(Context *,const char * shaderText, uint32_t shaderLength, 32 const uint32_t * params, uint32_t paramLength); 33 virtual ~ProgramVertex(); 34 35 virtual void setupGL2(Context *rsc, ProgramVertexState *state, ShaderCache *sc); 36 37 void setProjectionMatrix(Context *, const rsc_Matrix *) const; 38 void getProjectionMatrix(Context *, rsc_Matrix *) const; 39 void setModelviewMatrix(Context *, const rsc_Matrix *) const; 40 void setTextureMatrix(Context *, const rsc_Matrix *) const; 41 42 void transformToScreen(Context *, float *v4out, const float *v3in) const; 43 44 virtual void createShader(); 45 virtual void loadShader(Context *); 46 virtual void init(Context *); 47 48 virtual void serialize(OStream *stream) const; 49 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_VERTEX; } 50 static ProgramVertex *createFromStream(Context *rsc, IStream *stream); 51}; 52 53 54class ProgramVertexState 55{ 56public: 57 ProgramVertexState(); 58 ~ProgramVertexState(); 59 60 void init(Context *rsc); 61 void deinit(Context *rsc); 62 void updateSize(Context *rsc); 63 64 ObjectBaseRef<ProgramVertex> mDefault; 65 ObjectBaseRef<ProgramVertex> mLast; 66 ObjectBaseRef<Allocation> mDefaultAlloc; 67}; 68 69 70} 71} 72#endif 73 74 75