예제 #1
0
 // This is the list of alternatives for +-/, * is special due to the vector/matrix multiplication
 private static GLSLFunctionType[] getBasicArithmeticOperatorAlternatives(String name) {
   List<GLSLFunctionType> dest = new ArrayList<GLSLFunctionType>();
   getCommonArithmeticOperatorAlternatives(name, dest);
   for (int cols = 2; cols <= 4; cols++) {
     for (int rows = 2; rows <= 4; rows++) {
       GLSLMatrixType mat = GLSLMatrixType.getType(cols, rows);
       dest.add(new GLSLBasicFunctionType(name, mat, mat, mat));
     }
   }
   return dest.toArray(new GLSLFunctionType[dest.size()]);
 }
예제 #2
0
  private static GLSLFunctionType[] getMultiplicationOperatorAlternatives() {
    List<GLSLFunctionType> dest = new ArrayList<GLSLFunctionType>();
    getCommonArithmeticOperatorAlternatives("*", dest);
    // matrix-matrix AND matrix-vector
    for (int M = 2; M <= 4; M++) {
      for (int N = 2; N <= 4; N++) {
        GLSLMatrixType matMxN = GLSLMatrixType.getType(M, N);
        GLSLVectorType vecM = GLSLVectorType.getType(M, GLSLTypes.FLOAT);
        GLSLVectorType vecN = GLSLVectorType.getType(N, GLSLTypes.FLOAT);

        dest.add(new GLSLBasicFunctionType("*", vecM, matMxN, vecN));
        dest.add(new GLSLBasicFunctionType("*", vecN, vecM, matMxN));

        for (int I = 2; I <= 4; I++) {
          GLSLMatrixType matIxM = GLSLMatrixType.getType(I, M);
          GLSLMatrixType matIxN = GLSLMatrixType.getType(I, N);

          dest.add(new GLSLBasicFunctionType("*", matIxN, matMxN, matIxM));
        }
      }
    }
    return dest.toArray(new GLSLFunctionType[dest.size()]);
  }
예제 #3
0
 private static GLSLFunctionType[] getUnaryArithmeticOperatorAlternatives(String name) {
   List<GLSLFunctionType> dest = new ArrayList<GLSLFunctionType>();
   dest.add(new GLSLBasicFunctionType(name, GLSLTypes.INT, GLSLTypes.INT));
   dest.add(new GLSLBasicFunctionType(name, GLSLTypes.FLOAT, GLSLTypes.FLOAT));
   for (int i = 2; i <= 4; i++) {
     GLSLType vec = GLSLVectorType.getType(i, GLSLTypes.FLOAT);
     GLSLType ivec = GLSLVectorType.getType(i, GLSLTypes.INT);
     dest.add(new GLSLBasicFunctionType(name, vec, vec));
     dest.add(new GLSLBasicFunctionType(name, ivec, ivec));
     for (int j = 2; j <= 4; j++) {
       GLSLType mat = GLSLMatrixType.getType(i, j);
       dest.add(new GLSLBasicFunctionType(name, mat, mat));
     }
   }
   return dest.toArray(new GLSLFunctionType[dest.size()]);
 }