Autor Beitrag
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Mi 05.11.03 15:54 
Hallo!

Für DirectDraw gibt es ja das IDirectDrawClipper-Interface, um simples 2D-Clipping durchzuführen.
Wie funktioniert dies in Direct3D?

Cu,
Udontknow
Udontknow Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Mi 05.11.03 17:38 
Hmmm, könnte mit SetClipPlane gehen, allerdings verwirrt mich ein wenig, daß es 4 Parameter sind...

Ein Punkt im Raum wird angezeigt, wenn für ihn gilt:

Ax + By + Cz + Dw >= 0

Ist wohl so eine Art Ebenenbeschreibung. Woher kommt denn eigentlich dann w? Ist das ein konstanter Wert 1? Schliesslich haben normale Vektoren ja nur 3 Koordinaten...

Cu,
Udontknow
maximus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 896

Win XP, Suse 8.1
Delphi 4/7/8 alles prof
BeitragVerfasst: Do 06.11.03 12:37 
die SDK sagt:

Zitat:
IDirect3DDevice9::SetClipPlane Method

--------------------------------------------------------------------------------

Sets the coefficients of a user-defined clipping plane for the device.

Syntax

HRESULT SetClipPlane( DWORD Index,
const float *pPlane
);
Parameters

Index
[in] Index of the clipping plane for which the plane equation coefficients are to be set.
pPlane
[in] Pointer to an address of a four-element array of values that represent the clipping plane coefficients to be set, in the form of the general plane equation. See Remarks.
Return Value

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value is D3DERR_INVALIDCALL. This error indicates that the value in Index exceeds the maximum clipping plane index supported by the device or that the array at pPlane is not large enough to contain four floating-point values.




Remarks

The coefficients that this method sets take the form of the general plane equation. If the values in the array at pPlane were labeled A, B, C, and D in the order that they appear in the array, they would fit into the general plane equation so that Ax + By + Cz + Dw = 0. A point with homogeneous coordinates (x, y, z, w) is visible in the half space of the plane if Ax + By + Cz + Dw >= 0. Points that exist behind the clipping plane are clipped from the scene.

When the fixed function pipeline is used the plane equations are assumed to be in world space. When the programmable pipeline is used the plane equations are assumed to be in the clipping space (the same space as output vertices).

This method does not enable the clipping plane equation being set. To enable a clipping plane, set the corresponding bit in the DWORD value applied to the D3DRS_CLIPPLANEENABLE render state.


...hast du aber vermutlich auch schon gelesen! Hab mom. auch kein plan, was das alles soll :wink:

_________________
mfg.
mâximôv
Udontknow Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Do 06.11.03 12:50 
Habe es gestern noch rausbekommen.

Bei allen Transformationen wird von den Vektoren tatsächlich immer w=1 geliefert. Steht auch so in D3DX9.
ausblenden Quelltext
1:
2:
3:
// Transform (x, y, z, 1) by matrix.
function D3DXVec3Transform(out vOut: TD3DXVector4;
  const v: TD3DXVector3; const m: TD3DXMatrix): PD3DXVector4;


Ein simples Rechteck, wo drin gezeichnet werden soll, kann man also durch 4 Ebenen definieren:

Beispiel: Ein Kasten 0-500,0-300:

für X<500 gilt A:=-1; B:=0; C:=0; D:=500;
für X>0 gilt A:=1; B:=0; C:=0; D:=0;
für Y<300 gilt A:=0; B:=-1; C:=0; D:=300;
für Y>0 gilt A:=0; B:=1; C:=0; D:=0;

Cu,
Udontknow