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

C++ vsx_module_param_float类代码示例

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

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



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

示例1: declare_params

	void declare_params(vsx_module_param_list& in_parameters, vsx_module_param_list& out_parameters)
	{
	  loading_done = true;
	  prev_num_particles = 0;
	  in_particlesystem = (vsx_module_param_particlesystem*)in_parameters.create(VSX_MODULE_PARAM_ID_PARTICLESYSTEM,"in_particlesystem");

	  color0 = (vsx_module_param_float4*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT4, "color0");
	  color0->set(1.0f,0);
	  color0->set(1.0f,1);
	  color0->set(1.0f,2);
	  color0->set(0.3f,3);

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

	  // parameters for the effect
	  friction = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "friction");
	  friction->set(1);

	  step_length = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "step_length");
	  step_length->set(10);

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

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

		render_result = (vsx_module_param_render*)out_parameters.create(VSX_MODULE_PARAM_ID_RENDER,"render_out");
		render_result->set(0);
	}
开发者ID:Who828,项目名称:vsxu,代码行数:34,代码来源:main.cpp


示例2: declare_params

  void declare_params(vsx_module_param_list& in_parameters, vsx_module_param_list& out_parameters)
  {
    mesh_in = (vsx_module_param_mesh*)in_parameters.create(VSX_MODULE_PARAM_ID_MESH,"mesh_in");

    steps_per_second = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "steps_per_second");
    step_size = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "step_size");
    gas_amount = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "gas_amount");
    gas_expansion_factor = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "gas_expansion_factor");
    grid_stiffness_factor = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "grid_stiffness_factor");
    damping_factor = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "damping_factor");
    material_weight = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "material_weight");
    lower_boundary = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT, "lower_boundary");


    steps_per_second->set(100.0f);
    step_size->set(0.01f);
    gas_amount->set(1.0f);
    gas_expansion_factor->set(1.0f);
    grid_stiffness_factor->set(1.0f);
    damping_factor->set(0.98f);
    material_weight->set(0.00f);
    lower_boundary->set(-150.00f);


    loading_done = true;
    mesh_out = (vsx_module_param_mesh*)out_parameters.create(VSX_MODULE_PARAM_ID_MESH,"mesh_out");
    mesh_out->set_p(mesh);
    volume_out = (vsx_module_param_float*)out_parameters.create(VSX_MODULE_PARAM_ID_FLOAT,"volume_out");
    volume_out->set(0.0f);
  }
开发者ID:Who828,项目名称:vsxu,代码行数:30,代码来源:vsx_module_mesh_inflate.cpp


示例3: declare_params

void declare_params(vsx_module_param_list& in_parameters, vsx_module_param_list& out_parameters)
{
  loading_done = true;
	float_in = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT,"shutdown");
	float_in->set(0);
	render_out = (vsx_module_param_render*)out_parameters.create(VSX_MODULE_PARAM_ID_RENDER,"render_out");
  //--------------------------------------------------------------------------------------------------	
}
开发者ID:datar-pl,项目名称:vsxu,代码行数:8,代码来源:main.cpp


