• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ vsx_module_param_int类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中vsx_module_param_int的典型用法代码示例。如果您正苦于以下问题:C++ vsx_module_param_int类的具体用法?C++ vsx_module_param_int怎么用?C++ vsx_module_param_int使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了vsx_module_param_int类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: declare_params

  void declare_params(vsx_module_param_list& in_parameters, vsx_module_param_list& out_parameters) {
    my_render = (vsx_module_param_render*)in_parameters.create(VSX_MODULE_PARAM_ID_RENDER, "render_in",false,false);
    res_x = 512;

    float_texture = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT, "float_texture");
    float_texture->set(0);
    float_texture_int = 0;

    alpha_channel = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT, "alpha_channel");
    alpha_channel->set(1);
    alpha_channel_int = 1;

    multisample = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT, "multisample");
    multisample_int = 0;

    texture_size = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT, "texture_size");
    texture_size->set(2);

    tex_size_internal = -1;

    texture_result = (vsx_module_param_texture*)out_parameters.create(VSX_MODULE_PARAM_ID_TEXTURE,"color_buffer");

    depth_buffer_out = (vsx_module_param_texture*)out_parameters.create(VSX_MODULE_PARAM_ID_TEXTURE,"depth_buffer");
    depth_buffer_in = (vsx_module_param_texture*)in_parameters.create(VSX_MODULE_PARAM_ID_TEXTURE,"depth_buffer");
    depth_buffer_in_int = 0;

    start();
  }
开发者ID:Spartan190,项目名称:vsxu,代码行数:28,代码来源:main.cpp


示例2: declare_params

void declare_params(vsx_module_param_list& in_parameters, vsx_module_param_list& out_parameters) {
  my_render = (vsx_module_param_render*)in_parameters.create(VSX_MODULE_PARAM_ID_RENDER, "render_in",false,false);
  res_x = 512;

  support_feedback = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT, "support_feedback");
  support_feedback->set(1);

  float_texture = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT, "float_texture");
  float_texture->set(0);
  float_texture_int = 0;

  alpha_channel = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT, "alpha_channel");
  alpha_channel->set(1);
  alpha_channel_int = 1;

  clear_color = (vsx_module_param_float4*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT4, "clear_color");
  clear_color->set(0,0);
  clear_color->set(0,1);
  clear_color->set(0,2);
  clear_color->set(1,3);


  texture_size = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT, "texture_size");
  texture_size->set(2);

  tex_size_internal = -1;

  texture_result = (vsx_module_param_texture*)out_parameters.create(VSX_MODULE_PARAM_ID_TEXTURE,"texture_out");
  allocate_second_texture = true;
  start();
}
开发者ID:datar-pl,项目名称:vsxu,代码行数:31,代码来源:main.cpp


示例3: declare_params

  void declare_params(vsx_module_param_list& in_parameters, vsx_module_param_list& out_parameters)
  {

    filename = (vsx_module_param_string*)in_parameters.create(VSX_MODULE_PARAM_ID_STRING,"filename");
    filename->set("");
    //load_avi_file();
    drive = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT,"drive");
    drive->set(0);
    time = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT,"time");

  	result1 = (vsx_module_param_bitmap*)out_parameters.create(VSX_MODULE_PARAM_ID_BITMAP,"bitmap");
    result1->set_p(bitm);
    work_bitmap = &bitm;
    bitm.data = 0;
    bitm.bpp = 3;
    bitm.bformat = GL_RGBA;
    bitm.valid = false;
    bitm_timestamp = bitm.timestamp = rand();
    need_to_rebuild = true;
    previous_frame = -1;
  }
开发者ID:ChunhuiWu,项目名称:vsxu,代码行数:21,代码来源:main.cpp


示例4: declare_params

