2009-05-22 14:03:28 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2009 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ANDROID_RS_PROGRAM_VERTEX_H
|
|
|
|
#define ANDROID_RS_PROGRAM_VERTEX_H
|
|
|
|
|
|
|
|
#include "rsProgram.h"
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
namespace android {
|
|
|
|
namespace renderscript {
|
|
|
|
|
2009-08-05 13:57:03 -07:00
|
|
|
class ProgramVertexState;
|
2009-05-22 14:03:28 -07:00
|
|
|
|
|
|
|
class ProgramVertex : public Program
|
|
|
|
{
|
|
|
|
public:
|
2009-07-21 12:20:54 -07:00
|
|
|
const static uint32_t MAX_LIGHTS = 8;
|
2009-05-22 14:03:28 -07:00
|
|
|
|
2009-09-25 14:51:22 -07:00
|
|
|
ProgramVertex(Context *, Element *in, Element *out);
|
2009-05-22 14:03:28 -07:00
|
|
|
virtual ~ProgramVertex();
|
|
|
|
|
2009-08-25 11:34:49 -07:00
|
|
|
virtual void setupGL(const Context *rsc, ProgramVertexState *state);
|
2009-11-25 13:22:07 -08:00
|
|
|
virtual void setupGL2(const Context *rsc, ProgramVertexState *state, ShaderCache *sc);
|
2009-05-22 14:03:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
void setTextureMatrixEnable(bool e) {mTextureMatrixEnable = e;}
|
2009-07-21 12:20:54 -07:00
|
|
|
void addLight(const Light *);
|
2009-05-22 14:03:28 -07:00
|
|
|
|
2009-07-28 12:02:16 -07:00
|
|
|
void setProjectionMatrix(const rsc_Matrix *) const;
|
|
|
|
void setModelviewMatrix(const rsc_Matrix *) const;
|
|
|
|
void setTextureMatrix(const rsc_Matrix *) const;
|
|
|
|
|
2009-09-30 17:36:20 -07:00
|
|
|
void transformToScreen(const Context *, float *v4out, const float *v3in) const;
|
|
|
|
|
2009-11-25 13:22:07 -08:00
|
|
|
virtual void createShader();
|
|
|
|
virtual void loadShader();
|
|
|
|
virtual void init(Context *);
|
|
|
|
|
2009-09-30 17:36:20 -07:00
|
|
|
|
2009-05-22 14:03:28 -07:00
|
|
|
protected:
|
2009-07-21 12:20:54 -07:00
|
|
|
uint32_t mLightCount;
|
|
|
|
ObjectBaseRef<const Light> mLights[MAX_LIGHTS];
|
|
|
|
|
2009-05-22 14:03:28 -07:00
|
|
|
// Hacks to create a program for now
|
|
|
|
bool mTextureMatrixEnable;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-08-05 13:57:03 -07:00
|
|
|
class ProgramVertexState
|
2009-05-22 14:03:28 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ProgramVertexState();
|
|
|
|
~ProgramVertexState();
|
|
|
|
|
2009-06-17 16:52:59 -07:00
|
|
|
void init(Context *rsc, int32_t w, int32_t h);
|
2009-09-25 16:37:33 -07:00
|
|
|
void deinit(Context *rsc);
|
2009-11-12 16:09:45 -08:00
|
|
|
void updateSize(Context *rsc, int32_t w, int32_t h);
|
2009-06-17 16:52:59 -07:00
|
|
|
|
|
|
|
ObjectBaseRef<ProgramVertex> mDefault;
|
2009-08-05 13:57:03 -07:00
|
|
|
ObjectBaseRef<ProgramVertex> mLast;
|
2009-06-17 16:52:59 -07:00
|
|
|
ObjectBaseRef<Allocation> mDefaultAlloc;
|
2009-08-05 13:57:03 -07:00
|
|
|
|
2009-09-25 16:37:33 -07:00
|
|
|
ObjectBaseRef<Type> mAllocType;
|
2009-06-17 16:52:59 -07:00
|
|
|
|
2009-05-22 14:03:28 -07:00
|
|
|
ProgramVertex *mPV;
|
|
|
|
|
|
|
|
//ObjectBaseRef<Type> mTextureTypes[ProgramFragment::MAX_TEXTURE];
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|