示例4: declare_params

  // this method uses the engine's parameter holder to create data holders for 
  // each of the parameters also binding them to their name (string)
  void declare_params(
    vsx_module_param_list& in_parameters, 
    vsx_module_param_list& out_parameters
  )
  {
    loading_done = true;
    position = (vsx_module_param_float3*)in_parameters.create(
      VSX_MODULE_PARAM_ID_FLOAT3, 
      "position"
    );
    position->set(0.0f, 0);
    position->set(0.0f, 1);
    position->set(0.0f, 2);

    size = (vsx_module_param_float3*)in_parameters.create(
      VSX_MODULE_PARAM_ID_FLOAT3, 
      "size"
    );
    size->set(1.0f,0);
    size->set(0.3f,1);
    angle = (vsx_module_param_float*)in_parameters.create(
      VSX_MODULE_PARAM_ID_FLOAT, 
      "angle"
    );
    angle->set(0.0f);

    border = (vsx_module_param_int*)in_parameters.create(
      VSX_MODULE_PARAM_ID_INT, 
      "border"
    );

    rotation_axis = (vsx_module_param_float3*)in_parameters.create(
      VSX_MODULE_PARAM_ID_FLOAT3, 
      "rotation_axis"
    );
    rotation_axis->set(1.0f, 0);
    rotation_axis->set(1.0f, 1);
    rotation_axis->set(0.0f, 2);
    color_rgb = (vsx_module_param_float4*)in_parameters.create(
      VSX_MODULE_PARAM_ID_FLOAT4, 
      "color"
    );
    color_rgb->set(1.0,0);
    color_rgb->set(1.0,1);
    color_rgb->set(1.0,2);
    color_rgb->set(1.0,3);

    render_result = (vsx_module_param_render*)out_parameters.create(
      VSX_MODULE_PARAM_ID_RENDER,
      "render_out"
    );
    render_result->set(0);
  }
开发者ID:CJFocke,项目名称:vsxu,代码行数:55,代码来源:main.cpp


示例5: 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


示例6: output

  void output(vsx_module_param_abs* param)
  {
    VSX_UNUSED(param);
    particles = in_particlesystem->get_addr();
    if (particles) {
      if (prev_num_particles != particles->particles->size())
      {
    	// remove all the old ones
    	/*for (unsigned long i = 0; i < gr.size(); i++)
    	{
    		delete gr[i];
    	}
        gr.reset_used(0);*/
        //printf("num particles: %d\n",particles->particles->size());
    	//printf("prev_num: %d\n",prev_num_particles);
        for (unsigned long i = prev_num_particles; i < particles->particles->size(); ++i) {
        	//if (i == prev_num_particles) printf("allocating again\n");
        	gr[i] = new gravity_strip;
          //printf("i: %d\n",i);
          gr[i]->init();
          gr[i]->init_strip();
        }
        prev_num_particles = particles->particles->size();
      }
      //printf("done alloc %d\n",particles->particles->size());

      for (unsigned long i = 0; i < particles->particles->size(); ++i) {
      	//gr[i].length = 0.0f;
      	gr[i]->width = ribbon_width->get();
				//gr[i].masses[1].mass = gr[i].masses[0].mass + ribbon_width->get();
				gr[i]->length = length->get();
				gr[i]->friction = friction->get();
        float tt = ((*particles->particles)[i].time/(*particles->particles)[i].lifetime);
        if (tt < 0.0f) tt = 0.0f;
        if (tt > 1.0f) tt = 1.0f;
			  gr[i]->color0[0] = color0->get(0)*tt;
			  gr[i]->color0[1] = color0->get(1)*tt;
			  gr[i]->color0[2] = color0->get(2)*tt;
			  gr[i]->color0[3] = color0->get(3)*tt;

			  gr[i]->color1[0] = color1->get(0);
			  gr[i]->color1[1] = color1->get(1);
			  gr[i]->color1[2] = color1->get(2);
			  gr[i]->step_freq = 10.0f * step_length->get();
		  	//if (last_update != engine->vtime) {
			  gr[i]->update(engine->dtime, (*(particles->particles))[i].pos.x, (*(particles->particles))[i].pos.y, (*(particles->particles))[i].pos.z);
					//last_upd ate = engine->vtime;
	  		//}
				//printf("%f, %f, %f\n", (*particles->particles)[i].pos.x, (*particles->particles)[i].pos.y, (*particles->particles)[i].pos.z);
			  gr[i]->render();
		//		printf("%d %d;;; %d\n",__LINE__,i, particles->particles->size());
        // add the delta-time to the time of the particle
        /*(*particles->particles)[i].pos.x += px*engine->dtime;
        (*particles->particles)[i].pos.y += py*engine->dtime;
        (*particles->particles)[i].pos.z += pz*engine->dtime;*/
      }
      //printf("done drawing\n");
    }
	render_result->set(1);
  }