void declare_params(vsx_module_param_list& in_parameters, vsx_module_param_list& out_parameters)
{
  declare_run = false;
  size = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "size");
  size->set(1.0f);
  angle = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "angle");
  angle->set(0.0f);

  text_in = (vsx_module_param_string*)in_parameters.create(VSX_MODULE_PARAM_ID_STRING, "text_in");
  text_in->set("Vovoid VSX Ultra");
  text_in->updates = 1;
  font_in = (vsx_module_param_resource*)in_parameters.create(VSX_MODULE_PARAM_ID_RESOURCE, "font_in");
  font_in->set("resources/fonts/pala.ttf");
  cur_font = "";

  limit_line = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "limit_line");
  limit_line->set(-1.0f);


  leading = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "leading");
  leading->set(1.0f);

  glyph_size = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "glyph_size");
  glyph_size->set(24.0f);
  cur_glyph_size = 24.0f;
  render_type = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT,"render_type");
  render_type->set(0);
  align = (vsx_module_param_int*)in_parameters.create(VSX_MODULE_PARAM_ID_INT,"align");
  align->set(0);
  cur_render_type = 0;

  ftfont = 0;
  ftfont2 = 0;

  rotation_axis = (vsx_module_param_float3*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT3, "rotation_axis");
  rotation_axis->set(0.0f, 0);
  rotation_axis->set(1.0f, 1);
  rotation_axis->set(0.0f, 2);
  red = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "red");
  red->set(1.0f);
  green = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "green");
  green->set(1.0f);
  blue = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "blue");
  blue->set(1.0f);

  text_alpha = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "text_alpha");
  text_alpha->set(1.0);
  outline_alpha = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "outline_alpha");
  outline_alpha->set(0.5);
  outline_thickness = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "outline_thickness");
  outline_thickness->set(3.0);
  outline_color = (vsx_module_param_float4*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT4, "outline_color");
  outline_color->set(0.0f, 0);
  outline_color->set(0.0f, 1);
  outline_color->set(0.0f, 2);
  outline_color->set(0.0f, 3);

  render_result = (vsx_module_param_render*)out_parameters.create(VSX_MODULE_PARAM_ID_RENDER,"render_out");
  render_result->set(0);
  declare_run = true;

  gl_state = vsx_gl_state::get();
}
开发者ID:vovoid,项目名称:vsxu,代码行数:63,代码来源:main_render.text.cpp


示例5: setup_font

  void setup_font()
  {
    if
    (
      (cur_font != font_in->get()) ||
      (cur_render_type !=render_type->get()) ||
      (cur_glyph_size != glyph_size->get())
    )
    {
      vsx::file *fp;
      if ((fp = engine_state->filesystem->f_open(font_in->get().c_str())) == NULL)
      {
        printf("font not found: %s\n",cur_font.c_str());
        return;
      }
      cur_font = font_in->get();
      cur_render_type = render_type->get();
      cur_glyph_size = glyph_size->get();

      if (ftfont) {
        delete ftfont;
        ftfont = 0;
      }
      if (ftfont2) {
        delete ftfont2;
        ftfont2 = 0;
      }
      unsigned long size = engine_state->filesystem->f_get_size(fp);
      char* fdata = (char*)malloc(size);
      unsigned long bread = engine_state->filesystem->f_read((void*)fdata, size, fp);
      if (bread == size)
      {
        switch (cur_render_type)
        {
          case 0:
            ftfont = new FTGLTextureFont((unsigned char*)fdata, size);
          break;
          case 1:
            ftfont = new FTGLPolygonFont((unsigned char*)fdata, size);
            ftfont2 = new FTGLOutlineFont((unsigned char*)fdata, size);
          break;
        }
        ftfont->FaceSize((unsigned int)round(cur_glyph_size));
        ftfont->CharMap(ft_encoding_unicode);
        if (ftfont2) {
          ftfont2->FaceSize((unsigned int)round(cur_glyph_size));
          ftfont2->CharMap(ft_encoding_unicode);
        }
        loading_done = true;
      }
      engine_state->filesystem->f_close(fp);
    }
  }
开发者ID:vovoid,项目名称:vsxu,代码行数:53,代码来源:main_render.text.cpp


示例6: deactivate_offscreen

void deactivate_offscreen() {
  glUseProgram(glsl_prog);

  if (!which_buffer || support_feedback->get() == 0)
  {
    if (texture)
    {
      texture->end_capture();
      texture->valid = true;
    }
    ((vsx_module_param_texture*)texture_result)->set(texture);
  }
  else
  {
    if (texture2)
    {
      texture2->end_capture();
      texture2->valid = true;
    }
    ((vsx_module_param_texture*)texture_result)->set(texture2);
  }

  which_buffer = !which_buffer;

  #if defined(VSXU_OPENGL_ES) || defined (__APPLE__)
  //printf("resetting viewport to %d %d %d %d\n",viewport[0],viewport[1],viewport[2],viewport[3]);
  glViewport(viewport[0],viewport[1],viewport[2],viewport[3]);
  #endif
}
开发者ID:datar-pl,项目名称:vsxu,代码行数:29,代码来源:main.cpp


