Jump to content
Xtreme .Net Talk

rifter1818

Avatar/Signature
  • Posts

    257
  • Joined

  • Last visited

Everything posted by rifter1818

  1. I have tried using the Managed Array actually, however that creates multiple copies of the Squares that arnt interconnected (Example i have created an array of squares SQUARE[6,6] S; however if i add units to S[1,1] and it "explodes" (note the part of the add unit code in the if statement) it doesnt change S[1,0] and so on only the Copys of S[1,0] that was placed in its Neighbors property. with that said i cannot have the Neighbors as a point array keeping the index of the SQUARE as this will not allways be a two dimensional array (we are just starting with this basic Square layout we will eventually be extending it onto a hex grid and various other layouts.
  2. K here is my problem, I have a type (SQUARE) [CS] unsafe struct SQUARE { public byte Owner,Units; public SQUARE*[] Neighbors; public void AddUnit(byte owner) { byte i; this.Units++; this.Owner = owner; if(Neighbors.GetUpperBound(0) < Units) { Units = 0; Owner = 0; for(i=0;i<=Neighbors.GetUpperBound(0);i++) { Neighbors->AddUnit(owner); } } } }; [/CS] Now each square has some neighbors which i want to use pointers to Keep track of the problem is when i try and fill these pointers. [CS] IntPtr T; Marshal.StructureToPtr(S[x,y],T,false); S[x,y].Neighbors[0] = &(SQUARE)T.ToPointer(); [/CS] This Cannot convert void* to SQUARE... Anyways how to i fill those pointers in C#? Thanks in advance.
  3. Before i fall down and have a major seisure (spelling) could some one please help me with the flickering. Im using C#. so far i have done the following settings (on form load) base.SetStyle(ControlStyles.AllPaintingInWmPaint,true); base.SetStyle(ControlStyles.DoubleBuffer,true); Im using a graphics object G = base.createGraphics(); and after the rendering (using the event onPaint)(currently just some collored rectangles and strings) is done i call Application.doEvents(); this.invalidate(); Anyways its flickering like there was no tommorrow. so any help to solve this would be greatly appreciated.
  4. Im trying to get a pointer to a Device, actually trying to get an intPtr, but... so far as close as i could get is [C#] // With Dev being the device i want to point at Device* pDev = &Dev; void* vDev = pDev; IntPtr X = new IntPtr(vDev); return X; [/C#] Which of course Crashes as you cant get a pointer to a managed object or something like that (first line is wrong...) so folks how do i do it?
  5. Depends on the type of annimated mesh i guess. I have a working Skinning mesh in VB. The Documentation is on RobyDx's Site although ive had some problems rendering other objects after the skinning mesh. Skinning Mesh.txt
  6. Ok i finnally got my skinning mesh to render, and now when i move on to the next stage (enter a battle in this case) all my other meshs, disapear, however if i rem out the Tiny.drawmesh 'tiny is my skinning mesh test case, the meshs render fine, however i cant find whats being changed, ive tried reseting everything i notice on the device being changed (transforms,renderstate) but this is to no avail. Public Sub drawMesh() DrawFrame(RootFrame.FrameHierarchy) End Sub Private Sub DrawFrame(ByRef frame As hFrame) Dim mesh As hMeshContainer = frame.MeshContainer While Not (mesh Is Nothing) DrawMeshContainer(mesh, frame) mesh = mesh.NextContainer End While If Not (frame.FrameSibling Is Nothing) Then DrawFrame(frame.FrameSibling) End If If Not (frame.FrameFirstChild Is Nothing) Then DrawFrame(frame.FrameFirstChild) End If End Sub Protected Overridable Sub DrawMeshContainer(ByRef mesh As hMeshContainer, ByRef frame As hFrame) Dim i As Integer If Not (mesh.SkinInformation Is Nothing) Then Dim attribIdPrev As Integer = -1 Dim iattrib As Integer For iattrib = 0 To mesh.numAttr - 1 Dim numBlend As Integer = 0 Dim bones() As BoneCombination = mesh.bones For i = 0 To mesh.numInfl - 1 If (bones(iattrib).BoneId(i) <> -1) Then numBlend = i End If Next If (iDev.DeviceCaps.MaxVertexBlendMatrices >= numBlend + 1) Then iDev.RenderState.VertexBlend = numBlend Dim offsetMatrices As Matrix() = mesh.offsetMatrices Dim frameMatrices() As hFrame = mesh.frameMatrices For i = 0 To mesh.numInfl - 1 Dim matrixIndex As Integer matrixIndex = bones(iattrib).BoneId(i) If (matrixIndex <> -1) Then Dim tempMatrix As Matrix = Matrix.Multiply(offsetMatrices(matrixIndex), frameMatrices(matrixIndex).cMat) iDev.Transform.SetWorldMatrixByIndex(i, tempMatrix) End If Next If ((attribIdPrev <> bones(iattrib).AttribId) Or attribIdPrev = -1) Then iDev.Material = mesh.GetMaterials()(bones(iattrib).AttribId).Material3D iDev.SetTexture(0, mesh.meshTextures(bones(iattrib).AttribId)) attribIdPrev = bones(iattrib).AttribId End If mesh.MeshData.Mesh.DrawSubset(iattrib) End If Next Else iDev.Transform.World = frame.cMat Dim mtrl() As ExtendedMaterial = mesh.GetMaterials Dim iMaterial As Integer For iMaterial = 0 To mtrl.Length - 1 iDev.Material = mtrl(iMaterial).Material3D iDev.SetTexture(0, mesh.meshTextures(iMaterial)) mesh.MeshData.Mesh.DrawSubset(iMaterial) Next End If End Sub Any Ideas whats getting changed (iDev is the device).
  7. ok thanks That clarifies it allot, for refrence i didnt think i could do a better job than managed dx, but a more specified job (aka more specific types of meshs, more tight commands) but the main concern was the lack of pointers thing you pointed out,... Hmm looks tempting though,.... can you use managed DX in C++ (dont ask me why)?
  8. Found it yet again another stupid mistake by me, hardest kind to see, my refrence to the device was wrong Just by passing a few instances of the device to the classes it worked, really wierd that nothing about the device came up in the error message though. *hides from people who spent thier valuable time helping my stupidity*
  9. Im not fully sure why i want to, i guess i feel that id get a bit more controll, the application would be easyer to port to c# and then possibly eventually to c++, but theres allot more documentation for C++ and for some reason things like my skinning mesh dont work and i cant find any support! anyways guess im just rambling, but wouldnt a wrapper dll be more efficiant if it was written in c++ vrs vb? (regardless of what launguage uses it).
  10. What i mean Is to have the LPDirect3dDevice (i think this is it) as a public variable in the D3D class, meaning that a visual basic application could access the unmanaged directx
  11. Can you create a dll in c++ (pretty much just a directx wrapper) then use that dll in visual basic with that dll leaving open access to the d3d device, as VB usually uses managed directx while c++ does not.
  12. Im a VB programmer who now has to learn c++ very quickly, how do i redimmension arrays and get the upper bound of an array in c++ preferably not .net specific (yes i know this is outside the usual bounds of this forum) Speaking of which any tutorials on c++ or specificly moving vb-> c++ would be greatly appreciated.
  13. The Source Code For the Skinning Animation Im Attaching the code for the class its the same as robyDx's But translated and it works in robydx's sample program (i used this exact code) but with the same files it crashes in mine (see error above). SkinningMeshVB.txt
  14. Hmmm no answer yet, Here are all the settings i could find. Device Type: Hardware CreateFlags: HardwareVertexProcessing PresentParameters: MultiSampleQuality: 0 PresentationInterval: Default FullScreenRefreshRateInHz: 0 PresentFlag: None AutoDepthStencilFormat: D16 EnableAutoDepthStencil: True Windowed: False DeviceWindowHandle: 0 DeviceWindow: SwapEffect: Discard MultiSample: None BackBufferCount: 1 BackBufferFormat: A8R8G8B8 BackBufferHeight: 768 BackBufferWidth: 1024 ForceNoMultiThreadedFlag: False Sampler State (0) 'The only One im using DMapOffset: 0 ElementIndex: 0 SrgbTexture: False MaxAnisotropy: 1 MaxMipLevel: 0 MipMapLevelOfDetailBias: 0 MipFilter: None MinFilter: Linear MagFilter: Linear BorderColor: 0 AddressW: Wrap AddressV: Wrap AddressU: Wrap And Finnaly the device render states: AlphaBlendOperation: Add AlphaDestinationBlend: Zero AlphaSourceBlend: One SeparateAlphaBlendEnabled: False BlendFactor: Color [A=255, R=255, G=255, B=255] ColorWriteEnable3: RedGreenBlueAlpha ColorWriteEnable2: RedGreenBlueAlpha ColorWriteEnable1: RedGreenBlueAlpha CounterClockwiseStencilFunction: Always CounterClockwiseStencilPass: Keep CounterClockwiseStencilZBufferFail: Keep CounterClockwiseStencilFail: Keep TwoSidedStencilMode: False EnableAdaptiveTessellation: False AdaptiveTessellateW: 0 AdaptiveTessellateZ: 1 AdaptiveTessellateY: 0 AdaptiveTessellateX: 0 MinTessellationLevel: 1 MaxTessellationLevel: 1 AntiAliasedLineEnable: False DepthBias: 0 SlopeScaleDepthBias: 0 ScissorTestEnable: False NormalDegree: Linear PositionDegree: Cubic BlendOperation: Add TweenFactor: 0 ColorWriteEnable: RedGreenBlueAlpha IndexedVertexBlendEnable: False PointSizeMax: 8192 DebugMonitorTokenEnabled: False PatchEdgeStyle: Discrete MultiSampleMask: -1 MultiSampleAntiAlias: True PointScaleC: 0 PointScaleB: 0 PointScaleA: 1 PointScaleEnable: False PointSpriteEnable: False PointSizeMin: 1 PointSize: 1 VertexBlend: Disable EmissiveMaterialSource: Material AmbientMaterialSource: Material SpecularMaterialSource: Color2 DiffuseMaterialSource: Color1 NormalizeNormals: False LocalViewer: True ColorVertex: True FogVertexMode: None Ambient: Color [A=0, R=0, G=0, B=0] Lighting: True Clipping: True Wrap15: 0 Wrap14: 0 Wrap13: 0 Wrap12: 0 Wrap11: 0 Wrap10: 0 Wrap9: 0 Wrap8: 0 Wrap7: 0 Wrap6: 0 Wrap5: 0 Wrap4: 0 Wrap3: 0 Wrap2: 0 Wrap1: 0 Wrap0: 0 TextureFactor: -1 StencilWriteMask: -1 StencilMask: -1 ReferenceStencil: 0 StencilFunction: Always StencilPass: Keep StencilZBufferFail: Keep StencilFail: Keep StencilEnable: False RangeFogEnable: False FogDensity: 1 FogEnd: 1 FogStart: 0 FogTableMode: None FogColor: Color [A=0, R=0, G=0, B=0] SpecularEnable: False FogEnable: False AlphaBlendEnable: True DitherEnable: True AlphaFunction: Always ReferenceAlpha: 0 ZBufferFunction: LessEqual CullMode: CounterClockwise DestinationBlend: InvSourceAlpha SourceBlend: SourceAlpha LastPixel: True AlphaTestEnable: False ZBufferWriteEnable: True UseWBuffer: False ZBufferEnable: True ShadeMode: Gouraud FillMode: Solid
  15. Hmm Doesnt Appear to be fullscreen anymore, But its still crashing at the excact same spot in my application the exact same code seems to work fine in roby dx's and i cant figure out why same code same file?! anyone know of any settings i might have changed that would prevent it from working?
  16. First off i would like to thank robyDx For his wonderfull tutorial on the subject of skinning animation, i used his source code to start getting my project up and running, slight problem though it doesnt work in full screen mode, ive tried using dbmon and unmannaged debugging and couldnt get any more information with either of them. the problem occers at RootFrame = Mesh.LoadHierarchyFromFile(filesrc, MeshFlags.Managed, Device, alloc, Nothing) 'or if your using robydx's class (Same error on full screen) animazione = Mesh.LoadHierarchyFromFile(filesrc, MeshFlags.Managed, device, alloc, Nothing) the error reads somewhat like this InitializeWorld:Error in the application. -2005530516 (D3DERR_INVALIDCALL) at Microsoft.DirectX.Direct3D.Mesh.LoadHierarchyFromFile(String filename, MeshFlags options, Device device, AllocateHierarchy allocHierarcy, LoadUserData userDataLoader) at W_Logic_RPG.DX9.SkinningMesh..ctor(String filesrc, String texP) in C:\Documents and Settings\Harry\Desktop\Programming\W-Logic RPG\clsDX901.vb:line 1794 at W_Logic_RPG.modWorld.Initialize() in C:\Documents and Settings\Harry\Desktop\Programming\W-Logic RPG\modWorld.vb:line 51 The program '[3748] W-Logic RPG.exe' has exited with code 0 (0x0).
  17. Hm Im not sure of an easy way to do it But you could use a pixel shader and a mapping texture (use the texture to store the alpha values using a grayscale) then add the transparancy in the pixel shader but this is probably a much more complicated method than your looking for.
  18. 2nd I cant believe it. Not that i finished second the winning team won last year as well and are truely very good programmers, but why i finished second (freak power outage). The power went out in one part of the building so we all had almost 2 hours to solve the problems before we got to the computers (so it became a typeing contest (first and second finished all puzzles so the desicion went on a time basis) and the server lost 3 of our submissions which cost us almost 4 hours of time for the scoring. the first puzzle (a freebee so everyone would get one) was to print all of the squares of the numbers 20-40. IE for i = 20 to 40 c.writeline(I*I) 'with c being a console next It took us 2 hours to successfully submit this question. Am i bitter yes, flame me all you want, i guess ill just have to continue being second best at everything (well not many things actually but you know the saying).
  19. Im leaving tommorrow for a programming competition (provincial high school). I would just like to extend my thanks to all of you here who have helped me so much in becoming the programmer i am today. My late father once told me that it didnt matter what i did with my life as long as i did a damn good job of it, and id like to think that hed be proud of me and the great leaps ive made in my programming with many thanks to all the help ive recieved from the wonderfull people here, thank you and good night. Yours Truely Harry.
  20. Using the image or imagebutton object is it possible to set a transparant color ex black or are a)Transparancy's impossible or b) all transparancys must be in the image (gif,jpeg....)?
  21. Was worried that was it Oh Well just a random thought.
  22. is there any way when using a webbrowser component to get what scripts are being run (ideally before they are run) when browsing a page. example of use oh that script installs a virus,... how about NO! *program shuts off web page*. Sorry for the rambling explination its late and im off to type up some more homework thanks (in advance) for all your help folks.
  23. Could be that the usage for both Texture coordinants are the same,... try new vertexelement(.....,texturecoordinant,0) and new vertexelement(.....texturecoordinant,1) for those two in the dec.
  24. Hmmm The Square root function isnt working so i may need some help there other than that it seems to work fine.. Edit: Devision Failed testing too...
×
×
  • Create New...