本文整理汇总了C++中seq类的典型用法代码示例。如果您正苦于以下问题:C++ seq类的具体用法?C++ seq怎么用?C++ seq使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了seq类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lcs
void lcs(seq const & xs, seq const & ys, seq & an_lcs)
{
members xs_in_lcs(xs.size(), false);
calculate_lcs(xs.begin(), xs.begin(), xs.end(),
ys.begin(), ys.end(), xs_in_lcs);
set_lcs(xs.begin(), xs_in_lcs, back_inserter(an_lcs));
}
示例2: update
/// Update this element buffer into the GPU.
///
/// Empty data will not be updated.
///
/// \param data Data to update.
void update(const seq<uint16_t> &data) const
{
if(!data)
{
return;
}
#if 0
for(unsigned ii = 0; (ii < data.size()); ii += 3)
{
std::cout << data[ii] << ", " << data[ii + 1] << ", " << data[ii + 2] << std::endl;
}
#endif
bind();
dnload_glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.getSizeBytes(), data.getData(), GL_STATIC_DRAW);
#if defined(USE_LD)
vgl::increment_data_size_index(data.getSizeBytes());
#endif
}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:25,代码来源:verbatim_index_buffer.hpp
示例3:
bool operator>(const seq &b) const{
if (ave > b.getAve()) {
return true;
}
if (ave == b.getAve() && last>b.getLast()) {
return true;
}
if (ave == b.getAve() && last == b.getLast() && end < b.getEnd()) {
return true;
}
return false;
}
示例4: compile
/// Compile this shader.
///
/// Will terminate program on failure.
void compile() const
{
#if defined(USE_LD)
std::string pretty_source = this->str();
const GLchar *pretty_source_c_str = pretty_source.c_str();
dnload_glShaderSource(m_id, 1, &pretty_source_c_str, NULL);
#else
dnload_glShaderSource(m_id, m_parts.size(), const_cast<const GLchar**>(m_parts.getData()), NULL);
#endif
dnload_glCompileShader(m_id);
#if defined(USE_LD)
std::string log = GlslShaderSource::get_shader_info_log(m_id);
if(0 < log.length())
{
std::cout << GlslShaderSource::string_add_line_numbers(pretty_source) << std::endl;
std::cout << log << std::endl;
}
if(!GlslShaderSource::get_shader_compile_status(m_id))
{
teardown();
exit(1);
}
#endif
}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:30,代码来源:verbatim_shader.hpp
示例5: onExport
virtual
void onExport(iwriter & writer)
{
writer.putUnsignedInt(_columns.size());
writer.putBool(_useHighestStd);
for (uint i=0; i!=_columns.size(); ++i)
writer.putUnsignedInt(_columns[i]);
}
示例6: ZScore
ZScore(Node * const parent, const bool useHighestStd=false) :
Node(parent),
_columns(parent->output().size()),
_useHighestStd(useHighestStd)
{
_s1 = new double[_columns.size()];
_s2 = new double[_columns.size()];
for (uint i=0;i<_columns.size();++i)
_columns[i] = i;
}
示例7: getPass
/// Get pass at index.
///
/// Will create pass if not available.
///
/// \param idx Pass index.
/// \return Reference to pass.
ObjectReferenceSeq& getPass(unsigned idx)
{
unsigned req_pass_count = idx + 1;
if(m_objects.size() <= req_pass_count)
{
m_objects.resize(req_pass_count);
}
return m_objects[idx];
}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:17,代码来源:verbatim_state.hpp
示例8: newAnimationState
/// Get a fresh animation state.
///
/// Data contained in the returned animation state is undefined, but not invalid.
///
/// \return Animation state.
AnimationState& newAnimationState()
{
unsigned ret = m_current_animation_state++;
if(m_animation_states.size() <= ret)
{
m_animation_states.emplace_back();
}
return m_animation_states[ret];
}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:16,代码来源:verbatim_state.hpp
示例9: Shader
/// Constructor.
///
/// \param type GL_VERTEX_SHADER or GL_FRAGMENT_SHADER.
/// \param part1 Shader part.
Shader(GLenum type, const char *part1) :
m_id(dnload_glCreateShader(type))
{
m_parts.push_back(part1);
this->compile();
}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:11,代码来源:verbatim_shader.hpp
示例10: interpolateFrom
/// Interpolate animation frame from two other frames.
///
/// \param src Source frame (earlier).
/// \param dst Destination frame (later).
/// \param current_time Animation time.
void interpolateFrom(const AnimationFrame &lhs, const AnimationFrame &rhs, float current_time)
{
unsigned bone_count = lhs.getBoneCount();
#if defined(USE_LD)
if(rhs.getBoneCount() != bone_count)
{
std::ostringstream sstr;
sstr << "cannot interpolate between frames of size " << bone_count << " and " << rhs.getBoneCount();
BOOST_THROW_EXCEPTION(std::runtime_error(sstr.str()));
}
#endif
//std::cout << "resizing bones or not? " << m_bones.size() << " vs " << bone_count << std::endl;
m_time = current_time;
m_bones.resize(bone_count);
for(unsigned ii = 0; (bone_count > ii); ++ii)
{
const BoneState &ll = lhs.getBoneState(ii);
const BoneState &rr = rhs.getBoneState(ii);
float ltime = lhs.getTime();
float rtime = rhs.getTime();
float mix_time = (current_time - ltime) / (rtime - ltime);
vec3 mix_pos = mix(ll.getPosition(), rr.getPosition(), mix_time);
quat mix_rot = mix(ll.getRotation(), rr.getRotation(), mix_time);
//std::cout << "mix time: " << mix_time << ": " << mix_pos << " ; " << mix_rot << std::endl;
m_bones[ii] = BoneState(mix_pos, mix_rot);
}
}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:37,代码来源:verbatim_animation_frame.hpp
示例11: initFromData
/// Initialize from data.
///
/// \param data Frame data.
/// \param bone_amount Amount of bone elements.
void initFromData(const int16_t *data, unsigned frame_amount, float scale)
{
m_time = fixed_8_8_to_float(data[0]);
//std::cout << m_time << std::endl;
#if defined(USE_LD)
if((frame_amount % 7) != 0)
{
std::ostringstream sstr;
sstr << "invalid frame amount: " << frame_amount;
BOOST_THROW_EXCEPTION(std::runtime_error(sstr.str()));
}
#endif
for(unsigned ii = 1; ((frame_amount + 1) > ii); ii += 7)
{
vec3 pos(static_cast<float>(data[ii + 0]),
static_cast<float>(data[ii + 1]),
static_cast<float>(data[ii + 2]));
quat rot(fixed_4_12_to_float(data[ii + 3]),
fixed_4_12_to_float(data[ii + 4]),
fixed_4_12_to_float(data[ii + 5]),
fixed_4_12_to_float(data[ii + 6]));
//std::cout << pos << " ; " << rot << std::endl;
m_bones.emplace_back(pos * scale, rot);
}
}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:34,代码来源:verbatim_animation_frame.hpp
示例12: drawShadowCaps
/// Draw shadow caps for this state.
///
/// \param prg Program to use.
/// \param pass Which pass to draw.
void drawShadowCaps(const Program &prg, unsigned pass = 0) const
{
if(m_objects.size() > pass)
{
for(const ObjectReference &vv : m_objects[pass])
{
vv.drawShadowCaps(prg);
}
}
}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:14,代码来源:verbatim_state.hpp
示例13: duplicate
/// Duplicate from given frame.
///
/// \param op Frame to duplicate.
void duplicate(const AnimationFrame &op)
{
unsigned bone_count = op.getBoneCount();
m_time = op.getTime();
m_bones.resize(bone_count);
for(unsigned ii = 0; (bone_count > ii); ++ii)
{
m_bones[ii] = op.getBoneState(ii);
}
}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:15,代码来源:verbatim_animation_frame.hpp
示例14: onFinish
virtual void
onFinish()
{
Feature & f = output();
for (uint j=0; j!=_columns.size(); ++j)
_s1[j] = _s2[j] = 0.0;
for (ulong i=0; i<_cache.size(); i+=f.size())
{
for (uint j=0;j<_columns.size();++j)
{
const double v = _cache[i+_columns[j]];
_s1[j] += v;
_s2[j] += v*v;
}
}
if (_useHighestStd) {
double highest = -1.0;
for (uint j=0; j<_columns.size(); ++j)
{
meanNstd(_cache.size()/f.size(),
_s1[j], _s2[j], _s1[j], _s2[j]);
if (_s2[j] > highest)
highest = _s2[j];
}
for (ulong i=0; i < _cache.size(); i+= f.size())
{
for (uint j=0;j<f.size();++j)
f[j] = _cache[i+j];
for (uint j=0;j<_columns.size();++j)
f[_columns[j]] = (f[_columns[j]] - _s1[j]) / highest;
publish(f);
}
}
else
{
for (uint j=0;j <_columns.size(); ++j)
meanNstd(_cache.size()/f.size(),
_s1[j], _s2[j], _s1[j], _s2[j]);
for (ulong i=0; i<_cache.size(); i+=f.size())
{
for (uint j=0;j<f.size();++j)
f[j] = _cache[i+j];
for (uint j=0; j<_columns.size(); ++j)
f[_columns[j]] = (f[_columns[j]] - _s1[j]) / _s2[j];
publish(f);
}
}
_cache.clear();
}
示例15: initialize
/// Initializes the complete intro direction.
///
/// \param data Data blob to initialize from.
void initialize(const int16_t *data)
{
const int16_t* iter = data;
for(;;)
{
m_scenes.push_back(new Scene(iter));
iter = next_segment(next_segment(iter + 4));
if(Spline::is_segment_end(iter))
{
break;
}
}
}
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:19,代码来源:intro_direction.hpp