示例7: output

  // this is run for each connection to this in-param.
  void output(vsx_module_param_abs* param) 
  {
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    // translation
    glTranslatef(position->get(0),position->get(1),position->get(2));
    // rotation
    glRotatef(
      (float)angle->get()*360, 
      rotation_axis->get(0), 
      rotation_axis->get(1), 
      rotation_axis->get(2)
    );
    // scaling
    glScalef(size->get(0), size->get(1), size->get(2));
    // color
    glColor4f(
      color_rgb->get(0),
      color_rgb->get(1),
      color_rgb->get(2),
      color_rgb->get(3)
    );

    glBegin(GL_QUADS);
      glTexCoord2f(0.0f,0.0f);
      glVertex3f(-1.0f, -1.0f, 0.0f);
      glTexCoord2f(0.0f,1.0f);
      glVertex3f(-1.0f,  1.0f, 0.0f);
      glTexCoord2f(1.0f,1.0f);
      glVertex3f( 1.0f,  1.0f, 0.0f);
      glTexCoord2f(1.0f,0.0f);
      glVertex3f( 1.0f, -1.0f, 0.0f);
    glEnd();

    if (border->get()) 
    {
      glEnable(GL_LINE_SMOOTH);
      glLineWidth(1.5);
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

      glBegin(GL_LINE_STRIP);
        glColor3f(0, 0, 0);
        glVertex3f(-2, -0.4f, 0);
        glVertex3f(-2, -0.2f, 0);
        glVertex3f( 2, -0.2f, 0);
        glVertex3f( 2, -0.4f, 0);
        glVertex3f(-2, -0.4f, 0);
      glEnd();
    }

    glPopMatrix();
    render_result->set(1);
    loading_done = true;
  }
开发者ID:CJFocke,项目名称:vsxu,代码行数:56,代码来源:main.cpp


示例8: run

  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;
    }
  }
开发者ID:datar-pl,项目名称:vsxu,代码行数:45,代码来源:main.cpp


示例9: run

 void run()
 {
 	if (drive->get() == 0)
   current_frame = (int)(engine->vtime * get_frame_rate());
   else
   current_frame = (int)(time->get() * get_frame_rate());
   if (current_frame != previous_frame) {
     //printf("r-");
     bitm.data=(long unsigned int*)get_frame_data(current_frame);
     bitm.timestamp++;
     previous_frame = current_frame;
    // printf("t-");
   }
   if (bitm.valid && bitm_timestamp != bitm.timestamp)
   {
     bitm_timestamp = bitm.timestamp;
     result1->set(bitm);
     loading_done = true;
   }
   if (current_frame>num_frames) current_frame=0;
 }
开发者ID:ChunhuiWu,项目名称:vsxu,代码行数:21,代码来源:main.cpp


示例10: activate_offscreen

