Exemplo n.º 1
0
SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_DataLoaderJNI_fillNormals(JNIEnv *jenv, jclass jcls, jint jarg1, jobject jarg2, jobject jarg3, jint jarg4, jint jarg5) {
  int arg1 ;
  float *arg2 = (float *) 0 ;
  float *arg3 = (float *) 0 ;
  int arg4 ;
  int arg5 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = (int)jarg1; 
  {
    arg2 = (*jenv)->GetDirectBufferAddress(jenv, jarg2);
    if (arg2 == NULL) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unable to get address of direct buffer. Buffer must be allocated direct.");
    }
  }
  {
    arg3 = (*jenv)->GetDirectBufferAddress(jenv, jarg3);
    if (arg3 == NULL) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unable to get address of direct buffer. Buffer must be allocated direct.");
    }
  }
  arg4 = (int)jarg4; 
  arg5 = (int)jarg5; 
  fillNormals(arg1,arg2,arg3,arg4,arg5);
}
Exemplo n.º 2
0
void Mesh::addQuad(float width, float height) {
  int indexOffset = positions.size();
  float x = width / 2.0f;
  float y = height / 2.0f;

  VVec4 quad;
  // C++11      { glm::vec3(-x, -y, 0), glm::vec3(x, -y, 0), glm::vec3(x, y, 0), glm::vec3(-x, y, 0),  });
  quad.push_back(glm::vec4(-x, -y, 0, 1));
  quad.push_back(glm::vec4(x, -y, 0, 1));
  quad.push_back(glm::vec4(x, y, 0, 1));
  quad.push_back(glm::vec4(-x, y, 0, 1));

  // Positions are transformed
  add_all_transformed(model.top(), positions, quad);
  if (normals.size()) {
    // normals are transformed with only the rotation, not the translation
    model.push().untranslate();
    add_all_transformed(model.top(), normals, quad);
    model.pop();
  }

  // indices are copied and incremented
  VS quadIndices;
  // C++11 VS( { 0, 1, 2, 0, 2, 3 } );
  quadIndices.push_back(0);
  quadIndices.push_back(1);
  quadIndices.push_back(2);
  quadIndices.push_back(0);
  quadIndices.push_back(2);
  quadIndices.push_back(3);
  add_all_incremented(indexOffset, indices, quadIndices);

  fillColors();
  fillNormals();
}