• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // ---------------------------------------------------------------------------
23 namespace android {
24 namespace renderscript {
25 
26 class ProgramVertexState;
27 
28 class ProgramVertex : public Program
29 {
30 public:
31     const static uint32_t MAX_LIGHTS = 8;
32 
33     ProgramVertex(Context *, Element *in, Element *out);
34     virtual ~ProgramVertex();
35 
36     virtual void setupGL(const Context *rsc, ProgramVertexState *state);
37 
38 
setTextureMatrixEnable(bool e)39     void setTextureMatrixEnable(bool e) {mTextureMatrixEnable = e;}
40     void addLight(const Light *);
41 
42     void setProjectionMatrix(const rsc_Matrix *) const;
43     void setModelviewMatrix(const rsc_Matrix *) const;
44     void setTextureMatrix(const rsc_Matrix *) const;
45 
46     void transformToScreen(const Context *, float *v4out, const float *v3in) const;
47 
48 
49 protected:
50     uint32_t mLightCount;
51     ObjectBaseRef<const Light> mLights[MAX_LIGHTS];
52 
53     // Hacks to create a program for now
54     bool mTextureMatrixEnable;
55 };
56 
57 
58 class ProgramVertexState
59 {
60 public:
61     ProgramVertexState();
62     ~ProgramVertexState();
63 
64     void init(Context *rsc, int32_t w, int32_t h);
65     void deinit(Context *rsc);
66     void updateSize(Context *rsc, int32_t w, int32_t h);
67 
68     ObjectBaseRef<ProgramVertex> mDefault;
69     ObjectBaseRef<ProgramVertex> mLast;
70     ObjectBaseRef<Allocation> mDefaultAlloc;
71 
72     ObjectBaseRef<Type> mAllocType;
73 
74     ProgramVertex *mPV;
75 
76     //ObjectBaseRef<Type> mTextureTypes[ProgramFragment::MAX_TEXTURE];
77 
78 
79 };
80 
81 
82 }
83 }
84 #endif
85 
86 
87