bool activate_offscreen() {
  //printf("ac1\n");
  //printf("activate offscreen\n");
  //glGetIntegerv(GL_VIEWPORT, viewport);
  //printf("old viewport is %d %d %d %d\n",viewport[0],viewport[1],viewport[2],viewport[3]);
#if defined(VSXU_OPENGL_ES) || defined (__APPLE__)
  glGetIntegerv (GL_VIEWPORT, viewport);
#endif

  bool rebuild = false;

  if (alpha_channel->get() != alpha_channel_int)
  {
    alpha_channel_int = alpha_channel->get();
    rebuild = true;
  }

  if (float_texture->get() != float_texture_int)
  {
    float_texture_int = float_texture->get();
    rebuild = true;
  }

  if (texture_size->get() >= 10)
  {
    glGetIntegerv (GL_VIEWPORT, viewport);
    int t_res_x = abs(viewport[2] - viewport[0]);
    int t_res_y = abs(viewport[3] - viewport[1]);

    if (texture_size->get() == 10) {
      if (t_res_x != res_x || t_res_y != res_y) rebuild = true;
    }

    if (texture_size->get() == 11) {
      if (t_res_x / 2 != res_x || t_res_y / 2 != res_y) rebuild = true;
    }

    if (texture_size->get() == 12) {
      if (t_res_x / 4 != res_x || t_res_y / 4 != res_y) rebuild = true;
    }

    if (texture_size->get() == 13) {
      if (t_res_x * 2 != res_x || t_res_y * 2 != res_y) rebuild = true;
    }

    if (texture_size->get() == 14) {
      if (t_res_x * 4 != res_x || t_res_y * 4 != res_y) rebuild = true;
    }
  }


  if (texture_size->get() != tex_size_internal || rebuild) {
    //printf("generating new framebuffer\n");
    tex_size_internal = texture_size->get();
    switch (tex_size_internal) {
      case 0: res_y = res_x = 2048; break;
      case 1: res_y = res_x = 1024; break;
      case 2: res_y = res_x = 512; break;
      case 3: res_y = res_x = 256; break;
      case 4: res_y = res_x = 128; break;
      case 5: res_y = res_x = 64; break;
      case 6: res_y = res_x = 32; break;
      case 7: res_y = res_x = 16; break;
      case 8: res_y = res_x = 8; break;
      case 9: res_y = res_x = 4; break;
      case 10: res_x = abs(viewport[2] - viewport[0]); res_y = abs(viewport[3] - viewport[1]); break;
      case 11: res_x = abs(viewport[2] - viewport[0]) / 2; res_y = abs(viewport[3] - viewport[1]) / 2; break;
      case 12: res_x = abs(viewport[2] - viewport[0]) / 4; res_y = abs(viewport[3] - viewport[1]) / 4; break;
      case 13: res_x = abs(viewport[2] - viewport[0]) * 2; res_y = abs(viewport[3] - viewport[1]) * 2; break;
      case 14: res_x = abs(viewport[2] - viewport[0]) * 4; res_y = abs(viewport[3] - viewport[1]) * 4; break;
    };

    texture->reinit_buffer(res_x, res_y,float_texture->get(),alpha_channel->get());
    if (support_feedback->get())
    texture2->reinit_buffer(res_x, res_y, float_texture->get(),alpha_channel->get());
  }

  if (!which_buffer || support_feedback->get() == 0)
    texture->begin_capture();
  else
    texture2->begin_capture();

  //printf("changing viewport to %d\n",res_x);
	glViewport(0,0,res_x,res_y);
	glDepthMask(GL_TRUE);
	//glDisable(GL_DEPTH_TEST);
	glClearColor(clear_color->get(0),clear_color->get(1),clear_color->get(2),clear_color->get(3));
  //printf("clear buffer\n");
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);		// Clear Screen And Depth Buffer
//#ifdef __APPLE__
	glEnable(GL_BLEND);
//#endif
  glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&glsl_prog);
  glUseProgram(0);
  //glBlendFunc(GL_SRC_ALPHA,GL_ONE);
  loading_done = true;
  return true;
};
开发者ID:datar-pl,项目名称:vsxu,代码行数:98,代码来源:main.cpp


示例11: output

  void output(vsx_module_param_abs* param)
  {
    VSX_UNUSED(param);
    if (text_in->updates)
    {
      if (process_lines())
      text_in->updates = 0;
    }
    if (text_alpha->get() <= 0)
      return;

    if (!ftfont)
    {
      user_message = "module||error loading font "+cur_font;
      return;
    }

    if (text_in->get() == "_")
      return;


    float obj_size = size->get();

    gl_state->matrix_mode (VSX_GL_MODELVIEW_MATRIX );
    gl_state->matrix_push();

    gl_state->matrix_rotate_f( (float)angle->get()*360, rotation_axis->get(0), rotation_axis->get(1), rotation_axis->get(2) );

    if (obj_size < 0)
      obj_size = 0;

    gl_state->matrix_scale_f( obj_size*0.8*0.01, obj_size*0.01, obj_size*0.01 );

    int l_align = align->get();
    float l_leading = leading->get();
    float ypos = 0;

    if (cur_render_type == 0)
      glEnable(GL_TEXTURE_2D);

    glColor4f(red->get(),green->get(),blue->get(),text_alpha->get());

    for (unsigned long i = 0; i < lines.size(); ++i)
    {
      float ll = limit_line->get();
      if (ll != -1.0f)
      {
        if (trunc(ll) != i) continue;
      }
      gl_state->matrix_push();
      if (l_align == 0)
      {
        gl_state->matrix_translate_f( 0, ypos, 0 );
      } else
      if (l_align == 1)
      {
        gl_state->matrix_translate_f( -lines[i].size_x*0.5f,ypos,0 );
      }
      if (l_align == 2)
      {
        gl_state->matrix_translate_f( -lines[i].size_x,ypos,0 );
      }

      if (cur_render_type == 1)
      {
        if (outline_alpha->get() > 0.0f && ftfont2) {
          float pre_linew;
          pre_linew = gl_state->line_width_get();
          gl_state->line_width_set( outline_thickness->get() );
          glColor4f(outline_color->get(0),outline_color->get(1),outline_color->get(2),outline_alpha->get()*outline_color->get(3));
          ftfont2->Render(lines[i].string.c_str());
          gl_state->line_width_set( pre_linew );
        }
        glColor4f(red->get(),green->get(),blue->get(),text_alpha->get());
      }

      ftfont->Render(lines[i].string.c_str());
      gl_state->matrix_pop();
      ypos += l_leading;
    }

    if (cur_render_type == 0)
      glDisable(GL_TEXTURE_2D);


    gl_state->matrix_pop();

    render_result->set(1);
    loading_done = true;
  }
