void ArchesModel::InitRenderBufferNodes(const std::string &type, const std::string &transform, std::vector<NodeBaseClassPtr> &newNodes, int &BufferWi, int &BufferHi) const { if (type == "Single Line") { BufferHi = 1; BufferWi = GetNodeCount(); int NumArches=parm1; int SegmentsPerArch=parm2; int cur = 0; for (int y=0; y < NumArches; y++) { for(int x=0; x<SegmentsPerArch; x++) { int idx = y * SegmentsPerArch + x; newNodes.push_back(NodeBaseClassPtr(Nodes[idx]->clone())); for(size_t c=0; c < newNodes[cur]->Coords.size(); c++) { newNodes[cur]->Coords[c].bufX=cur; newNodes[cur]->Coords[c].bufY=0; } cur++; } } ApplyTransform(transform, newNodes, BufferWi, BufferHi); } else { Model::InitRenderBufferNodes(type, transform, newNodes, BufferWi, BufferHi); } }
// **************************************************************************** // // Function Name: RWindowView::InvalidateVectorRect( ) // // Description: Invalidates the given vector rect in this view // // Returns: Nothing // // Exceptions: None // // **************************************************************************** // void RWindowView::InvalidateVectorRect( const RRealVectorRect& rect, BOOLEAN fErase ) { // // Only invalidate if we have a CWnd if( !GetCWnd() ) return; // Get the bounding rect... RRealRect temp = rect.m_TransformedBoundingRect; // Get our transformation... R2dTransform transform; ApplyTransform( transform, FALSE, FALSE ); // Apply it to our bounds... temp *= transform; // Convert the bounds to device units ::LogicalUnitsToDeviceUnits( temp, *this ); // guard for roundoff... const YRealDimension kRoundOffGuard = 2.0; temp.Inflate( RRealSize( kRoundOffGuard, kRoundOffGuard ) ); // Put it in a CRect and do the invalidate CRect crect( ::Round(temp.m_Left), ::Round(temp.m_Top), ::Round(temp.m_Right), ::Round(temp.m_Bottom) ); GetCWnd( ).InvalidateRect( crect, fErase ); }
Fractal_Element Fractal_Element::TransformAll(Transform t) const { Fractal_Element newFE; for(auto line_it = m_lines.begin(); line_it != m_lines.end(); line_it++) { newFE.AddLine(line_it->ApplyTransform(t)); } return newFE; }
// **************************************************************************** // // Function Name: RWindowView::ValidateVectorRect( ) // // Description: Validates the given vector rect in this view // // Returns: Nothing // // Exceptions: None // // **************************************************************************** // void RWindowView::ValidateVectorRect( const RRealVectorRect& rect ) { // // Only validate if we have a CWnd if( !GetCWnd() ) return; // Get the bounding rect... RRealVectorRect temp = rect; // Get our transformation... R2dTransform transform; ApplyTransform( transform, FALSE, FALSE ); // Apply it to our bounds... temp *= transform; // Convert the bounds to device units ::LogicalUnitsToDeviceUnits( temp, *this ); // Get the polygon points RRealPoint realPolygon[ 4 ]; temp.GetPolygonPoints( realPolygon ); // Create a polygon region RIntPoint polygon[4]; polygon[0] = realPolygon[0]; polygon[1] = realPolygon[1]; polygon[2] = realPolygon[2]; polygon[3] = realPolygon[3]; CRgn validateArea; validateArea.CreatePolygonRgn( reinterpret_cast<POINT*>( &polygon ), 4, ALTERNATE ); // Validate the region GetCWnd( ).ValidateRgn( &validateArea ); }
// Use shadow layer tree to build display list for the browser's frame. static void BuildListForLayer(Layer* aLayer, nsFrameLoader* aRootFrameLoader, const gfx3DMatrix& aTransform, nsDisplayListBuilder* aBuilder, nsDisplayList& aShadowTree, nsIFrame* aSubdocFrame) { const FrameMetrics* metrics = GetFrameMetrics(aLayer); gfx3DMatrix transform; if (metrics && metrics->IsScrollable()) { const ViewID scrollId = metrics->mScrollId; // We need to figure out the bounds of the scrollable region using the // shadow layer tree from the remote process. The metrics viewport is // defined based on all the transformations of its parent layers and // the scale of the current layer. // Calculate transform for this layer. nsContentView* view = aRootFrameLoader->GetCurrentRemoteFrame()->GetContentView(scrollId); // XXX why don't we include aLayer->GetTransform() in the inverse-scale here? // This seems wrong, but it doesn't seem to cause bugs! gfx3DMatrix applyTransform = ComputeShadowTreeTransform( aSubdocFrame, aRootFrameLoader, metrics, view->GetViewConfig(), 1 / GetXScale(aTransform), 1 / GetYScale(aTransform)); transform = applyTransform * aLayer->GetTransform() * aTransform; // As mentioned above, bounds calculation also depends on the scale // of this layer. gfx3DMatrix tmpTransform = aTransform; Scale(tmpTransform, GetXScale(applyTransform), GetYScale(applyTransform)); // Calculate rect for this layer based on aTransform. nsRect bounds; { nscoord auPerDevPixel = aSubdocFrame->PresContext()->AppUnitsPerDevPixel(); bounds = metrics->mViewport.ToAppUnits(auPerDevPixel); ApplyTransform(bounds, tmpTransform, auPerDevPixel); } aShadowTree.AppendToTop( new (aBuilder) nsDisplayRemoteShadow(aBuilder, aSubdocFrame, bounds, scrollId)); } else { transform = aLayer->GetTransform() * aTransform; } for (Layer* child = aLayer->GetFirstChild(); child; child = child->GetNextSibling()) { BuildListForLayer(child, aRootFrameLoader, transform, aBuilder, aShadowTree, aSubdocFrame); } }
void Sprite::Draw(RECT *prect_screenregion, RECT *prect_textureregion, D3DXVECTOR3 *pCenter, D3DCOLOR color) { if (Sprite::GetVisible()) { RECT *rect = prect_screenregion; Translate((float)rect->left, (float)rect->top); Scale((float)(rect->right - rect->left) / (float)m_width_texture, (float)(rect->bottom - rect->top) / (float)m_height_texture); ApplyTransform(); Draw(prect_textureregion, pCenter, color); } }
int Model::Draw() { int drawCalls = 0; if (shader) shader->Use(); rc->PushModelView(); ApplyTransform(); for (int i = 0, s = meshes.size(); i < s; i++) { if (meshes[i].Draw()) drawCalls++; } rc->PopModelView(); return drawCalls; }
void Camera::Set() { flags = REQUIRE_REBUILD | REQUIRE_REBUILD_MODEL | REQUIRE_REBUILD_PROJECTION; if (flags & REQUIRE_REBUILD) { RebuildCameraFromValues(); } ApplyFrustum(); ApplyTransform(); if (currentFrustum) { currentFrustum->Set(); } }
//---------------------------------------------------------------------------- bool PolyhedronDistance::OnKeyDown (unsigned char key, int x, int y) { if (ApplyTransform(key)) { mCuller.ComputeVisibleSet(mScene); return true; } switch (key) { case 'w': // toggle wireframe mWireState->Enabled = !mWireState->Enabled; return true; } return WindowApplication3::OnKeyDown(key, x, y); }
void Plant::ApplyTransform(SceneNode* arg, float branchLen) { float outBranchLen = branchLen - 1.0f; if (arg->GetNumChild() > 0) { for (unsigned int i = 0; i < arg->GetNumChild(); ++i) { if ((branchLen < 1.0f) && (arg->GetChildAt(i)->GetModelScale().x < 11.0f)) { arg->GetChildAt(i)->SetModelScale(arg->GetChildAt(i)->GetModelScale() + Vector3(growRate * 2,growRate * 2,growRate * 2)); } if (arg->GetChildAt(i)->GetModelScale().x < branchLen) { arg->GetChildAt(i)->SetModelScale(arg->GetChildAt(i)->GetModelScale() + Vector3(growRate,0.1,growRate)); } else { ApplyTransform(arg->GetChildAt(i), outBranchLen); } } } }
// **************************************************************************** // // Function Name: RWindowView::GetCursorPosition( ) // // Description: Gets the current cursor position within this view // // Returns: Nothing // // Exceptions: None // // **************************************************************************** // RRealPoint RWindowView::GetCursorPosition( ) const { // Get the absolute cursor position POINT pt; ::GetCursorPos( &pt ); // Convert to client coordinates GetCWnd( ).ScreenToClient( &pt ); RRealPoint cursorPosition( pt.x, pt.y ); // Convert to logical units ::DeviceUnitsToLogicalUnits( cursorPosition, *this ); // Get our transform R2dTransform transform; ApplyTransform( transform, FALSE, FALSE ); // Invert the transform and convert the point to our coordinate system transform.Invert( ); return cursorPosition * transform; }
int AutoCorrelation::Run() { int status = 0; /* try {*/ size_t count = 0; pixel_t * dataset = mIoAgent->GetDataset(count); mOutput = mIoAgent->GetOuptBuffer(); status = ApplyTransform(dataset, count); /* } catch(exception &e) { status = -1; }*/ return status; }
void Sprite::Update(float deltaTime) { Mat3 translation = (translation.CreateTranslation( Vector3( m_position))); Mat3 rotation = (rotation.CreateRotation(m_rotation)); m_transform = rotation * translation; if (m_parent) { m_worldTransform = m_transform * m_parent->GetWorldTransform(); } else { m_worldTransform = m_transform; } for (auto i = m_children.begin(); i != m_children.end(); i++) { (*i)->Update(deltaTime); } ApplyTransform(); }
void Box::OnUpdateTransform() { ApplyTransform(GetTransform()); }
void Plant::Update(float msec) { ApplyTransform(this, branchLength); SceneNode::Update(msec); }
void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) { GuiLock __; LEVELCHECK(w, this); LTIMING("CtrlPaint"); Rect rect = GetRect().GetSize(); Rect orect = rect.Inflated(overpaint); if(!IsShown() || orect.IsEmpty() || clip.IsEmpty() || !clip.Intersects(orect)) return; glPushMatrix(); ApplyTransform(TS_BEFORE_CTRL_PAINT); Ctrl *q; Rect view = rect; for(int i = 0; i < frame.GetCount(); i++) { LEVELCHECK(w, NULL); frame[i].frame->FramePaint(w, view); view = frame[i].view; } Rect oview = view.Inflated(overpaint); bool hasviewctrls = false; bool viewexcluded = false; for(q = firstchild; q; q = q->next) if(q->IsShown()) if(q->InFrame()) { if(!viewexcluded && IsTransparent() && q->GetRect().Intersects(view)) { w.Begin(); w.ExcludeClip(view); viewexcluded = true; } LEVELCHECK(w, q); Point off = q->GetRect().TopLeft(); w.Offset(off); q->CtrlPaint(w, clip - off); w.End(); } else hasviewctrls = true; if(viewexcluded) w.End(); //DOLEVELCHECK; if(!oview.IsEmpty() && oview.Intersects(clip)) { LEVELCHECK(w, this); if(cliptobounds) w.Clip(overpaint ? oview : view); w.Offset(view.left, view.top); Paint(w); PaintCaret(w); w.End(); if(hasviewctrls && !view.IsEmpty()) { Rect cl = clip & view; for(q = firstchild; q; q = q->next) if(q->IsShown() && q->InView()) { Rect rr(q->popup ? clip : cl); LEVELCHECK(w, q); Rect qr = q->GetRect(); Point off = qr.TopLeft() + view.TopLeft(); Rect ocl = cl - off; if(ocl.Intersects(Rect(qr.GetSize()).Inflated(overpaint))) { w.Offset(off); q->CtrlPaint(w, rr - off); w.End(); } } } if(cliptobounds) w.End(); } ApplyTransform(TS_AFTER_CTRL_PAINT); glPopMatrix(); }
void Sphere::Draw() { CreateVBO(); ApplyTransform(); glDrawElements(GL_TRIANGLE_STRIP, m_indices.size(), GL_UNSIGNED_INT, 0); }