top of page
Search
mandygonzales

VS2015 – Generate all graphic Assets for your UWP app with one image



The XAML Designer in Visual Studio provides a visual interface to help you design XAML-based Windows Store, Windows Phone, WPF, and Silverlight apps. You can create user interfaces for your apps by dragging controls from the Toolbox and setting properties in the Properties window. You can also edit XAML directly in XAML view.




VS2015 – Create all graphic Assets for your UWP app from a single image




In short you create special object implementing the IUriToStreamResolver interface, that has method IAsyncOperation UriToStreamAsync(Uri uri). In this method you can handle all HTTP requests from the WebView and load your page resources from any source you want!


We also create some matrices that transforms our scene from world space to something that looks like 3d on a 2d plane (what we see on out monitor). The vertices created above and these transformations are then passed into the graphics pipeline, starting with the Vertex Shader. The world transformation is used to position objects in the game world itself, the projection transformation is used to place this into a projected world (giving depth, distance), and the view transformation is used to place objects in a give view window (think of this as your eye or camera into your game world).


Alright, after experimenting here are some insights:1.) Real time, constant barcode scanning is not likely. It was my hope to have a constant scanning system so that it can look for certain barcodes and maybe see them before the person does to better direct them. However, even with multi-threading, the ZXing library creates too big of a process hit and causes a large FPS drop. 2.) Grabbing frames to process is also a bit too intensive for the system, and results in a lower frame rate and sometimes hitching/freezing for a very short period. I found the locatable camera to be too slow. I found the Unity's WebCamTexture to work better. I set the resolution to 1280x720 for testing (reason for higher res explained below), and set the requested frame rate to 1. The 1 is not proper, but Unity forces the webcam to match the nearest FPS supported, thus the 1 defaults the webcam to the lowest FPS it supports.3.) The barcode library, ZXing, works pretty well but it does not help that it seems that it largely focuses on the center of an image, which is an optimization that makes sense on their part. However, if the user is in a scanning mode, and their head is moving around doing some task while trying to scan this may be more difficult for them to achieve. My code takes the webcam texture, and splits it into quadrants, and each of these are scanned. This helps with the peripheral scanning.4.) Doing #3 I noticed the system now recognized barcodes from further away. This is because you're taking the larger image, cropping it, and essentially zooming in to a section for scanning. This zooming allows it to work from further away. Thus, I created a zoom section as well.5.) #3 and #4 result in multiple images to scan, so I abstracted out the barcode scanning to lists and arrays and abstracted that out to it's own class. You instantiate the class, passing a callback function in the constructor, and then call a barcode scanning function passing the list of images to scan.6.) Most importantly, I figured out how to get the darn thing to compile. You get the Unity ZXing DLL from their repository. From here, drag it into your project, then click on the DLL in the asset manager, under the Windows Store App Settings check the "Don't process" checkbox. Best I can tell, without this setting (which is off by default) Unity actually alters the DLL to what it thinks is needed to run on the platform... Sadly, it doesn't do a good job. Once this is checked, the exported codebase compiles perfectly for x86.


Once you have a a Unity project created and open the solution in Visual Studio, you can add extra projects to that solution, specifically VB.Net class library projects, targeting .Net 4.6. Just add the references to the Unity DLL's and set them all as Copy Local = Never. You can then add a post-build macro that copies the built DLL's to a folder inside the Assets folder of your Unity project. Unity will pick them up and you can drag classes that inherit from MonoBehavior as components to any game object or prefab. The Unity DLL's are in the \Editor\Data\Managed folder where you have Unity installed. 2ff7e9595c


0 views0 comments

Recent Posts

See All

Baixe a música kacha badam

Baixar Kacha Badam Song: O sucesso viral que todo mundo está falando Se você é ativo nas mídias sociais, especialmente no Instagram, deve...

Null 39;s Royale

Null's Royale: o melhor servidor privado para os fãs do Clash Royale Se você é fã de Clash Royale, o popular jogo de estratégia em tempo...

Comments


bottom of page