开发者ID:vovoid,项目名称:vsxu,代码行数:90,代码来源:main_render.text.cpp


示例12: activate_offscreen

  bool activate_offscreen() {
    #if defined(VSXU_OPENGL_ES) || defined (__APPLE__)
      glGetIntegerv (GL_VIEWPORT, viewport);
    #endif

    bool rebuild = false;

    if (alpha_channel->get() != alpha_channel_int)
    {
      alpha_channel_int = alpha_channel->get();
      rebuild = true;
    }

    if (float_texture->get() != float_texture_int)
    {
      float_texture_int = float_texture->get();
      rebuild = true;
    }

    if (multisample->get() != multisample_int)
    {
      multisample_int = multisample->get();
      rebuild = true;
    }

    if (multisample->get() != multisample_int)
    {
      multisample_int = multisample->get();
      rebuild = true;
    }

    if (texture_size->get() >= 10)
    {
      glGetIntegerv (GL_VIEWPORT, viewport);
      int t_res_x = abs(viewport[2] - viewport[0]);
      int t_res_y = abs(viewport[3] - viewport[1]);

      if (texture_size->get() == 10) {
        if (t_res_x != res_x || t_res_y != res_y) rebuild = true;
      }

      if (texture_size->get() == 11) {
        if (t_res_x / 2 != res_x || t_res_y / 2 != res_y) rebuild = true;
      }

      if (texture_size->get() == 12) {
        if (t_res_x / 4 != res_x || t_res_y / 4 != res_y) rebuild = true;
      }

      if (texture_size->get() == 13) {
        if (t_res_x * 2 != res_x || t_res_y * 2 != res_y) rebuild = true;
      }

      if (texture_size->get() == 14) {
        if (t_res_x * 4 != res_x || t_res_y * 4 != res_y) rebuild = true;
      }
    }


    if (texture_size->get() != tex_size_internal || rebuild)
    {
      //printf("generating new framebuffer\n");
      tex_size_internal = texture_size->get();
      switch (tex_size_internal) {
        case 0: res_y = res_x = 2048; break;
        case 1: res_y = res_x = 1024; break;
        case 2: res_y = res_x = 512; break;
        case 3: res_y = res_x = 256; break;
        case 4: res_y = res_x = 128; break;
        case 5: res_y = res_x = 64; break;
        case 6: res_y = res_x = 32; break;
        case 7: res_y = res_x = 16; break;
        case 8: res_y = res_x = 8; break;
        case 9: res_y = res_x = 4; break;
        case 10: res_x = abs(viewport[2] - viewport[0]); res_y = abs(viewport[3] - viewport[1]); break;
        case 11: res_x = abs(viewport[2] - viewport[0]) / 2; res_y = abs(viewport[3] - viewport[1]) / 2; break;
        case 12: res_x = abs(viewport[2] - viewport[0]) / 4; res_y = abs(viewport[3] - viewport[1]) / 4; break;
        case 13: res_x = abs(viewport[2] - viewport[0]) * 2; res_y = abs(viewport[3] - viewport[1]) * 2; break;
        case 14: res_x = abs(viewport[2] - viewport[0]) * 4; res_y = abs(viewport[3] - viewport[1]) * 4; break;
      };

      texture->reinit_color_depth_buffer
      (
        res_x,
        res_y,
        float_texture_int,
        alpha_channel_int,
        multisample_int
      );
    }

    texture->begin_capture_to_buffer();

    //printf("changing viewport to %d\n",res_x);
    glViewport(0,0,res_x,res_y);
    glDepthMask(GL_TRUE);

    glEnable(GL_BLEND);
    glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&glsl_prog);
    if ( atof((char*)glGetString(GL_VERSION)) >= 2.0 )
//.........这里部分代码省略.........
开发者ID:Spartan190,项目名称:vsxu,代码行数:101,代码来源:main.cpp


示例13: run

