--
cody
[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Why don't you use Direct3D though? Is it because writing a 3D engine is fun?
--
Bob Powell [MVP]
C#, System.Drawing
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm
Read my Blog at http://bobpowelldotnet.blogspot.com
"cody" <dont.spam.m...@gmx.de> wrote in message
news:%23QmiGZv...@TK2MSFTNGP12.phx.gbl...
So I will use structs. If I use only arrays and not lists I won't need
boxing (at least I hope so)..
> Why don't you use Direct3D though? Is it because writing a 3D engine is
fun?
Fun, learning, what you want. Additionally is no official DirectX-Wrapper
for .NET yet.
We used structs instead of classes for a 3x2 float matrix. We found the
struct much faster, especially since they have operator overloading and
produce a lot of temp objects in complex expressions. They are a natural fit
for matrices, vectors, and points.
In fact I think you could go even higher in size and see a speed improvement
for that type of abstraction.
Regards,
Frank Hileman
Prodige Software Corporation
check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated VS.net graphics editor
Thank you!
There is a managed interface for directx 9.
http://msdn.microsoft.com/library/default.asp?url=/nhp/default.asp?contentid=28000410
Ken
----------------
"cody" <dont.spam.m...@gmx.de> wrote in message
news:c0l7ln$1841l6$1...@ID-176797.news.uni-berlin.de...
Thank you! I didn't know I was already out!
Thank you! I didn't know that it was already out!
Thank you! I didn't know that it was already out!
--
Right. Also, if you find yourself in need of a strongly typed array list,
you can always write your own implementation.
-mike
MVP
http://www.ericjsmith.net/codesmith/screenshots.aspx
"Michael Giagnocavo [MVP]" <mggU...@Atrevido.net> wrote in message
news:uFhCJMK9...@tk2msftngp13.phx.gbl...
The tradeoff is between the time taken in your type be a reference type (ie
allocation and GC overhead and overall memory pressure) vs the time it takes
to copy the struct as parameters and return types, and any boxing overhead.
The tradeoff is going to be different depending on how you use your type, so
it's something you need to measure. My guess is that a 3D point will be
faster as a struct, especially if you have a ton of them.
--
Eric Gunnerson
Visit the C# product team at http://www.csharp.net
Eric's blog is at http://weblogs.asp.net/ericgu/
This posting is provided "AS IS" with no warranties, and confers no rights.
"Frank Hileman" <fran...@no.spamming.prodigesoftware.com> wrote in message
news:%23UkmeVx...@TK2MSFTNGP11.phx.gbl...
Yes, I thought about it: The thing that slows struct down is parameter
passing, but when you use them in an array you never need to pass the
structs itself so a struct is much better for points than a class.
--
cody
Freeware Tools, Games and Humour
http://www.deutronium.de.vu
[noncommercial and no fucking ads]
So what's your opinion of passing larger structs around as ref
parameters and eliminating the copy?
using ref eliminates the copy but through the extra indirection access to
the struct can get slower, I think.
but for larger structs (>16 bytes or more) it may save time, but this highly
depends on the specific application.
the most important thing when dealing with structs is that you must be
always awre of boxing, because boxing can be the biggest performance hit.
-mike
MVP
"Fuzzy" <trno...@earthlink.net> wrote in message
news:9527b23b.04030...@posting.google.com...
I my case, the data I'm considering using a struct instead of a class
will probably be somewhere between 100 and 300 bytes. There's no real
"behavior" of the data, just definitional properties. All I need is
read access to everything and occasional write access to some of the
fields (for current state). There won't be a lot of these around at
any one time, so I'm not concerned about exhausting the stack. An
analogy is a ball in a pinball game - one of these objects comes in,
affects the state of the overall system, then leaves. Then comes
another one.