本文整理汇总了C++中FloatPoint3D函数的典型用法代码示例。如果您正苦于以下问题:C++ FloatPoint3D函数的具体用法?C++ FloatPoint3D怎么用?C++ FloatPoint3D使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FloatPoint3D函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FloatPoint3D
void PannerNode::setPosition(float x, float y, float z)
{
FloatPoint3D position = FloatPoint3D(x, y, z);
if (m_position == position)
return;
// This synchronizes with process().
MutexLocker processLocker(m_processLock);
m_position = position;
markPannerAsDirty(PannerNode::AzimuthElevationDirty | PannerNode::DistanceConeGainDirty | PannerNode::DopplerRateDirty);
}
示例2: TEST_F
TEST_F(PaintPropertyTreeBuilderTest, Transform)
{
loadTestData("transform.html");
Element* transform = document().getElementById("transform");
ObjectPaintProperties* transformProperties = transform->layoutObject()->objectPaintProperties();
EXPECT_EQ(TransformationMatrix().translate3d(123, 456, 789), transformProperties->transform()->matrix());
EXPECT_EQ(FloatPoint3D(200, 150, 0), transformProperties->transform()->origin());
EXPECT_EQ(transformProperties->paintOffsetTranslation(), transformProperties->transform()->parent());
EXPECT_EQ(TransformationMatrix().translate(50, 100), transformProperties->paintOffsetTranslation()->matrix());
EXPECT_EQ(document().view()->scrollTranslation(), transformProperties->paintOffsetTranslation()->parent());
}
示例3: TEST
TEST(TransformationMatrixTest, ApplyTransformOrigin) {
TransformationMatrix matrix;
// (0,0,0) is a fixed point of this scale.
// (1,1,1) should be scaled appropriately.
matrix.scale3d(2, 3, 4);
EXPECT_EQ(FloatPoint3D(0, 0, 0), matrix.mapPoint(FloatPoint3D(0, 0, 0)));
EXPECT_EQ(FloatPoint3D(2, 3, -4), matrix.mapPoint(FloatPoint3D(1, 1, -1)));
// With the transform origin applied, (1,2,3) is the fixed point.
// (0,0,0) should be scaled according to its distance from (1,2,3).
matrix.applyTransformOrigin(1, 2, 3);
EXPECT_EQ(FloatPoint3D(1, 2, 3), matrix.mapPoint(FloatPoint3D(1, 2, 3)));
EXPECT_EQ(FloatPoint3D(-1, -4, -9), matrix.mapPoint(FloatPoint3D(0, 0, 0)));
}
示例4: createPaintOffsetTranslationIfNeeded
static PassRefPtr<TransformPaintPropertyNode> createPaintOffsetTranslationIfNeeded(const LayoutBoxModelObject& object, PaintPropertyTreeBuilderContext& context)
{
// TODO(trchen): Eliminate PaintLayer dependency.
bool shouldCreatePaintOffsetTranslationNode = object.layer() && object.layer()->paintsWithTransform(GlobalPaintNormalPhase);
if (context.paintOffset == LayoutPoint() || !shouldCreatePaintOffsetTranslationNode)
return nullptr;
RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTranslation = TransformPaintPropertyNode::create(
TransformationMatrix().translate(context.paintOffset.x(), context.paintOffset.y()),
FloatPoint3D(), context.currentTransform);
context.currentTransform = newTransformNodeForPaintOffsetTranslation.get();
context.paintOffset = LayoutPoint();
return newTransformNodeForPaintOffsetTranslation.release();
}
示例5: AudioNode
PannerNode::PannerNode(float sampleRate) : AudioNode(sampleRate), m_panningModel(PanningMode::HRTF)
{
m_distanceEffect.reset(new DistanceEffect());
m_coneEffect.reset(new ConeEffect());
addInput(unique_ptr<AudioNodeInput>(new AudioNodeInput(this)));
addOutput(unique_ptr<AudioNodeOutput>(new AudioNodeOutput(this, 2)));
m_distanceGain = std::make_shared<AudioParam>("distanceGain", 1.0, 0.0, 1.0);
m_coneGain = std::make_shared<AudioParam>("coneGain", 1.0, 0.0, 1.0);
m_position = FloatPoint3D(0, 0, 0);
m_orientation = FloatPoint3D(1, 0, 0);
m_velocity = FloatPoint3D(0, 0, 0);
// Node-specific default mixing rules.
m_channelCount = 2;
m_channelCountMode = ChannelCountMode::ClampedMax;
m_channelInterpretation = ChannelInterpretation::Speakers;
setNodeType(NodeTypePanner);
initialize();
}
示例6: computeLocalTransform
void TextureMapperNode::computeTransformations()
{
if (!m_transforms.dirty)
return;
m_transforms.dirty = false;
if ((m_size.isEmpty() && m_state.masksToBounds))
return;
TextureMapperNode* parent = m_parent;
computeLocalTransform();
m_transforms.target = TransformationMatrix(parent ? parent->m_transforms.forDescendants : TransformationMatrix()).multiply(m_transforms.local);
m_transforms.forDescendants = (m_layerType == ClipLayer ? TransformationMatrix() : m_transforms.target);
if (m_effectTarget)
return;
m_transforms.targetBoundingRect = IntRect(m_transforms.target.mapRect(entireRect()));
if (m_state.replicaLayer)
m_state.replicaLayer->computeTransformations();
flattenTo2DSpaceIfNecessary();
if (!m_state.backfaceVisibility && m_transforms.target.inverse().m33() < 0) {
m_state.visible = false;
return;
}
m_state.visible = true;
if (parent && parent->m_state.preserves3D)
m_transforms.centerZ = m_transforms.target.mapPoint(FloatPoint3D(m_size.width() / 2, m_size.height() / 2, 0)).z();
if (!m_children.size())
return;
if (m_state.childrenTransform.isIdentity())
return;
const FloatPoint centerPoint = FloatPoint(m_size.width() / 2, m_size.height() / 2);
if (m_transforms.perspectiveDirty)
m_transforms.perspective = TransformationMatrix()
.translate(centerPoint.x(), centerPoint.y())
.multiply(m_state.childrenTransform)
.translate(-centerPoint.x(), -centerPoint.y());
m_transforms.perspectiveDirty = false;
m_transforms.forDescendants.multiply(m_transforms.perspective);
}
示例7: toLayoutSVGRoot
void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
if (!object.isSVGRoot())
return;
AffineTransform transform = AffineTransform::translation(context.paintOffset.x().toFloat(), context.paintOffset.y().toFloat());
transform *= toLayoutSVGRoot(object).localToBorderBoxTransform();
if (transform.isIdentity())
return;
RefPtr<TransformPaintPropertyNode> svgLocalToBorderBoxTransform = TransformPaintPropertyNode::create(
transform, FloatPoint3D(0, 0, 0), context.currentTransform);
context.currentTransform = svgLocalToBorderBoxTransform.get();
context.paintOffset = LayoutPoint();
object.getMutableForPainting().ensureObjectPaintProperties().setSvgLocalToBorderBoxTransform(svgLocalToBorderBoxTransform.release());
}
示例8: ensureRootLayer
void CoordinatedGraphicsScene::ensureRootLayer()
{
if (m_rootLayer)
return;
m_rootLayer = GraphicsLayer::create(0 /* factory */, this);
m_rootLayer->setMasksToBounds(false);
m_rootLayer->setDrawsContent(false);
m_rootLayer->setAnchorPoint(FloatPoint3D(0, 0, 0));
// The root layer should not have zero size, or it would be optimized out.
m_rootLayer->setSize(FloatSize(1.0, 1.0));
ASSERT(m_textureMapper);
toTextureMapperLayer(m_rootLayer.get())->setTextureMapper(m_textureMapper.get());
}
示例9: FloatPoint3D
void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPropertyTreeBuilderContext& context)
{
// Only create extra root clip and transform nodes when RLS is enabled, because the main frame
// unconditionally create frame translation / clip nodes otherwise.
if (rootFrame.frame().settings() && rootFrame.frame().settings()->rootLayerScrolls()) {
transformRoot = TransformPaintPropertyNode::create(TransformationMatrix(), FloatPoint3D(), nullptr);
context.currentTransform = context.transformForAbsolutePosition = context.transformForFixedPosition = transformRoot.get();
clipRoot = ClipPaintPropertyNode::create(transformRoot, FloatRoundedRect(LayoutRect::infiniteIntRect()), nullptr);
context.currentClip = context.clipForAbsolutePosition = context.clipForFixedPosition = clipRoot.get();
}
// The root frame never creates effect node so we unconditionally create a root node here.
effectRoot = EffectPaintPropertyNode::create(1.0, nullptr);
context.currentEffect = effectRoot.get();
}
示例10: ensureRootLayer
void CoordinatedGraphicsScene::ensureRootLayer()
{
if (m_rootLayer)
return;
m_rootLayer = std::make_unique<TextureMapperLayer>();
m_rootLayer->setMasksToBounds(false);
m_rootLayer->setDrawsContent(false);
m_rootLayer->setAnchorPoint(FloatPoint3D(0, 0, 0));
// The root layer should not have zero size, or it would be optimized out.
m_rootLayer->setSize(FloatSize(1.0, 1.0));
ASSERT(m_textureMapper);
m_rootLayer->setTextureMapper(m_textureMapper.get());
}
示例11: TEST_F
TEST_F(PaintPropertyTreeBuilderTest, Perspective)
{
loadTestData("perspective.html");
Element* perspective = document().getElementById("perspective");
ObjectPaintProperties* perspectiveProperties = perspective->layoutObject()->objectPaintProperties();
EXPECT_EQ(TransformationMatrix().applyPerspective(100), perspectiveProperties->perspective()->matrix());
// The perspective origin is the center of the border box plus accumulated paint offset.
EXPECT_EQ(FloatPoint3D(250, 250, 0), perspectiveProperties->perspective()->origin());
EXPECT_EQ(document().view()->scrollTranslation(), perspectiveProperties->perspective()->parent());
// Adding perspective doesn't clear paint offset. The paint offset will be passed down to children.
Element* inner = document().getElementById("inner");
ObjectPaintProperties* innerProperties = inner->layoutObject()->objectPaintProperties();
EXPECT_EQ(TransformationMatrix().translate(50, 100), innerProperties->paintOffsetTranslation()->matrix());
EXPECT_EQ(perspectiveProperties->perspective(), innerProperties->paintOffsetTranslation()->parent());
}
示例12: toLayoutBox
void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
if (object.hasOverflowClip()) {
const LayoutBox& box = toLayoutBox(object);
const PaintLayerScrollableArea* scrollableArea = box.getScrollableArea();
IntSize scrollOffset = box.scrolledContentOffset();
if (!scrollOffset.isZero() || scrollableArea->scrollsOverflow()) {
TransformationMatrix matrix = TransformationMatrix().translate(
-scrollOffset.width(), -scrollOffset.height());
object.getMutableForPainting()
.ensurePaintProperties()
.updateScrollTranslation(
context.current.transform, matrix, FloatPoint3D(),
context.current.shouldFlattenInheritedTransform,
context.current.renderingContextID);
IntSize scrollClip = scrollableArea->visibleContentRect().size();
IntSize scrollBounds = scrollableArea->contentsSize();
bool userScrollableHorizontal =
scrollableArea->userInputScrollable(HorizontalScrollbar);
bool userScrollableVertical =
scrollableArea->userInputScrollable(VerticalScrollbar);
object.getMutableForPainting().ensurePaintProperties().updateScroll(
context.current.scroll, object.paintProperties()->scrollTranslation(),
scrollClip, scrollBounds, userScrollableHorizontal,
userScrollableVertical);
} else {
// Ensure pre-existing properties are cleared when there is no
// scrolling.
auto* properties = object.getMutableForPainting().paintProperties();
if (properties) {
properties->clearScrollTranslation();
properties->clearScroll();
}
}
}
if (object.paintProperties() && object.paintProperties()->scroll()) {
context.current.transform = object.paintProperties()->scrollTranslation();
const auto* scroll = object.paintProperties()->scroll();
// TODO(pdr): Remove this const cast.
context.current.scroll = const_cast<ScrollPaintPropertyNode*>(scroll);
context.current.shouldFlattenInheritedTransform = false;
}
}
示例13: createScrollTranslationIfNeeded
static PassRefPtr<TransformPaintPropertyNode> createScrollTranslationIfNeeded(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
if (!object.isBoxModelObject() || !object.hasOverflowClip())
return nullptr;
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
ASSERT(layer);
DoubleSize scrollOffset = layer->scrollableArea()->scrollOffset();
if (scrollOffset.isZero() && !layer->scrollsOverflow())
return nullptr;
RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = TransformPaintPropertyNode::create(
TransformationMatrix().translate(-scrollOffset.width(), -scrollOffset.height()),
FloatPoint3D(), context.currentTransform);
context.currentTransform = newTransformNodeForScrollTranslation.get();
return newTransformNodeForScrollTranslation.release();
}
示例14: toLayoutBoxModelObject
void PaintPropertyTreeBuilder::updateScrollTranslation(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
if (!object.isBoxModelObject() || !object.hasOverflowClip())
return;
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
ASSERT(layer);
DoubleSize scrollOffset = layer->getScrollableArea()->scrollOffset();
if (scrollOffset.isZero() && !layer->scrollsOverflow())
return;
RefPtr<TransformPaintPropertyNode> scrollTranslation = TransformPaintPropertyNode::create(
TransformationMatrix().translate(-scrollOffset.width(), -scrollOffset.height()),
FloatPoint3D(),
context.currentTransform);
context.currentTransform = scrollTranslation.get();
object.getMutableForPainting().ensureObjectPaintProperties().setScrollTranslation(scrollTranslation.release());
}
示例15: roundedIntPoint
// TODO(trchen): Remove this once we bake the paint offset into frameRect.
void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& object, const PaintPropertyTreeBuilderContext& context)
{
IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset);
if (roundedPaintOffset == IntPoint())
return;
if (!object.isBoxModelObject())
return;
PaintLayerScrollableArea* scrollableArea = toLayoutBoxModelObject(object).getScrollableArea();
if (!scrollableArea)
return;
if (!scrollableArea->horizontalScrollbar() && !scrollableArea->verticalScrollbar())
return;
auto paintOffset = TransformationMatrix().translate(roundedPaintOffset.x(), roundedPaintOffset.y());
object.getMutableForPainting().ensureObjectPaintProperties().setScrollbarPaintOffset(
TransformPaintPropertyNode::create(paintOffset, FloatPoint3D(), context.currentTransform));
}