本文整理汇总了C++中Visual类的典型用法代码示例。如果您正苦于以下问题:C++ Visual类的具体用法?C++ Visual怎么用?C++ Visual使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Visual类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnFirstUpdate
void SkinController::OnFirstUpdate()
{
// Get access to the vertex buffer positions to store the blended targets.
Visual* visual = reinterpret_cast<Visual*>(mObject);
VertexBuffer* vbuffer = visual->GetVertexBuffer().get();
if (mNumVertices == static_cast<int>(vbuffer->GetNumElements()))
{
// Get the position data.
VertexFormat vformat = vbuffer->GetFormat();
int const numAttributes = vformat.GetNumAttributes();
for (int i = 0; i < numAttributes; ++i)
{
VASemantic semantic;
DFType type;
unsigned int unit, offset;
if (vformat.GetAttribute(i, semantic, type, unit, offset))
{
if (semantic == VA_POSITION && (type == DF_R32G32B32_FLOAT
|| type == DF_R32G32B32A32_FLOAT))
{
mPosition = vbuffer->GetData() + offset;
mStride = vformat.GetVertexSize();
mCanUpdate = true;
break;
}
}
}
}
mCanUpdate = (mPosition != nullptr);
}
示例2: while
Point MouseEventArgs::GetPosition(UIElement* relativeTo)
{
gm::matrix3f m = gm::matrix3f::getIdentity();
Visual* p = relativeTo;
Visual* parent;
while (parent = p->get_Parent())
{
Transform* transform = p->get_Transform();
if (transform)
{
m *= transform->get_Matrix();
}
p = parent;
}
return m.getInverse().transform(m_clientpos);
/*
Visual* visual = dynamic_cast<Visual*>(relativeTo);
ASSERT(visual);
return visual->WindowToElement(m_windowX, m_windowY);
*/
}
示例3: DataMap
void Pdb::Explorer()
{
VectorMap<String, Value> prev = DataMap(explorer);
explorer.Clear();
try {
String x = ~expexp;
if(!IsNull(x)) {
CParser p(x);
Val v = Exp(p);
Vis(explorer, "=", prev, Visualise(v));
if(v.type >= 0 && v.ref == 0 && !v.rvalue)
Explore(v, prev);
if(v.ref > 0 && GetRVal(v).address)
for(int i = 0; i < 20; i++)
Vis(explorer, Format("[%d]", i), prev, Visualise(DeRef(Compute(v, RValue(i), '+'))));
}
}
catch(CParser::Error e) {
Visual v;
v.Cat(e, LtRed);
explorer.Add("", RawPickToValue(v));
}
exback.Enable(exprev.GetCount());
exfw.Enable(exnext.GetCount());
}
示例4: get_Clip
geometry UIElement::MakeVisibleGeometry(geometry clip)
{
m_visibleGeometryValid = true;
//gm::RectF bounds = clip.GetBounds();
geometry clipThis = get_Clip();
if (clipThis != nullptr)
{
clip &= clipThis;
}
#ifdef _DEBUG
gm::RectF bounds = clip.GetBounds();
#endif
geometry geom = GetHitGeometry();
#ifdef _DEBUG
gm::RectF bounds2 = geom.GetBounds();
#endif
clip &= geom;
#ifdef _DEBUG
gm::RectF bounds3 = clip.GetBounds();
#endif
size_t nchildren = GetChildrenCount();
for (size_t i = nchildren; i > 0; --i)
{
Visual* child = GetChild(i-1);
geometry geom2 = child->MakeVisibleGeometry(clip);
clip |= geom2;
}
UIElement* shadowTree = get_ShadowTree();
if (shadowTree)
{
geometry geom2 = shadowTree->MakeVisibleGeometry(clip);
#ifdef _DEBUG
gm::RectF bounds5 = geom2.GetBounds();
#endif
clip |= geom2;
}
#ifdef _DEBUG
gm::RectF bounds4 = clip.GetBounds();
#endif
set_VisibleGeometry(clip);
return clip;
}
示例5: assertion
//----------------------------------------------------------------------------
bool MorphController::Update (double applicationTime)
{
// The key interpolation uses linear interpolation. To get higher-order
// interpolation, you need to provide a more sophisticated key (Bezier
// cubic or TCB spline, for example).
if (!Controller::Update(applicationTime))
{
return false;
}
// Get access to the vertex buffer to store the blended targets.
Visual* visual = StaticCast<Visual>(mObject);
assertion(visual->GetVertexBuffer()->GetNumElements() == mNumVertices,
"Mismatch in number of vertices.\n");
VertexBufferAccessor vba(visual);
// Set vertices to target[0].
APoint* baseTarget = mVertices[0];
int i;
for (i = 0; i < mNumVertices; ++i)
{
vba.Position<Float3>(i) = baseTarget[i];
}
// Look up the bounding keys.
float ctrlTime = (float)GetControlTime(applicationTime);
float normTime;
int i0, i1;
GetKeyInfo(ctrlTime, normTime, i0, i1);
// Add the remaining components in the convex composition.
float* weights0 = mWeights[i0];
float* weights1 = mWeights[i1];
for (i = 1; i < mNumTargets; ++i)
{
// Add in the delta-vertices of target[i].
float coeff = (1.0f-normTime)*weights0[i-1] + normTime*weights1[i-1];
AVector* target = (AVector*)mVertices[i];
for (int j = 0; j < mNumVertices; ++j)
{
APoint position = vba.Position<Float3>(j);
position += coeff*target[j];
vba.Position<Float3>(j) = position;
}
}
visual->UpdateModelSpace(Visual::GU_NORMALS);
Renderer::UpdateAll(visual->GetVertexBuffer());
return true;
}
示例6: Visualise
void Pdb::AddThis(const VectorMap<String, Val>& m, adr_t address, const VectorMap<String, Value>& prev)
{
for(int i = 0; i < m.GetCount() && self.GetCount() < 2000; i++) {
Val mv = m[i];
mv.address += address;
Visual vis;
try {
vis = Visualise(mv);
}
catch(CParser::Error e) {
vis.Cat(e, SColorDisabled);
}
Vis(self, m.GetKey(i), prev, vis);
}
}
示例7: assertion
//----------------------------------------------------------------------------
void Delaunay3D::ChangeTetraStatus (int index, const Float4& color,
bool enableWire)
{
Visual* tetra = DynamicCast<Visual>(mScene->GetChild(1 + index));
assertion(tetra != 0, "Expecting a Visual object.\n");
VertexBufferAccessor vba(tetra);
for (int i = 0; i < 4; ++i)
{
vba.Color<Float4>(0, i) = color;
}
mRenderer->Update(tetra->GetVertexBuffer());
VisualEffectInstance* instance = tetra->GetEffectInstance();
instance->GetEffect()->GetWireState(0, 0)->Enabled = enableWire;
}
示例8: p
void Pdb::TryAuto(const String& exp, const VectorMap<String, Value>& prev)
{
if(autos.Find(exp) < 0) {
Visual r;
try {
CParser p(exp);
Val v = Exp(p);
Visualise(r, v, 2);
}
catch(CParser::Error) {
r.Clear();
}
if(r.part.GetCount())
Vis(autos, exp, prev, r);
}
}
示例9: Draw
//----------------------------------------------------------------------------
void SMShadowEffect::Draw (Renderer* renderer, const VisibleSet& visibleSet)
{
const int numVisible = visibleSet.GetNumVisible();
for (int j = 0; j < numVisible; ++j)
{
// Replace the object's effect instance by the shadow-effect instance.
Visual* visual = (Visual*)visibleSet.GetVisible(j);
VisualEffectInstancePtr save = visual->GetEffectInstance();
visual->SetEffectInstance(mInstance);
// Draw the object using the shadow effect.
renderer->Draw(visual);
// Restore the object's effect instance.
visual->SetEffectInstance(save);
}
}
示例10: GetWorldTransform
void Camera::Render(Context* context)
{
float aspect = 1.0f;
cachedproj.SetPerspective(fov, aspect, 0.1f, 100.0f);
cachedview = GetWorldTransform().Inverse();
Node* root = GetRoot();
for(Node* node = root; node; node=node->GetNext())
{
if(node->HasFlag(Node::VISUAL))
{
Visual* visual = static_cast<Visual*>(node);
visual->Render(context, this);
}
else if(node->HasFlag(Node::LIGHT))
{
// render a light shape
}
}
}
示例11: GetChild
UIElement* UIElement::HitTest(gm::PointF point)
{
int nchildren = (int)GetChildrenCount();
for (int i = nchildren-1; i >= 0; --i)
{
Visual* child = GetChild(i);
ASSERT(child);
UIElement* hitElement = child->HitTest_(point);
if (hitElement != nullptr)
{
return hitElement;
}
}
/*
// TODO remove, done above?
UIElement* shadowTree = get_ShadowTree();
if (shadowTree)
{
UIElement* hitElement = shadowTree->HitTest_(point);
if (hitElement)
{
return hitElement;
}
}
*/
geometry hitGeometry = GetHitGeometry();
// geometry hitGeometry = get_VisibleGeometry();
// if (hitGeometry != nullptr)
{
if (hitGeometry.FillContains(point))
{
return this;
}
}
return nullptr;
}
示例12: assertion
//----------------------------------------------------------------------------
bool SkinController::Update (double applicationTime)
{
if (!Controller::Update(applicationTime))
{
return false;
}
// Get access to the vertex buffer to store the blended targets.
Visual* visual = StaticCast<Visual>(mObject);
assertion(mNumVertices == visual->GetVertexBuffer()->GetNumElements(),
"Controller must have the same number of vertices as the buffer\n");
VertexBufferAccessor vba(visual);
// The skin vertices are calculated in the bone world coordinate system,
// so the visual's world transform must be the identity.
visual->WorldTransform = Transform::IDENTITY;
visual->WorldTransformIsCurrent = true;
// Compute the skin vertex locations.
for (int vertex = 0; vertex < mNumVertices; ++vertex)
{
APoint position = APoint::ORIGIN;
for (int bone = 0; bone < mNumBones; ++bone)
{
float weight = mWeights[vertex][bone];
if (weight != 0.0f)
{
APoint offset = mOffsets[vertex][bone];
APoint worldOffset = mBones[bone]->WorldTransform*offset;
position += weight*worldOffset;
}
}
vba.Position<Float3>(vertex) = position;
}
visual->UpdateModelSpace(Visual::GU_NORMALS);
Renderer::UpdateAll(visual->GetVertexBuffer());
return true;
}
示例13: Size
bool Pdb::Tip(const String& exp, CodeEditor::MouseTip& mt)
{
/* mt.display = &StdDisplay();
mt.value = exp;
mt.sz = Size(100, 20);
return true;*/
DR_LOG("Pdb::Tip");
Visual r;
try {
CParser p(exp);
Val v = Exp(p);
Visualise(r, v, 2);
if(r.part.GetCount()) {
mt.sz = r.GetSize() + Size(4, 4);
mt.value = RawPickToValue(r);
mt.display = &Single<VisualDisplay>();
DR_LOG("Pdb::Tip true");
return true;
}
}
catch(CParser::Error) {}
DR_LOG("Pdb::Tip false");
return false;
}
示例14: SetWindow
void SetWindow(CoreWindow const & window)
{
Compositor compositor;
ContainerVisual root = compositor.CreateContainerVisual();
m_target = compositor.CreateTargetForCurrentView();
m_target.Root(root);
m_visuals = root.Children();
window.PointerPressed([&](auto const &, PointerEventArgs const & args)
{
Point point = args.CurrentPoint().Position();
if (args.KeyModifiers() == VirtualKeyModifiers::Control)
{
AddVisual(point);
}
else
{
SelectVisual(point);
}
});
window.PointerMoved([&](auto const &, PointerEventArgs const & args)
{
if (m_selected)
{
Point point = args.CurrentPoint().Position();
m_selected.Offset(Vector3
{
point.X + m_offset.X,
point.Y + m_offset.Y
});
}
});
window.PointerReleased([&](auto const &, auto const &)
{
m_selected = nullptr;
});
}
示例15: parseVisual
bool parseVisual(Visual &vis, TiXmlElement *config)
{
vis.clear();
// Origin
TiXmlElement *o = config->FirstChildElement("origin");
if (o) {
if (!parsePose(vis.origin, o))
return false;
}
// Geometry
TiXmlElement *geom = config->FirstChildElement("geometry");
vis.geometry = parseGeometry(geom);
if (!vis.geometry)
return false;
const char *name_char = config->Attribute("name");
if (name_char)
vis.name = name_char;
// Material
TiXmlElement *mat = config->FirstChildElement("material");
if (mat) {
// get material name
if (!mat->Attribute("name")) {
logError("Visual material must contain a name attribute");
return false;
}
vis.material_name = mat->Attribute("name");
// try to parse material element in place
resetPtr(vis.material,new Material());
if (!parseMaterial(*vis.material, mat, true))
{
logDebug("urdfdom: material has only name, actual material definition may be in the model");
}
}
return true;
}