开发者ID:Spartan190,项目名称:vsxu,代码行数:60,代码来源:main.cpp


示例7: run

  void run() {
    if (p_updates != param_updates) {
      p_updates = param_updates;
      if (directory_path->get() != "") {
        if (old_path != directory_path->get()) {
          old_path = directory_path->get();
          std::list<vsx_string> files;
          //vsxfst tt;
          vsx_string engine_resources_base_path = engine->filesystem->get_base_path();

          get_files_recursive(engine_resources_base_path + DIRECTORY_SEPARATOR + directory_path->get(), &files);

          files_list.reset_used(0);
          for (std::list<vsx_string>::iterator it = files.begin(); it != files.end(); ++it) {
            if ((*it).find(".svn/") == -1)
            {
              files_list.push_back( (*it).substr(engine_resources_base_path.size()+1));
            }
          }
        }
      }
      if (files_list.size()) {
      	filename_count->set((float)files_list.size());
        unsigned long fid = (unsigned long)floor(file_id->get());
        if (fid >= files_list.size()) fid = files_list.size()-1;
        filename_result->set(files_list[fid]);
      }
    }
  }
开发者ID:Who828,项目名称:vsxu,代码行数:29,代码来源:main.cpp


示例8: 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


示例9: map

	void map()
	{
		unsigned long new_pts = floor(abs(points->get()));
		if(pts != new_pts)
		{
			unsigned int res = 0;
			if(pts < new_pts ||  pts > 4 * new_pts) res = new_pts * 2;
			pts = new_pts;
			for(int i = 0; i < 7; i++)
			{
				map(i, res);
			}
		}
		else
		{
			for(int i = 0; i < 7; i++)
			{
				if(seqs[i]->updates)
				{
					seqs[i]->updates = 0;
					map(i);
				}
			}
		}
	}
开发者ID:datar-pl,项目名称:vsxu,代码行数:25,代码来源:main.cpp


示例10: run

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


示例11: output

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


示例12: output

	void output(vsx_module_param_abs* param) {
		gr.friction = friction->get();
	  gr.color0[0] = color0->get(0);
	  gr.color0[1] = color0->get(1);
	  gr.color0[2] = color0->get(2);
	  gr.color0[3] = color0->get(3);

	  gr.color1[0] = color1->get(0);
	  gr.color1[1] = color1->get(1);
	  gr.color1[2] = color1->get(2);
	  gr.step_freq = 10.0f * step_length->get();
	  if (last_updated != engine->vtime)
	  {
			gr.update(engine->dtime, pos->get(0), pos->get(1), pos->get(2));
			last_updated = engine->vtime;
	  }
		gr.render();
	  render_result->set(1);
	}
开发者ID:Who828,项目名称:vsxu,代码行数:19,代码来源:main.cpp


示例13: 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


示例14: 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


