예제 #1
0
파일: main.cpp 프로젝트: datar-pl/vsxu
void vsx_module_texture_rotate::run() {
//printf("rotate_begin\n");

	vsx_texture** texture_info_in = texture_info_param_in->get_addr();
	//printf("validness: %d\n",texture_info_param_in->valid);
//	if (texture_info_in->valid)
  if (texture_info_in)
  {

    texture_out->valid = (*texture_info_in)->valid;

//	if (texture_info_in->texture_info) {
  	texture_out->texture_info = (*texture_info_in)->texture_info;
//  }

  	float x = rotation_axis->get(0);
  	float y = rotation_axis->get(1);
  	float z = rotation_axis->get(2);
  	float a = rotation_angle->get()*360;
  	vsx_transform_obj* prev_transform = (*texture_info_in)->get_transform();
  	transform.set_previous_transform(prev_transform);
  	transform.update(a, x, y, z);
    //	if (texture_out)
  	texture_out->set_transform(&transform);
  	((vsx_module_param_texture*)texture_result)->set(texture_out);
  }	else {
    //printf("fooble\n");
    texture_result->valid = false;
  }
}
예제 #2
0
파일: main.cpp 프로젝트: datar-pl/vsxu
	void output(vsx_module_param_abs* param)
	{
		vsx_texture** t_a;
			t_a = texture_a_in->get_addr();
		vsx_texture** t_b;
			t_b = texture_b_in->get_addr();
		if (t_a && t_b) {
			((vsx_module_param_texture*)texture_a_out)->set(*t_a);
			((vsx_module_param_texture*)texture_b_out)->set(*t_b);
		}
		if (fade_pos_from_engine->get() != 0.0f)
		{
			fade_pos_out->set(fade_pos_in->get());
		} else
		{
			fade_pos_out->set((float)fmod(engine->real_vtime, 1.0f));
		}
	}
예제 #3
0
파일: main.cpp 프로젝트: datar-pl/vsxu
void vsx_module_texture_translate::run() {
  vsx_texture** texture_info_in = texture_info_param_in->get_addr();
  if (texture_info_in)
  {
    texture_out->valid = (*texture_info_in)->valid;
  	texture_out->texture_info = (*texture_info_in)->texture_info;
  	float x = translation_vec->get(0);
  	float y = translation_vec->get(1);
  	float z = translation_vec->get(2);
  	vsx_transform_obj* prev_transform = (*texture_info_in)->get_transform();
  	transform.set_previous_transform(prev_transform);
  	transform.update(x, y, z);
  	texture_out->set_transform(&transform);
    ((vsx_module_param_texture*)texture_result)->set(texture_out);

  } else texture_result->valid = false;
}
예제 #4
0
파일: main.cpp 프로젝트: datar-pl/vsxu
  void run() {
    texture_out = texture_info_param_in->get_addr();
    if (texture_out)
    {
     if (param_updates)
     {
        (*texture_out)->bind();
  #ifdef VSXU_OPENGL_ES
        if (GL_EXT_texture_filter_anisotropic)
  #endif
  #ifndef VSXU_OPENGL_ES
          if (GLEW_EXT_texture_filter_anisotropic)
  #endif
          {
          float rMaxAniso;
          glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &rMaxAniso);
          if (anisotropic_filter->get())
          glTexParameterf((*texture_out)->texture_info.ogl_type, GL_TEXTURE_MAX_ANISOTROPY_EXT, rMaxAniso);
          else
          glTexParameterf((*texture_out)->texture_info.ogl_type, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f);
        }

        float vals[4];
        vals[0] = border_color->get(0);
        vals[1] = border_color->get(1);
        vals[2] = border_color->get(2);
        vals[3] = border_color->get(3);

        glTexParameteri((*texture_out)->texture_info.ogl_type,GL_TEXTURE_MIN_FILTER, tex_filter[min_filter->get()]);
        glTexParameteri((*texture_out)->texture_info.ogl_type,GL_TEXTURE_MAG_FILTER, tex_filter[mag_filter->get()]);
  #ifndef VSXU_OPENGL_ES
        glTexParameterfv((*texture_out)->texture_info.ogl_type, GL_TEXTURE_BORDER_COLOR, vals);
  #endif
        glTexParameteri((*texture_out)->texture_info.ogl_type, GL_TEXTURE_WRAP_T, tex_wrap[wrap_t->get()]);
        glTexParameteri((*texture_out)->texture_info.ogl_type, GL_TEXTURE_WRAP_S, tex_wrap[wrap_s->get()]);
        (*texture_out)->_bind();

        --param_updates;
      }
      ((vsx_module_param_texture*)texture_result)->set(*texture_out);

    }	else {
      texture_result->valid = false;
    }
  }
예제 #5
0
파일: main.cpp 프로젝트: Spartan190/vsxu
  void run() {
    texture = texture_in->get_addr();
    if (texture) {
      (*texture)->bind();
      GLint components;
      glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_COMPONENTS,&components);
      //printf("components: %d\n",components);
      GLint pack;
      glGetIntegerv(GL_PACK_ALIGNMENT,&pack);
//          printf("pack: %d\n",pack);
      if (pack == 4) {
        GLint width;
        GLint height;
        glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_WIDTH,&width);
        glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_HEIGHT,&height);
//              printf("height: %d\n",height);
        if (bitm.size_x != (unsigned int)width || bitm.size_y != (unsigned int)height) {
//          printf("allocating new memory\n");
//          printf("height: %d\n",height);
          
          if (bitm.data) delete[] (vsx_bitmap_32bt*)bitm.data;
          bitm.data = new vsx_bitmap_32bt[width*height];
          bitm.size_x = width;
          bitm.size_y = height;
        }
          //printf("bwidth: %d\n",width);
        glGetTexImage(GL_TEXTURE_2D,
                   0,
                   GL_RGBA,
                   GL_UNSIGNED_BYTE,
                   bitm.data);
        //printf("bdata: %d\n",(unsigned int)bitm.data[0]);
        bitm.valid = true;
        ++bitm.timestamp;
        result1->set_p(bitm);
      }
      (*texture)->_bind();
    }
  }