rsProgramVertex.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #ifndef ANDROID_RS_PROGRAM_VERTEX_H
  17. #define ANDROID_RS_PROGRAM_VERTEX_H
  18. #include "rsProgram.h"
  19. // ---------------------------------------------------------------------------
  20. namespace android {
  21. namespace renderscript {
  22. class ProgramVertexState;
  23. class ProgramVertex : public Program {
  24. public:
  25. ProgramVertex(Context *,const char * shaderText, size_t shaderLength,
  26. const char** textureNames, size_t textureNamesCount, const size_t *textureNamesLength,
  27. const uintptr_t * params, size_t paramLength);
  28. virtual ~ProgramVertex();
  29. virtual void setup(Context *rsc, ProgramVertexState *state);
  30. void setProjectionMatrix(Context *, const rsc_Matrix *) const;
  31. void getProjectionMatrix(Context *, rsc_Matrix *) const;
  32. void setModelviewMatrix(Context *, const rsc_Matrix *) const;
  33. void setTextureMatrix(Context *, const rsc_Matrix *) const;
  34. void transformToScreen(Context *, float *v4out, const float *v3in) const;
  35. virtual void serialize(Context *rsc, OStream *stream) const;
  36. virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_VERTEX; }
  37. static ProgramVertex *createFromStream(Context *rsc, IStream *stream);
  38. };
  39. class ProgramVertexState {
  40. public:
  41. ProgramVertexState();
  42. ~ProgramVertexState();
  43. void init(Context *rsc);
  44. void deinit(Context *rsc);
  45. void updateSize(Context *rsc);
  46. ObjectBaseRef<ProgramVertex> mDefault;
  47. ObjectBaseRef<ProgramVertex> mLast;
  48. ObjectBaseRef<Allocation> mDefaultAlloc;
  49. };
  50. } // namespace renderscript
  51. } // namespace android
  52. #endif