示例15: run

  void run() {
    vsx_mesh* p = mesh_in->get_addr();
    if (!p)
    {
      mesh_empty.timestamp = (int)(engine->real_vtime*1000.0f);
      mesh_out->set_p(mesh_empty);
      prev_timestamp = 0xFFFFFFFF;
      return;
    }

    debug = false;
    bool newMeshLoaded = false;


    //after a mesh change clone the mesh
    if (p && (prev_timestamp != p->timestamp)) {
      prev_timestamp = p->timestamp;
      mesh.data->vertices.reset_used(0);
      mesh.data->vertex_normals.reset_used(0);
      mesh.data->vertex_tex_coords.reset_used(0);
      mesh.data->vertex_colors.reset_used(0);
      mesh.data->faces.reset_used(0);

      for (unsigned int i = 0; i < p->data->vertices.size(); i++)
      {
        mesh.data->vertices[i] = p->data->vertices[i] + v;
        verticesSpeed[i] = vsx_vector(0, 0, 0);
      }

      for (unsigned int i = 0; i < p->data->vertex_normals.size(); i++) mesh.data->vertex_normals[i] = p->data->vertex_normals[i];
      for (unsigned int i = 0; i < p->data->vertex_tangents.size(); i++) mesh.data->vertex_tangents[i] = p->data->vertex_tangents[i];
      for (unsigned int i = 0; i < p->data->vertex_tex_coords.size(); i++) mesh.data->vertex_tex_coords[i] = p->data->vertex_tex_coords[i];
      for (unsigned int i = 0; i < p->data->vertex_colors.size(); i++) mesh.data->vertex_colors[i] = p->data->vertex_colors[i];
      for (unsigned int i = 0; i < p->data->faces.size(); i++) mesh.data->faces[i] = p->data->faces[i];

      //calc and store original face lengths
      faceLengths.reset_used();
      vsx_vector normal;
      vsx_vector len;
      vsx_vector hypVec;
      for (unsigned int i = 0; i < p->data->faces.size(); i++) {
        vsx_face& f = mesh.data->faces[i];
        vsx_vector& v0 = mesh.data->vertices[f.a];
        vsx_vector& v1 = mesh.data->vertices[f.b];
        vsx_vector& v2 = mesh.data->vertices[f.c];
        //calc face area
        normal.assign_face_normal(&v0, &v1, &v2);
        float area = normal.length() / 2.0f;
        faceAreas[i] = area;
        //facelengths a, b, c stored in vector x, y, z
        len.x = (v1 - v0).length();
        len.y = (v2 - v1).length();
        len.z = (v0 - v2).length();
        faceLengths.push_back(len);
      }
      mesh.timestamp++;
      param_updates = 0;

      newMeshLoaded = true;
      dtimeRest = 0.0f;
    }

    float stepSize = step_size->get();
    //float stepsPerSecond = steps_per_second->get();
    float gasExpansionFactor = gas_expansion_factor->get();
    float gridStiffnessFactor = grid_stiffness_factor->get();
    float dampingFactor =  damping_factor->get();
    float materialWeight = material_weight->get();
    float lowerBoundary = lower_boundary->get();

    //use engine->dtime; and dtimeRest
    //to repeat the calculation several times ((dtime + rest) * stepsPerSecond)



    //calculate volume
    float volume = 0.0f;
    vsx_face* face_p = mesh.data->faces.get_pointer();
    vsx_vector* vertex_p = mesh.data->vertices.get_pointer();
    vsx_vector* faces_length_p = faceLengths.get_pointer();

    verticesSpeed.allocate(mesh.data->vertices.size());
    vsx_vector* vertices_speed_p = verticesSpeed.get_pointer();

    float onedivsix = (1.0f / 6.0f);
    for(unsigned int i = 0; i < mesh.data->faces.size(); i++) {
      vsx_face& f = face_p[i];//mesh.data->faces[i];
      vsx_vector& v0 = vertex_p[f.a];
      vsx_vector& v2 = vertex_p[f.b];
      vsx_vector& v1 = vertex_p[f.c];

      volume += (v0.x * (v1.y - v2.y) +
           v1.x * (v2.y - v0.y) +
           v2.x * (v0.y - v1.y)) * (v0.z + v1.z + v2.z) * onedivsix;

    }

    //default gas_amount to volume of a new mesh i.e. no pressure
    if(newMeshLoaded) {
      gas_amount->set(volume);
//.........这里部分代码省略.........
开发者ID:Who828,项目名称:vsxu,代码行数:101,代码来源:vsx_module_mesh_inflate.cpp


示例16: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ vsx_module_param_float3类代码示例发布时间:2022-05-31
下一篇:
C++ vstring类代码示例发布时间: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