Similar Threads
1. Maya Plugin API : Rendering a custom shape node
2. PSP7: Fancy node editing -- Copying and pasting nodes to combine shapes
Hi Tom the Almost Ugly,
In a message
| Date: Tue, 29 Sep 2009 17:19:38 -0700 (PDT)
| Subject: PSP7: Fancy node editing -- Copying and pasting nodes to combine shapes
| Message-ID: < XXXX@XXXXX.COM >
you wrote:
>How do I paste the nodes of one vector into a second vector, and get
>PSP7 to treat the nodes as part of that vector?
>
>In other words, how do I create these two vectors?...
>
>KEYHOLE: Combine a circle and an equilateral triangle into one vector.
>The arc of the circle inside the equilateral triangle is gone, and the
>apex of the triangle inside the circle is gone, leaving just the
>"keyhole" shape. Fill the keyhole-vector with black.
>
>SNOWMAN: Create three circles of decreasing diameters, stacked smaller
>circle atop bigger. Get rid of the interior circle arcs to leave only
>the "snowman" shape. Fill the snowman-vector with white.
Draw Shapes Vector Tool Right-click Node edit
Depending where nodes are and how you ultimately wish the shape to
look like ..if NODE right where you want it Select it (on node at a
time) ..by, drawing a selection box around the node ..using the Vector
Tool. i.e. if you touch the node by / or to select ..it usually
moves, drawing a selection box around it ends up selecting it without
moving. What are we doing or going to do.. remove the section
that'll be / would be overlapping. So.. selected keyboard combo
short-cut [Control + K] break.
ZOOOM in really really close notice the PATH direction right there
now are TWO nodes side by side ..END probably should be the part you
want to have remain. Start should be part of what is needed to be
removed. Grab ahold of that ..move it slightly (just so its easier to
grab onto and or for selection later. Now, move to the other end of
the part you want to remove. Againg Draw a selection box around it
[Control + K] break again look at those do nodes ..notice as you
hover the cursor over it ..whether it says START or END ..you should
be wanting the END ..as it is the other end of the section you want to
remove ..and that other end had START ..so this should be END ..move
it out away from the part wanted to remain. With enough distance
away from the part need to remain. Draw a selection box around the
nodes of the section to be removed press [DELETE]
Draw a selection box around the remaining shape ..so that they are all
selected [Control + C] copy
Now, if you look at the VECTOR layer. You'll notice there are TWO
shape layers ..you are on one ...switch to the next one up.
Right-click Node Edit Edit - Paste All the nodes (should be
selected) w/the Vector Tool cursor/pointer leftmouse button click
(ADD HOLD) move this newly pasted copy of the edited shape so it
aligns with the bottom vector shape layer below.
All aligned w/Vector tool click LMB click anywhere outside of the
shape ..deselecting the copied shape
NOW, (I'd guess.. on "this" shape layer, the shape hasn't be edited
yet) More than likely, you'll need to ADD nodes where the newly
copied shape are now bi-secting / intersectin the shape on this level
Anyway, ADD (hold down [Control] key hover over the shapes line. The
cursor/pointer will get " + add " appended to the cursor. Click on
..well, any point on the line if you want.. but right near where the
copied shape now is.. if not 'quite' right pick it up and move it so
its overtop ..alignment is good? if so, [Control + K] break.
We are now starting to select/define the section of the circle to be
removed ..move the START end of the part to be removed ..out of the
way ..and in such a position that it'll be easy to select both nodes
of this part to be removed (but, so far we only have just done One
break ..again, add a node to the other end where it intersects
/bi-sects the shape added ..all aligned [Control + K} break.. Since
the other end of the section was START ..yeap, this other end now with
have END (as you hover over it with the cursor. Move this end out of
the way. Select both nodes of this to be removed section/arc
[Delete]
Now you have TWO edited shapes on one layer ..but, currently, no nodes
are selected. Go to ONE of the (pair of) nodes ontop of each other,
draw a selection box around them Right-click Edit - Join selected.
Now, on to the other PAIR of nodes aligned ontop of each other, again
draw a selection box around ..repeat Edit - Join selected.
Bottomline you keep doing this add node break join selected ..till
its all KOOL LIKE THAT :-)
Always selection the NODEs COPY ..switching shape layers Node Edit
Edit Paste ..till all shapes are added onto into one layer now as the
NEW shape Keyhole or Snowman
Kronk
Kronk
3. PSP7: Fancy node editing -- Copying and pasting nodes to combine shapes
4. volumetric lighting ( light shafts or light volumes)
5. image w/ custom colormap or image3d w/ custom colorbox
6. Draw Polygon (Custom MapMode with Custom Viewport Scale)
Hello All
I have just try to draw fill polygon
the points are collect form Clicking on Picutre Box
I have use 2 function One is Pic.line for comparing Polygon Line with Api
Funciton Polygon
This Test with help from Mike D. S. It is perfect but Here is Some errors
come. I try to Clear those Error but i could not do it.
Please Help.
Please See Below Source Code:
1) the first point goes wrong coordinate
2) Automatic change Pic.ScaleWidth and Pic.ScaleHeight after one click??
3) How to change or Set Scale and Rotation of Fill Pattern
Thanks
Amrit
''==================================[Controls ]=============================
'' One Picture Box Name Pic ( for DC)
'' Two Lable name LblX and LblY ( for Display Current
Coordinate)
''==================================[
StartCode ]=============================
Option Explicit
Private Type PointApi
X As Long
Y As Long
End Type
Private Declare Function Polygon Lib "gdi32" (ByVal hDC As Long, lpPoint As
PointApi, ByVal nCount As Long) As Long
Private Declare Function SetViewportExtEx Lib "GDI32.dll" (ByVal hDC As
Long, ByVal nX As Long, ByVal nY As Long, ByRef lpSize As Any) As Long
Private Declare Function SetWindowExtEx Lib "GDI32.dll" (ByVal hDC As Long,
ByVal nX As Long, ByVal nY As Long, ByRef lpSize As Any) As Long
Private Declare Function GetClientRect Lib "User32.dll" (ByVal hWnd As Long,
ByRef lpRect As Any) As Long
Private Declare Function SetMapMode Lib "GDI32.dll" (ByVal hDC As Long,
ByVal nMapMode As Long) As Long
Dim OldMode As Long
Dim OldSize(1) As PointApi
Dim pt() As PointApi
Private Const MM_ANISOTROPIC As Long = 8
Dim zx As Single '' Variable for DC Scale width
Dim zy As Single '' Variable for DC Scale height
Private Sub Form_Load()
ReDim pt(0) As PointApi 'point Initialize
zx = 2000 '' DC scale with
zy = 2000 '' Dc scale height
Pic.Scale (0, zy)-(zx, 0) 'set DC scale
End Sub
Private Sub Pic_MouseDown(Button As Integer, Shift As Integer, X As Single,
Y As Single)
If Button = 1 Then
Pic.Scale (0, zy)-(zx, 0) '' Set DC Coordinate
Pic.ScaleMode = vbTwips '' set scale mode
ReDim Preserve pt(UBound(pt) + 1) '' add point to point array
pt(UBound(pt)).X = X
pt(UBound(pt)).Y = Y
Call drawline '' draw line
ElseIf Button = 2 Then ' if user press right mouse down
Polygon Pic.hDC, pt(1), UBound(pt) ' draw polygon
End If
End Sub
Private Sub Pic_MouseMove(Button As Integer, Shift As Integer, X As Single,
Y As Single)
LblX.Caption = X '' display current x coordinate
Lbly.Caption = Y '' display current y coordinate
drawPolygon '' draw runtime polygon
End Sub
Sub drawline()
Pic.Scale (0, 200)-(200, 0)
Pic.ScaleMode = vbTwips
Pic.AutoRedraw = True
Dim i As Long
For i = 1 To UBound(pt) - 1
Pic.Line (pt(i).X, pt(i).Y)-(pt(i + 1).X, pt(i + 1).Y), vbRed
Next i
End Sub
Sub drawPolygon()
If UBound(pt) > 3 Then
Pic.AutoRedraw = False
Pic.Scale (0, zy)-(zx, 0)
Pic.ScaleMode = vbTwips
Call GetClientRect(Pic.hWnd, OldSize(0)) '' get DC client area
OldMode = SetMapMode(Pic.hDC, MM_ANISOTROPIC) '' map mode to custom
coordinate
Call SetWindowExtEx(Pic.hDC, Pic.ScaleWidth, Pic.ScaleHeight,
OldSize(0))
Call SetViewportExtEx(Pic.hDC, OldSize(1).X, OldSize(1).Y, OldSize(1))
Pic.ForeColor = vbBlue
Pic.FillColor = vbBlue
Pic.FillStyle = 2
Polygon Pic.hDC, pt(1), UBound(pt)
Call SetWindowExtEx(Pic.hDC, OldSize(0).X, OldSize(0).Y, ByVal 0&)
Call SetViewportExtEx(Pic.hDC, OldSize(1).X, OldSize(1).Y, ByVal 0&)
Call SetMapMode(Pic.hDC, OldMode)
Pic.Scale (0, zy)-(zx, 0)
Pic.ScaleMode = vbTwips
End If
End Sub
''======================================[
EndCode ]=========================================
7. Problem mixing lit and non-lit
8. Lit vertices getting affected by light colors
Hello,
I have a small primitive. It is a square built using lit vertices format for
vertex shader. The following is my custom structure:
Public Type D3DLITVERTEX
X As Single
Y As Single
Z As Single
color As Long
specular As Long
tu As Single
tv As Single
End Type
Public Const D3DFVF_LITVERTEX = (D3DFVF_XYZ Or D3DFVF_DIFFUSE Or
D3DFVF_SPECULAR Or D3DFVF_TEX1)
There are other primitives that need lighting (they are built on
D3DFVF_VERTEX format). So I set the lights in the following manner:
With light0
.diffuse = ColorValue4(1, 1, 1, 1)
.Ambient = ColorValue4(1, 0.5, 0.5, 0.5)
.Direction = vec3(-1, -1, -1)
.Type = D3DLIGHT_DIRECTIONAL
End With
Now my problem is that the D3DVERTEX primitives are being lit perfectly (Ive
set the normals, textures and everything else). But when I draw my
D3DLITVERTEX, it appears in silver color whereas it is supposed to be in
pure white color. It is affected by the Ambient property of the Light. Ive
checked this.. when I change the ambient property of the light, the color of
this primitive also changes. Howcome? Aren't 'LITVERTEX' supposed to be lit
by itself and not to be affected by DirectX lights ?
The only work-around that I have for now is that I turn the lighting off
before rending this primitive by calling SetRenderState D3DRS_LIGHTING, 0
and then turn the lights back on after it is drawn.
Faraz Azhar