
Darc
Avatar/Signature-
Posts
93 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Darc
-
I'm making a simple frame for a game I'm working on, and I'd like some simple Music and Sound in it. I've tried PlaySound but it doesn't seem to be able to do two sounds at once (maybe I'm just using it wrong) Is there a way to do this without DirectX? (I just don't want to have to make DirectX 9.0 mandatory to play my little game)
-
I've been a VB programmer for almost a year and I'm starting to do Win32. I dunno though, I like C++ alot more than VB now maybe cuz it's new to me, who knows. Anyways, I just learned Direct3D in VB .NET and now I'm learning GDI32/C++ then I'm gonna tackle Direct3D in C++. Just how much faster is C++/GDI32 than VB .NET/GDI+?
-
thanx, it looks great, but I somehow managed to decipher the Microsoft SDK code and got this: Dim vDir As Vector3 = Vector3.Subtract(CCamera.CameraView, CCamera.CameraPosition) If vDir.X > 0.0F Then billboardMatrix = Matrix.RotationY(CSng(-Math.Atan((vDir.Z / vDir.X)) + Math.PI / 2)) Else billboardMatrix = Matrix.RotationY(CSng(-Math.Atan((vDir.Z / vDir.X)) - Math.PI / 2)) End If billboardMatrix.M41 = object.X billboardMatrix.M42 = object.Y billboardMatrix.M43 = object.Z d3dDevice.Transform.World = billboardMatrix it works pretty well, just a matter of speed I guess
-
can someone help me out with this, I've never done it before and I can not make sense of Microsofts beautiful "SDK Samples".
-
Make the values even smaller, or move the camera around
-
oh, and I'm also looking at how to billboard images (these are going hand in hand) the MS DX SDK is useless...
-
I'm trying to make a partially transparent image with Direct3d 9, just basic transparency. No alpha-blending etc. Any help? I've tried searching (no luck) but I need it for a Science Project ASAP...
-
I haven't tried it yet, but it makes sense, in a Microsoft "I'm going to make this as hard as possible for our users" sort of way, thanx :)
-
anyone have a solution to this?? I really need to distribute my apps...
-
I'm trying to figure out how to get GDI+ to get to higher FPS. Right now it's only going around 8-11 on a good day. I am coding in Visual Basic .NET if that could be the problem for the speed (I only own it and C++ .NET and I have yet to learn Managed C++) This is how I normally do my GDI+ drawing: Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim start, count, curr As Integer start = Environment.TickCount Me.Show() Do curr = Environment.TickCount pbx.Invalidate() Application.DoEvents() If start <= curr - 1000 Then start = Environment.TickCount Console.WriteLine(count) count = 0 Else count += 1 End If Loop End Sub Any tips?
-
you could keep track of the mouse point in a global variable and then update it when the mouse moves: Dim ptMouse as New Point(0,0) Public Sub myForm_MouseMove(Byval sender as Object, Byval e as MouseEventArgs) Handles MyBase.MouseMove pt.X = e.X pt.Y = e.Y End Sub now draw the image at the the coordinates stored in ptMouse
-
you need to use Matrices, d3dDevice.Transform.World = RotateY(angle) d3dDevice.Transform.World = RotateX(angle) d3dDevice.Transform.World = RotateZ(angle) Those will rotate the object around the origin but they are absolute in that if angle doesn't change, neither will the rotation, so do something like: Public Const Speed As Long = 2000 'Decrease SPEED to go faster Dim angle As Single = PI / SPEED Private Sub DoMatrices() d3dDevice.Transform.World = Matrix.Identity d3dDevice.Transform.World = Matrix.RotateZ(angle) angle += PI / SPEED End Sub now just call that everytime before you draw :)
-
I noticed this too, in the windows folder, Microsoft .NET\Managed DirectX\ doesn't exist on the users' computers, which does on my computer...
-
I got it (had to use a ColorMatrix and imageAttributes) could someone tell me how this ColorMatrix works? I'm just going by some tutorials to set opacity
-
how would I do the Nerseus?
-
I'm still trying to figure out collisions myself, (damn crappy MS docs) as for shadows, I'm not there yet :)
-
I know DirectDraw, and this is for Windows Apps I just don't like distributing apps that need around 200 megs to run when they're like school projects.
-
how do you do Collision Detection with Primitives in Direct3D 9.0? thanx to all that help
-
I just was wondering a few things about the speed of and how to speed up GDI+. First, which is faster, drawing to a Form or a PictureBox (provided double buffering is enabled)? and second, should you do Draw(Control.CreateGraphics) or Control.Refresh() for triggering the paint? Thanx for any help.
-
oh ok. That's the easy part :) (if you're bad at that kinda math like me) well, for the camera part here's what I do (using the afore mentioned Camera class): d3dDevice.Transform.View = Matrix.LookAtLH(New Vector3(View.xPos, View.yPos, View.zPos), _ New Vector3(View.xView, View.yView, View.zView), _ New Vector3(View.xUp, View.yUp, View.zUp)) 'set the view transformation d3dDevice.Transform.Projection = Matrix.PerspectiveFovLH(Convert.ToSingle(Math.PI) / 4, 1.0F, 1.0F, 100.0F) 'and finally set the projection matrix Now explaining, Device.Transform is the group of matrices that are in the device, modify these, modify the world. LookAtLH is simple take the camera position (the second argument) and point it at the camera view Vector (the second argument) The final argument is simply which way is up, in the form of a Vector. Then we come to the Projection Matrix, like I said I'm not good at this kind of math so I usually don't change the values from the above (if it works, it works right?) In laymens terms the first argument is field of vision (requires complicated math, I don't tinker with the above equation) the second I just don't understand lol, the third is the closest coordinate you can see and the final argument is the farthest coordinate you can see. If you need more help, I'm always willing
-
Try this: Private Sub test( ) Me.TextBox1.Text = "before" '(1) Show textBox1 content MsgBox(Me.TextBox1.Text) '(2) Call method Me.rere(Me.TextBox1.Text) '(3) Show textBox1 content after the call MsgBox(Me.TextBox1.Text) End Sub Private Sub rere(ByVal t As String) t = "after" End Sub I may be wrong on this, but I think when you pass controls, you pass a pointer to the controls memory, not the control itself (as you would a variable) so any changes affect the memory itself rather than the copy that byval would create. In my code, you pass one of the controls properties into the argument, which CAN be byval-ed as they follow the normal byval/byref rules. Hope this makes sense, it did to me at midnight...
-
ok, here's the camera part, took me a while to understand it myself so if you have questions feel free to ask. I have this in it's own Class (Camera) and I haven't made it look up and down yet: Public xPos, yPos, zPos, xView, yView, zView, xUp, yUp, zUp, xStrafe, yStrafe, zStrafe As Single Public Sub New(ByVal x As Single, ByVal y As Single, ByVal z As Single, _ ByVal xV As Single, ByVal yV As Single, ByVal zV As Single, _ ByVal xU As Single, ByVal yU As Single, ByVal zU As Single) xPos = x yPos = y zPos = z xView = xV yView = yV zView = zV xUp = xU yUp = yU zUp = zU End Sub Private Sub UpdateCamera(ByVal xdir As Single, ByVal zdir As Single, ByVal dir As Single) xPos += xdir * dir zPos += zdir * dir xView += xdir * dir zView += zdir * dir End Sub Public Sub MoveCamera(ByVal amount As Single) 'Amount will be Negative for moving backwards Dim xLookDirection, yLookDirection, zLookDirection As Single xLookDirection = xView - xPos yLookDirection = yView - yPos zLookDirection = zView - zPos Dim dp As Single = CSng(Math.Sqrt(xLookDirection * xLookDirection + yLookDirection * yLookDirection + zLookDirection * zLookDirection)) xLookDirection /= dp yLookDirection /= dp zLookDirection /= dp UpdateCamera(xLookDirection, zLookDirection, amount) End Sub Public Sub StrafeCamera(ByVal direction As Single) 'Negative = Left, Positive = Right CalculateStrafe() UpdateCamera(xStrafe, zStrafe, direction) End Sub Private Sub CalculateStrafe() Dim xDir, yDir, zDir As Single Dim xCross, yCross, zCross As Single xDir = xView - xPos yDir = yView - yPos zDir = zView - zPos Dim dp As Single = 1 / CSng(Math.Sqrt(xDir * xDir + yDir * yDir + zDir * zDir)) xDir *= dp yDir *= dp zDir *= dp xCross = (yDir * zUp) - (zDir * yUp) yCross = (zDir * xUp) - (xDir * zUp) zCross = (xDir * yUp) - (yDir * xUp) xStrafe = xCross yStrafe = yCross zStrafe = zCross End Sub Public Sub RotateCamera(ByVal AngleDir As Single, ByVal xSpeed As Single, ByVal ySpeed As Single, ByVal zSpeed As Single) 'AngleDir will be Negative for rotating left, positive for right Dim xNewLookDirection, yNewLookDirection, zNewLookDirection As Single Dim xLookDirection, yLookDirection, zLookDirection As Single Dim CosineAngle, SineAngle As Single CosineAngle = CSng(Math.Cos(AngleDir)) SineAngle = CSng(Math.Sin(AngleDir)) xLookDirection = xView - xPos yLookDirection = yView - yPos zLookDirection = zView - zPos Dim l As Single = CSng(Math.Sqrt(xLookDirection * xLookDirection + yLookDirection * yLookDirection + zLookDirection * zLookDirection)) xLookDirection /= l yLookDirection /= l zLookDirection /= l xNewLookDirection = (CosineAngle + (1 - CosineAngle) * xSpeed) * xLookDirection xNewLookDirection += ((1 - CosineAngle) * xSpeed * ySpeed - zSpeed * SineAngle) * yLookDirection xNewLookDirection += ((1 - CosineAngle) * xSpeed * zSpeed + ySpeed * SineAngle) * zLookDirection yNewLookDirection = ((1 - CosineAngle) * xSpeed * ySpeed + zSpeed * SineAngle) * xLookDirection yNewLookDirection += (CosineAngle + (1 - CosineAngle) * ySpeed) * yLookDirection yNewLookDirection += ((1 - CosineAngle) * ySpeed * zSpeed - xSpeed * SineAngle) * zLookDirection zNewLookDirection = ((1 - CosineAngle) * xSpeed * zSpeed - ySpeed * SineAngle) * xLookDirection zNewLookDirection += ((1 - CosineAngle) * ySpeed * zSpeed + xSpeed * SineAngle) * yLookDirection zNewLookDirection += (CosineAngle + (1 - CosineAngle) * zSpeed) * zLookDirection xView = xPos + xNewLookDirection yView = yPos + yNewLookDirection zView = zPos + zNewLookDirection End Sub
-
ok then, which do I use of Application.Exit() and Exit(ExitCode) ?