void run() {
  if (filename->get() != current_filename) {
   	if (!verify_filesuffix(filename->get(),"obj")) {
   		filename->set(current_filename);
   		message = "module||ERROR! This is not a OBJ mesh file!";
   		return;
   	} else message = "module||ok";

    current_filename = filename->get();
    vsxf_handle *fp;
    //printf("a\n");
    if ((fp = engine->filesystem->f_open(current_filename.c_str(), "r")) == NULL)
    {
      return;
    }
    
    char buf[65535];
    vsx_string line;
    vsx_array<vsx_vector> vertices; //vertices.set_allocation_increment(15000);
    vsx_array<vsx_vector> normals; //normals.set_allocation_increment(15000);
    vsx_array<vsx_tex_coord> texcoords; //texcoords.set_allocation_increment(15000);
    //mesh->data->vertex_tex_coords.reset_used();
    mesh->data->clear();
    //mesh->data->vertices.set_allocation_increment(15000);
    //mesh->data->vertex_normals.set_allocation_increment(15000);
    //mesh->data->vertex_tex_coords.set_allocation_increment(15000);
    //mesh->data->faces.set_allocation_increment(15000);

    int face_cur = 0;
    //printf("b\n");
    bool found_normals = false;
    bool found_texcoords = false;
    if (preserve_uv_coords->get()) {
      mesh->data->vertices.reset_used();
      mesh->data->vertex_tex_coords.reset_used();
      mesh->data->vertex_normals.reset_used();
      mesh->data->faces.reset_used();

	    while (engine->filesystem->f_gets(buf,65535,fp)) {
	      line = buf;
	      if (line[line.size()-1] == 0x0A) line.pop_back();
	      if (line[line.size()-1] == 0x0D) line.pop_back();
	      //printf("reading line: %s\n",line.c_str());
	      //printf("c\n");
	      if (line.size()) {
	        vsx_avector<vsx_string> parts;
	        vsx_string deli = " ";
	        explode(line, deli, parts);
	        if (parts[0] == "v") {
	        	//printf("v\n");
	          //mesh->data->vertices.push_back(vsx_vector(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	          vertices.push_back(vsx_vector(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	        } else
	        if (parts[0] == "vt") {
	        	//printf("vt\n");
	          vsx_tex_coord a;
	          a.s = (s2f(parts[1]));
	          a.t = (s2f(parts[2]));
	          //printf("%f  ::   %f\n",a.s,a.t);
	          texcoords.push_back(a);
	          //vsx_vector__(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	          found_texcoords = true;

	        } else
	        if (parts[0] == "vn") {
	        	//printf("vn\n");
	          //printf("normal\n");
	          normals.push_back(vsx_vector(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	          found_normals = true;
	          //mesh->data->vertex_normals.push_back(vsx_vector__(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	        } else
	        if (parts[0] == "f") {
	        	//printf("f1\n");
	          //printf("face\n");
	          //if (parts.size() == 4) {
	            //printf("num texcoords %d\n",texcoords.size());
	            vsx_face ff;
	//            vsx_avector<vsx_string> parts2;
	            vsx_string deli2 = "/";

	/*            explode(parts[1], deli2, parts2);
	            ff.c = s2i(parts2[0])-1;
	            mesh->data->vertex_normals[ff.c] = normals[s2i(parts2[1])-1];
	            mesh->data->vertex_tex_coords[ff.c] = texcoords[s2i(parts2[1])-1];

	            explode(parts[2], deli2, parts2);
	            ff.b = s2i(parts2[0])-1;
	            mesh->data->vertex_normals[ff.b] = normals[s2i(parts2[1])-1];
	            mesh->data->vertex_tex_coords[ff.b] = texcoords[s2i(parts2[1])-1];

	            explode(parts[3], deli2, parts2);
	            ff.a = s2i(parts2[0])-1;
	            mesh->data->vertex_normals[ff.a] = normals[s2i(parts2[1])-1];
	            mesh->data->vertex_tex_coords[ff.a] = texcoords[s2i(parts2[1])-1];*/


	            vsx_avector<vsx_string> parts2;
	            explode(parts[1], deli2, parts2);
	            vsx_avector<vsx_string> parts3;
	            explode(parts[2], deli2, parts3);
//.........这里部分代码省略.........
开发者ID:Spartan190,项目名称:vsxu,代码行数:101,代码来源:main.cpp



注:本文中的vsx_module_param_int类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ vsx_module_param_list类代码示例发布时间:2022-05-31
下一篇:
C++ vsx_module_param_float4类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap