本文整理汇总了C++中vsx_module_param_float::set方法的典型用法代码示例。如果您正苦于以下问题:C++ vsx_module_param_float::set方法的具体用法?C++ vsx_module_param_float::set怎么用?C++ vsx_module_param_float::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vsx_module_param_float
的用法示例。
在下文中一共展示了vsx_module_param_float::set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: declare_params
void declare_params(vsx_module_param_list& in_parameters, vsx_module_param_list& out_parameters)
{
last_updated = -1.0f;
loading_done = true;
pos = (vsx_module_param_float3*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT3, "pos");
pos->set(0,0);
pos->set(0,1);
pos->set(0,2);
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);
render_result = (vsx_module_param_render*)out_parameters.create(VSX_MODULE_PARAM_ID_RENDER,"render_out");
render_result->set(0);
gr.init();
}
示例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);
}
示例3: 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]);
}
}
}
示例4: 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");
//--------------------------------------------------------------------------------------------------
}
示例5: 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));
}
}
示例6: 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);
}
示例7: 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);
//.........这里部分代码省略.........
示例8: 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();
}