VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtProgramConstants.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2023 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvMath/DtVector4.h>
13 #include <vrvMath/DtVector3.h>
14 #include <vrvMath/DtVector2.h>
15 #include <vrvMath/DtMatrix4.h>
16 
17 namespace makVrv
18 {
19  class DtGlProgram;
20 
21  template<class T>
23  {
24  public:
25  T val = {};
26  int loc = -1;
27  };
28 
30  {
31  public:
32  template<typename T>
33  void setValue(unsigned char* pData, const DtValueAndLoc<DtVector4<T>>& src)
34  {
35  if (src.loc != -1)
36  {
37  memcpy(pData + src.loc, src.val.ptr(), sizeof(DtVector4<T>));
38  }
39  }
40 
41  template<typename T>
42  void setValue(unsigned char* pData, const DtValueAndLoc<DtMatrix4<T>>& src)
43  {
44  if (src.loc != -1)
45  {
46  memcpy(pData + src.loc, src.val.ptr(), sizeof(DtMatrix4<T>));
47  }
48  }
49 
50  template<typename T>
51  void setValue(unsigned char* pData, const DtValueAndLoc<T>& src)
52  {
53  if (src.loc != -1)
54  {
55  memcpy(pData + src.loc, &src.val, sizeof(T));
56  }
57  }
58 
59  template<typename T>
60  void setValue(unsigned char* pData, const DtValueAndLoc<DtVector2<T>>& src)
61  {
62  if (src.loc != -1)
63  {
64  memcpy(pData + src.loc, src.val.ptr(), sizeof(T) * 2);
65  }
66  }
67  };
68 
71  {
72  public:
74  virtual void init(const DtGlProgram* program) = 0;
75  protected:
76 
78  virtual void reset(void) = 0;
79  };
80 }
Definition: DtProgramConstants.h:29
2 dimensional vector
interface class for managing program constants
Definition: DtProgramConstants.h:70
4 dimensional vector
virtual void reset(void)=0
reset. inherited must implement
void setValue(unsigned char *pData, const DtValueAndLoc< DtVector2< T >> &src)
Definition: DtProgramConstants.h:60
A convenience class to represent an OpenGL Shader Program.
Definition: DtGlProgram.h:66
3 dimensional vector
void setValue(unsigned char *pData, const DtValueAndLoc< DtMatrix4< T >> &src)
Definition: DtProgramConstants.h:42
4 dimensional vector
Definition: DtMath.h:22
Definition: DtProgramConstants.h:22
int loc
Definition: DtProgramConstants.h:26
T val
Definition: DtProgramConstants.h:25
void setValue(unsigned char *pData, const DtValueAndLoc< T > &src)
Definition: DtProgramConstants.h:51
void setValue(unsigned char *pData, const DtValueAndLoc< DtVector4< T >> &src)
Definition: DtProgramConstants.h:33
virtual void init(const DtGlProgram *program)=0
initialize
4 dimensional matrix
4 dimensional matrix
Definition: DtMatrix4.h:22
2 dimensional vector
Definition: DtMath.h:20

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)