Search Results

Search found 12 results on 1 pages for 'hatch'.

Page 1/1 | 1 

  • C# XNA: Effecient mesh building algorithm for voxel based terrain ("top" outside layer only, non-destructible)

    - by Tim Hatch
    To put this bluntly, for non-destructible/non-constructible voxel style terrain, are generated meshes handled much better than instancing? Is there another method to achieve millions of visible quad faces per scene with ease? If generated meshes per chunk is the way to go, what kind of algorithm might I want to use based on only EVER needing the outer layer rendered? I'm using 3D Perlin Noise for terrain generation (for overhangs/caves/etc). The layout is fantastic, but even for around 20k visible faces, it's quite slow using instancing (whether it's one big draw call or multiple smaller chunks). I've simplified it to the point of removing non-visible cubes and only having the top faces of my cube-like terrain be rendered, but with 20k quad instances, it's still pretty sluggish (30fps on my machine). My goal is for the world to be made using quite small cubes. Where multiple games (IE: Minecraft) have the player 1x1 cube in width/length and 2 high, I'm shooting for 6x6 width/length and 9 high. With a lot of advantages as far as gameplay goes, it also means I could quite easily have a single scene with millions of truly visible quads. So, I have been trying to look into changing my method from instancing to mesh generation on a chunk by chunk basis. Do video cards handle this type of processing better than separate quads/cubes through instancing? What kind of existing algorithms should I be looking into? I've seen references to marching cubes a few times now, but I haven't spent much time investigating it since I don't know if it's the better route for my situation or not. I'm also starting to doubt my need of using 3D Perlin noise for terrain generation since I won't want the kind of depth it would seem best at. I just like the idea of overhangs and occasional cave-like structures, but could find no better 'surface only' algorithms to cover that. If anyone has any better suggestions there, feel free to throw them at me too. Thanks, Mythics

    Read the article

  • 3D Texture Mapping (Atlas)

    - by Tim Hatch
    This is a pretty simple question. If I was to use multiple images in a single texture for a 3D cube, how would I go about re-using each vertex (having 8 total vs 24)? With a single buffer of 8 vertices, I don't see how I'd properly reuse the UV values. Any help on that? I know it's not terribly clear, but I figured it was a simple question. The 2D method is pretty easy, the next coordinates would be the same as the first (0,0 and 0,1 respectively). However, the above 3D version has me quite befuddled.

    Read the article

  • SpaceX’s Dragon Spacecraft Docks with the ISS [Video]

    - by Jason Fitzpatrick
    This weekend was the first time a commercial space craft successfully rendezvoused with the International Space Station. Check out this video to see the opening of the hatch. From the notes on NASA’s video release: Aboard the International Space Station, Expedition 31 Flight Engineer Don Pettit and Joe Acaba of NASA and European Space Agency Flight Engineer Andre Kuipers opened the hatch to SpaceX’s Dragon cargo craft and entered the vehicle May 26, one day after the world’s first commercial cargo spacecraft was berthed to the Earth-facing port of the Harmony module. Dragon will remain berthed to Harmony until May 31, enabling the crew to unload supplies for the station’s residents before it is re-grappled and released to return to Earth for a parachute-assisted splashdown in the Pacific Ocean off the coast of southern California. If you’re interested in learning more about the SpaceX program, hit up the link below. SpaceX How To Customize Your Wallpaper with Google Image Searches, RSS Feeds, and More 47 Keyboard Shortcuts That Work in All Web Browsers How To Hide Passwords in an Encrypted Drive Even the FBI Can’t Get Into

    Read the article

  • Xsd recursion of complexTypes

    - by Hatch
    I am just learning XML/XSD and am struggling with the implementation of an XML-schema which models a folder structure. What I had in mind was defining a complexType for the folder which can have additional folder instances that represent subfolders. Using the xsd schema validator here always returns that the schema is invalid. I tried defining the complexType up front and then using the ref keyword for subfolders: <xs:complexType name="tFolder"> <xs:sequence> <xs:element name="Path" type="tFolderType" msdata:Ordinal="0" /> <xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" /> <xs:element name="File" nillable="true" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:simpleContent msdata:ColumnName="File_Text" msdata:Ordinal="0"> <xs:extension base="xs:string"> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="Type" type="tFolderType" /> As for the element itself: <xs:element name="Folder" type="tFolder" /> The error returned by the validator is: "Cannot resolve the name 'Folder' to a(n) 'element declaration' component." and the error occurs at the line <xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" /\> Defining the complexType within the element itself yields the exact same error: <xs:element name="Folder"> <xs:complexType> <xs:sequence> <xs:element name="Path" type="tFolderType" msdata:Ordinal="0" /> <xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" /> <xs:element name="File" nillable="true" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:simpleContent msdata:ColumnName="File_Text" msdata:Ordinal="0"> <xs:extension base="xs:string"> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="Type" type="tFolderType" /> </xs:complexType> </xs:element> What I've read, this kind of recursion should work using ref. Can anyone tell me what I've done wrong? Maybe the xsd validator is just faulty? If so, does anyone know a better alternative? I've tried using the one from w3.org as well, but it seems to be taken offline...

    Read the article

  • open current page in new window including query string

    - by Hatch
    First of all, I am a total dud at all things related to web developement, so please bear with me here. I suspect this question is laughable for the web guys, but unfortunately I can't figure this out. Here goes: I have an application, that does some processing, writes some result files and then displays the results in an embedded IE browser control. This is done by navigating the browser control to a local html file together with a query string containing the generated result files to display it all. The link target would look something like: c:\SomeFolder\results.htm?results=file%201.xml;file%202.xml;file%203.xml So far, everything's fine. However, in the html page is a href that is suppossed to open up the exact same just in a normal browser window. What I thought would work is: <a href="#" target="_blank">Show in browser</a> Since it is a link in an html page displayed in an IE control, the link will open up in IE no matter what the default browser might be. This works for IE7 and 8, but not for IE6. With IE6 the query string gets cut off and the browser opens file://c:/results/results.htm# without the query string. I am sure there must be a much better way to do this without the # and which would work in all IEs. How would the pros solve this?

    Read the article

  • GDD-BR 2010 [1H] VC Panel: Entrepreneurship, Incubation and Venture Capital

    GDD-BR 2010 [1H] VC Panel: Entrepreneurship, Incubation and Venture Capital Speakers: Don Dodge, Eric Acher, Humberto Matsuda, Alex Tabor Track: Panels Time slot: H [17:20 - 18:05] Room: 1 Startups can be built and funded anywhere in the world, not just Silicon Valley. Venture Capital investors are investing in startups globally, and funding incubators to hatch their future investments. Find out how you can get into an incubator, or funded by a Venture Capitalist or Angel Investors. Learn from examples in the USA and hear from local VC investors in this panel discussion. Get your questions answered by real investors. From: GoogleDevelopers Views: 6 0 ratings Time: 37:39 More in Science & Technology

    Read the article

  • Single Column Multiple Filter In Mysql Intersection

    - by Jeebus
    Here is a table CarID| Attribute | Value 1 | Color | Red 2 | Color | Blue 3 | Color | Red 1 | Type | Coupe 2 | Type | Hatch Back 3 | Type | Coupe 3 | Make | Honda 2 | Make | Toyota 1 | Make | Ford Now I would like to run a filter Like Select * From Cars WHERE (Attribute = Color AND Value = Red) AND (Attribute = Make AND Value = Honda).... and Hope to get the CarID as 3 ! This is simple case of Intersection of 2 queries but I don't know how to get it done in a single query. Any help appriciated.

    Read the article

  • Android material L image transition interpolator

    - by Diolor
    This is more of a mathematics question rather than programming. Well, I would like to ask id you know what is the interpolator described in Material design: It looks to be an AccelerateDecelerateInterpolator but the deceleration effect decays slower. My best hatch is : public class MaterialInterpolator implements Interpolator { @Override public float getInterpolation(float input) { if(input<1./3f) return new AccelerateInterpolator().getInterpolation(input); else return new DecelerateInterpolator().getInterpolation(input); } } Which creates a gap between the values: Time / Value 0.3,0.09 0.317,0.100489 0.333,0.110889 <-- gap 0.35,0.57750005 0.367,0.599311 0.383,0.61931103 0.4,0.64 Source: http://www.google.com/design/spec/patterns/imagery-treatment.html

    Read the article

  • How to start a ColorAnimation from a MultiTrigger in a ControlTemplate ?

    - by banzai
    Hi all I have the following ControlTemplate for a WPF TabItem: <ControlTemplate x:Key="DefaultTabItemTemplate" TargetType="{x:Type TabItem}"> <ControlTemplate.Resources> <SolidColorBrush x:Key="UnselectedForegroundBrush" Color="#414141" /> <!-- Unique color for this template --> <SolidColorBrush x:Key="SelectedForegroundBrush" Color="#457581" /> <!-- Unique color for this template --> <SolidColorBrush x:Key="MouseOverTextBrush" x:Name="local_MouseOverTextBrush" Color="#FFF2F2F2"/> </ControlTemplate.Resources> <Grid> <Border Name="Border" MinHeight="30" Margin="0,0,0,-1" Background="{DynamicResource TabControlBackgroundBrush}" BorderBrush="{DynamicResource ndt_DisabledForegroundBrush}" BorderThickness="1,1,1,1" CornerRadius="0,0,0,0" > <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center" TextElement.FontStretch="UltraExpanded" TextElement.FontWeight="UltraBlack" ContentSource="Header" Margin="12,2,12,2" RecognizesAccessKey="True" /> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Panel.ZIndex" Value="2" /> <Setter TargetName="Border" Property="Background" Value="{DynamicResource ndt_TabControlBackgroundBrush}" /> <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" /> <Setter TargetName="ContentSite" Property="TextElement.Foreground" Value="{StaticResource SelectedForegroundBrush}" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="Border" Property="Background" Value="{DynamicResource ndt_DisabledBackgroundBrush}" /> <Setter TargetName="ContentSite" Property="TextElement.Foreground" Value="{DynamicResource ndt_DarkGray}" /> <Setter Property="Foreground" Value="{DynamicResource ndt_DisabledForegroundBrush}" /> </Trigger> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsMouseOver" Value="True" /> <Condition Property="IsSelected" Value="False" /> </MultiTrigger.Conditions> <Setter TargetName="Border" Property="Background" Value="{DynamicResource ndt_NavigationAreaBrush}" /> <Setter TargetName="ContentSite" Property="TextElement.Foreground" Value="{DynamicResource MouseOverTextBrush}" /> </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> Everything works fine so far. The MultiTrigger at the end of the template defines a mouse over effect for not selected TabItems. Now I thought the change in color for this mouse over effect looks a bit brash so let´s animate it with a ColorAnimation. But don´t count the chickens before they hatch - everything I tried didn´t work. Maybe I oversee the obvious - but how to achieve this feat ? Thanks in advance banzai

    Read the article

  • UIView animation problem

    - by FoJjen
    I try to make a UIImageView open like a hatch, and under the "hatchView" its anoter imageView but when I start the animation its like the view under gets over and cover the animation, When the animation gets over the imageView the its getting visibel. its works fine if a remove the imageView thats under. Here is the code for animation view. - (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *) event { if (!isHatchOpen) { if (hatchView.layer.anchorPoint.x != 0.0f) { hatchView.layer.anchorPoint = CGPointMake(0.0f, 0.5f); hatchView.center = CGPointMake(hatchView.center.x - hatchView.bounds.size.width/2.0f, hatchView.center.y); } UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInView:hatchView]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationBeginsFromCurrentState:YES]; float pct = location.x / 320.0f; float rad = acosf(pct); CATransform3D transform = CATransform3DMakeRotation(-rad+5, 0.0f, -1.0f, 0.0f); transform.m14 = (1.0 / -2000) * acosf(pct); hatchView.layer.transform = transform; [UIView commitAnimations]; isHatchOpen = YES; } else { if (hatchView.layer.anchorPoint.x != 0.0f) { hatchView.layer.anchorPoint = CGPointMake(0.0f, 0.5f); hatchView.center = CGPointMake(hatchView.center.x - hatchView.bounds.size.width/2.0f, hatchView.center.y); } [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [UIView setAnimationBeginsFromCurrentState:YES]; CATransform3D transform = CATransform3DMakeRotation(0, 0.0f, -1.0f, 0.0f); transform.m14 = 0; hatchView.layer.transform = transform; // Commit the changes [UIView commitAnimations]; isHatchOpen = NO; } } And here a add the Views hatchView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 1, frame.size.width-1, frame.size.height-2)]; [self addSubview:hatchView]; imageView = [[UIImageView alloc] initWithFrame:CGRectMake(1, 1, frame.size.width-2, frame.size.height-2)]; imageView.contentMode = UIViewContentModeScaleAspectFit; [self insertSubview:imageView belowSubview:hatchView];

    Read the article

  • Performance Optimization &ndash; It Is Faster When You Can Measure It

    - by Alois Kraus
    Performance optimization in bigger systems is hard because the measured numbers can vary greatly depending on the measurement method of your choice. To measure execution timing of specific methods in your application you usually use Time Measurement Method Potential Pitfalls Stopwatch Most accurate method on recent processors. Internally it uses the RDTSC instruction. Since the counter is processor specific you can get greatly different values when your thread is scheduled to another core or the core goes into a power saving mode. But things do change luckily: Intel's Designer's vol3b, section 16.11.1 "16.11.1 Invariant TSC The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC. Processor's support for invariant TSC is indicated by CPUID.80000007H:EDX[8]. The invariant TSC will run at a constant rate in all ACPI P-, C-. and T-states. This is the architectural behavior moving forward. On processors with invariant TSC support, the OS may use the TSC for wall clock timer services (instead of ACPI or HPET timers). TSC reads are much more efficient and do not incur the overhead associated with a ring transition or access to a platform resource." DateTime.Now Good but it has only a resolution of 16ms which can be not enough if you want more accuracy.   Reporting Method Potential Pitfalls Console.WriteLine Ok if not called too often. Debug.Print Are you really measuring performance with Debug Builds? Shame on you. Trace.WriteLine Better but you need to plug in some good output listener like a trace file. But be aware that the first time you call this method it will read your app.config and deserialize your system.diagnostics section which does also take time.   In general it is a good idea to use some tracing library which does measure the timing for you and you only need to decorate some methods with tracing so you can later verify if something has changed for the better or worse. In my previous article I did compare measuring performance with quantum mechanics. This analogy does work surprising well. When you measure a quantum system there is a lower limit how accurately you can measure something. The Heisenberg uncertainty relation does tell us that you cannot measure of a quantum system the impulse and location of a particle at the same time with infinite accuracy. For programmers the two variables are execution time and memory allocations. If you try to measure the timings of all methods in your application you will need to store them somewhere. The fastest storage space besides the CPU cache is the memory. But if your timing values do consume all available memory there is no memory left for the actual application to run. On the other hand if you try to record all memory allocations of your application you will also need to store the data somewhere. This will cost you memory and execution time. These constraints are always there and regardless how good the marketing of tool vendors for performance and memory profilers are: Any measurement will disturb the system in a non predictable way. Commercial tool vendors will tell you they do calculate this overhead and subtract it from the measured values to give you the most accurate values but in reality it is not entirely true. After falling into the trap to trust the profiler timings several times I have got into the habit to Measure with a profiler to get an idea where potential bottlenecks are. Measure again with tracing only the specific methods to check if this method is really worth optimizing. Optimize it Measure again. Be surprised that your optimization has made things worse. Think harder Implement something that really works. Measure again Finished! - Or look for the next bottleneck. Recently I have looked into issues with serialization performance. For serialization DataContractSerializer was used and I was not sure if XML is really the most optimal wire format. After looking around I have found protobuf-net which uses Googles Protocol Buffer format which is a compact binary serialization format. What is good for Google should be good for us. A small sample app to check out performance was a matter of minutes: using ProtoBuf; using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.Serialization; [DataContract, Serializable] class Data { [DataMember(Order=1)] public int IntValue { get; set; } [DataMember(Order = 2)] public string StringValue { get; set; } [DataMember(Order = 3)] public bool IsActivated { get; set; } [DataMember(Order = 4)] public BindingFlags Flags { get; set; } } class Program { static MemoryStream _Stream = new MemoryStream(); static MemoryStream Stream { get { _Stream.Position = 0; _Stream.SetLength(0); return _Stream; } } static void Main(string[] args) { DataContractSerializer ser = new DataContractSerializer(typeof(Data)); Data data = new Data { IntValue = 100, IsActivated = true, StringValue = "Hi this is a small string value to check if serialization does work as expected" }; var sw = Stopwatch.StartNew(); int Runs = 1000 * 1000; for (int i = 0; i < Runs; i++) { //ser.WriteObject(Stream, data); Serializer.Serialize<Data>(Stream, data); } sw.Stop(); Console.WriteLine("Did take {0:N0}ms for {1:N0} objects", sw.Elapsed.TotalMilliseconds, Runs); Console.ReadLine(); } } The results are indeed promising: Serializer Time in ms N objects protobuf-net   807 1000000 DataContract 4402 1000000 Nearly a factor 5 faster and a much more compact wire format. Lets use it! After switching over to protbuf-net the transfered wire data has dropped by a factor two (good) and the performance has worsened by nearly a factor two. How is that possible? We have measured it? Protobuf-net is much faster! As it turns out protobuf-net is faster but it has a cost: For the first time a type is de/serialized it does use some very smart code-gen which does not come for free. Lets try to measure this one by setting of our performance test app the Runs value not to one million but to 1. Serializer Time in ms N objects protobuf-net 85 1 DataContract 24 1 The code-gen overhead is significant and can take up to 200ms for more complex types. The break even point where the code-gen cost is amortized by its faster serialization performance is (assuming small objects) somewhere between 20.000-40.000 serialized objects. As it turned out my specific scenario involved about 100 types and 1000 serializations in total. That explains why the good old DataContractSerializer is not so easy to take out of business. The final approach I ended up was to reduce the number of types and to serialize primitive types via BinaryWriter directly which turned out to be a pretty good alternative. It sounded good until I measured again and found that my optimizations so far do not help much. After looking more deeper at the profiling data I did found that one of the 1000 calls did take 50% of the time. So how do I find out which call it was? Normal profilers do fail short at this discipline. A (totally undeserved) relatively unknown profiler is SpeedTrace which does unlike normal profilers create traces of your applications by instrumenting your IL code at runtime. This way you can look at the full call stack of the one slow serializer call to find out if this stack was something special. Unfortunately the call stack showed nothing special. But luckily I have my own tracing as well and I could see that the slow serializer call did happen during the serialization of a bool value. When you encounter after much analysis something unreasonable you cannot explain it then the chances are good that your thread was suspended by the garbage collector. If there is a problem with excessive GCs remains to be investigated but so far the serialization performance seems to be mostly ok.  When you do profile a complex system with many interconnected processes you can never be sure that the timings you just did measure are accurate at all. Some process might be hitting the disc slowing things down for all other processes for some seconds as well. There is a big difference between warm and cold startup. If you restart all processes you can basically forget the first run because of the OS disc cache, JIT and GCs make the measured timings very flexible. When you are in need of a random number generator you should measure cold startup times of a sufficiently complex system. After the first run you can try again getting different and much lower numbers. Now try again at least two times to get some feeling how stable the numbers are. Oh and try to do the same thing the next day. It might be that the bottleneck you found yesterday is gone today. Thanks to GC and other random stuff it can become pretty hard to find stuff worth optimizing if no big bottlenecks except bloatloads of code are left anymore. When I have found a spot worth optimizing I do make the code changes and do measure again to check if something has changed. If it has got slower and I am certain that my change should have made it faster I can blame the GC again. The thing is that if you optimize stuff and you allocate less objects the GC times will shift to some other location. If you are unlucky it will make your faster working code slower because you see now GCs at times where none were before. This is where the stuff does get really tricky. A safe escape hatch is to create a repro of the slow code in an isolated application so you can change things fast in a reliable manner. Then the normal profilers do also start working again. As Vance Morrison does point out it is much more complex to profile a system against the wall clock compared to optimize for CPU time. The reason is that for wall clock time analysis you need to understand how your system does work and which threads (if you have not one but perhaps 20) are causing a visible delay to the end user and which threads can wait a long time without affecting the user experience at all. Next time: Commercial profiler shootout.

    Read the article

  • Termite colony simulator using java

    - by ashii
    hi everyone, i hve to design a simulator that will maintain an environment, which consists of a collection of patches arranged in a rectangular grid of arbitrary size. Each patch contains zero or more wood chips. A patch may be occupied by one or more termites or predators, which are mobile entities that live within the world and behave according to simple rules. A TERMITE can pick up a wood chip from the patch that it is currently on, or drop a wood chip that it is carrying. Termites travel around the grid by moving randomly from their current patch to a neighbouring patch, in one of four possible directions. New termites may hatch from eggs, and this is simulated by the appearance of a new termite at a random patch within the environment. A PREDATOR moves in a similar way to termites, and if a predator moves onto a patch that is occupied by a termite, then the predator eats the termite. At initialization, the termites, predators, and wood chips are distributed randomly in the environment. Simulation then proceeds in a loop, and the new state of the environment is obtained at each iteration. i have designed the arena using jpanel but im not able to randomnly place wood,termite and predator in that arena. can any one help me out?? my code for the arena is as following: 01 import java.awt.*; 02 import javax.swing.*; 03 04 public class Arena extends JPanel 05 { 06 private static final int Rows = 8; 07 private static final int Cols = 8; 08 public void paint(Graphics g) 09 { 10 Dimension d = this.getSize(); 11 // don't draw both sets of squares, when you can draw one 12 // fill in the entire thing with one color 13 g.setColor(Color.WHITE); 14 // make the background 15 g.fillRect(0,0,d.width,d.height); 16 // draw only black 17 g.setColor(Color.BLACK); 18 // pick a square size based on the smallest dimension 19 int sqsize = ((d.width<d.height) ? d.width/Cols : d.height/Rows); 20 // loop for rows 21 for (int row=0; row<Rows; row++) 22 { 23 int y = row*sqsize; // y stays same for entire row, set here 24 int x = (row%2)*sqsize; // x starts at 0 or one square in 25 for (int i=0; i<Cols/2; i++) 26 { 27 // you will only be drawing half the squares per row 28 // draw square 29 g.fillRect(x,y,sqsize,sqsize); 30 // move two square sizes over 31 x += sqsize*2; 32 } 33 } 34 35 } 36 37 38 39 public void update(Graphics g) { paint(g); } 40 41 42 43 public static void main (String[] args) 44 { 45 46 JFrame frame = new JFrame("Arena"); 47 frame.setSize(600,400); 48 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 49 frame.setContentPane(new Arena()); 50 frame.setVisible(true); 51 } 52 53 }

    Read the article

1