Best way to make solid wireframe material with Away3d? - actionscript-3

Can't find any good example of solid wireframe material in Away3d. Maybe I am using wrong tool?

There is a set of Wireframe primitives, like WireframeSphere and WireframeCube. Just define them and add to the scene:
var primitive = new WireframeCube(400,800,400,0xFFFFFF,1);
primitive.x = 1000;
scene.addChild(primitive);
But I believe you want to apply wireframe to non primitive object. In that case - I'm also looking for the answer...
EDIT:
I have found some workaround called WireframeMapGenerator. It's not true wire frame material but at least it works:
http://away3d.com/forum/viewthread/779/#2597

Related

Displaying Umbraco Grid in Mega Menu

I want to display Umbraco Grid in Mega Menu, and I cannot use #CurrentPage.GetGridHtml("") in this scenario.
I need to get it using node variable: myNode.GetProperty("menuGrid")
What is the best way to do that?
You can use various ways of getting content from the grid. They are all described here: https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/grid-layout/render-grid-in-template.
In my opinion, the best way would be to create custom grid view / renderer and just use it here with proper method for retrieving content e.g.
#CurrentPage.GetGridHtml(Html, "yourGridPropertyAlias", "customgridview")
#CurrentPage.GetGridHtml(Html, "yourGridPropertyAlias", "/views/othercustomgridview.cshtml")
Marcin's suggestions were helpful with finding a solution.
Just in case somebody is looking for something similar I had my INode which hasn't got access to GetGridHtml. After convertion to typed content I regained access to that property
foreach (var country in countryNode.ChildrenAsList)
{
var myNode = Umbraco.TypedContent(country.Id);
var property = myNode.GetGridHtml("menuGrid");
}

Android ListView binding programmatically

There are many examples of doing this in axml, but I would like to have a complete binding using code behind. To be honest, I would like to have NO axml, but seems like creating all the controls programmatically is a nightmare.
I first tried the suggestions at:
MvxListView create binding for template layout from code
I have my list binding from code-behind, and I get six rows (so source binding is working); but the cells itself does not bind.
Then at the following url:
Odd issue with MvvmCross, MvxListViewItem on Android
Stuart has the following comment: Have looked through. In this case, I don't think you want to use DelayBind. DelayBind is used to delay the binding action until next time the DataContext is set. In Android's MvxAdapter/MvxListItemView case, the DataContext is passed in the ctor - so DataContext isn't set again until the cell is reused. (This is different to iOS MvxTableDataSource).
So in essence, the only example I see shows DelayBind, which shouldn't work.
Can someone please show me some examples... thanks in advance.
Added reply to Comments:
Cheesebaron, first of all, a huge thank you and respect for all your contributions;
Now, why not use axml? Well, as programmers, we all have our own preferences and way of doing stuff - I guess I am old school where we didn't have any gui designer (not really true).
Real reasons:
Common Style: I have a setup where Core has all the style details, including what all the colors would be. My idea is, each platform would get the style details from core and update accordingly. It's easy for me to create controls with the correct style this way.
Copy-Paste across platform (which then I can even have as linked files if I wanted). For example, I have a login screen with web-like verification, where a red error text appears under a control; overall on that screen I have around 10 items that needs binding. I have already got iOS version working - so starting on Droid, I copied the whole binding section from ios, and it worked perfectly. So, the whole binding, I can make it same across all platform... Any possible error in my way will stop at building, which I think is a major advantage over axml binding. Even the control creation is extremely similar, where I have helpers with same method name.
Ofcourse I understand all the additional layout that has to be handled; to be honest, it's not that bad if one really think it through; I have created a StackPanel for Droid which is based on WP - that internally handles all the layouts for child views; so for LinearLayout, all I do is setup some custom parameters, and let my panel deal with it. Relative is a different story; so far, I have only one screen that's relative, and I can even make it Linear to reduce my additional layout code.
So, from my humble point of view, for my style, code-behind creation allows me to completely copy all my bindings (I do have some custom binding factories to allow that), copy all my control create lines; then only adding those controls to the view is the only part that is different (then again, droid and WP are almost identical). So there is no way I can miss something on one platform and all are forced to be the same. It also allows me to change all the styles for every platform just by changing the core. Finally, any binding error is detected during compile - and I love that.
My original question wasn't about NOT using axml... it was on how to use MvxListView where all the binding is done in code-behind; as I have explained, I got the list binding, but not the item/cell binding working.
Thanks again in advance.
Here is part of my LoginScreen from droid; I think it's acceptable amount of code for being without axml file.
//======================================================================================================
// create and add all controls
//======================================================================================================
var usernameEntry = ControlHelper.GetUITextFieldCustom(this, "Username.", maxLength: 20);
var usernameError = AddErrorLabel<UserAuthorization, string>(vm => ViewModel.Authorization.Username);
var passwordEntry = ControlHelper.GetUITextFieldCustom(this, "Password.", maxLength: 40, secureTextEntry: true);
var passwordError = AddErrorLabel<UserAuthorization, string>(vm => ViewModel.Authorization.Password);
var loginButton = ControlHelper.GetUIButtonMain(this);
var rememberMe = new UISwitch(this);
var joinLink = ControlHelper.GetUIButtonHyperLink(this, textAlignment: UITextAlignment.Center);
var copyRightText = ControlHelper.GetUILabel(this, textAlignment: UITextAlignment.Center);
var copyRightSite = ControlHelper.GetUIButtonHyperLink(this, textAlignment: UITextAlignment.Center);
var layout = new StackPanel(this, Orientation.Vertical)
{
Spacing = 15,
SubViews = new View[]
{
ControlHelper.GetUIImageView(this, Resource.Drawable.logo),
usernameEntry,
usernameError,
passwordEntry,
passwordError,
loginButton,
rememberMe,
joinLink,
ControlHelper.GetSpacer(this, ViewGroup.LayoutParams.MatchParent, weight: 2),
copyRightText,
copyRightSite
}
};
I just came across a similar situation myself using Mvx4.
The first link you mentioned had it almost correct AND when you combine it from Staurts comment in the second link and just remove the surrounding DelayBind call, everything should work out ok -
public class CustomListItemView
: MvxListItemView
{
public MvxListItemView(Context context,
IMvxLayoutInflater layoutInflater,
object dataContext,
int templateId)
: base(context, layoutInflater, dataContext, templateId)
{
var control = this.FindViewById<TextView>(Resource.Id.list_complex_title);
var set = this.CreateBindingSet<CustomListViewItem, YourThing>();
set.Bind(control).To(vm => vm.Title);
set.Apply();
}
}
p.s. I have asked for an Edit to the original link to help others.

Box2d MovieClip to original position

I want to try a simple task where if i move a object inside the world and then press a button it should go back to its original position , but its not working , below is the code i am using - the file is here - http://www.fastswf.com/yAnIvBs (when i remove the event listener)
with event listener - http://www.fastswf.com/rpYsIt8
////////========================
stop();
var startXPos:Number = level1WorldObj.box1.x;
var startYPos:Number = level1WorldObj.box1.y;
function areaS(e:Event) {
level1WorldObj.box1.y= startYPos;
level1WorldObj.box1.x= startXPos;
level1WorldObj.box1.removeEventListener(Event.ENTER_FRAME, areaS);
}
but1.addEventListener(MouseEvent.CLICK,nClick3);
function nClick3(event:MouseEvent):void{
level1WorldObj.box1.addEventListener(Event.ENTER_FRAME, areaS);
level1WorldObj.box1.y= startYPos;
level1WorldObj.box1.x= startXPos;
}
/////////////////======================
Now i want to be able to do it many time so i kept the variables that detect the initial x, y as global ...
Here you can see how it behaves in debugdraw mode , strangely only the clip moves not the actual body - http://www.fastswf.com/-Ijkta4
Can some one please guide me here ...
Thanks in advance ...
Jin
The graphics that you see (box1) aren't related to the physical object behind the scenes - you're currently only moving the graphics not the object itself.
You need to use either SetPosition() or SetTransform() on the b2Body of the object
Edit 07/7
As you're using the Box2D World Construction Kit, I took a look at the source code (available here: https://github.com/jesses/wck). The main class seems to be BodyShape (https://raw.githubusercontent.com/jesses/wck/master/wck/BodyShape.as).
Looking through it, you should be able to access the b2Body directly. If it's null (which is probably the source of the TypeError that you're getting, then you haven't called createBody(), which is what actually takes all of your properties as creates the physical object behind the scenes.
Once you have a b2Body, if you want to position it based on the graphics, there's a function syncTransform() to do just that.
You should turn on debugDraw on your World class to make it easier to see what's going on in the background. NOTE: this needs to be done before calling create()
I was able to find solution to this problem , i found the starting point by using this -
trace(level1WorldObj.box1.b2body.GetPosition().x);
trace(level1WorldObj.box1.b2body.GetPosition().y);
then once i had the position manually i took down the coordinates and used the below code ....
level1WorldObj.box1.b2body.SetTransform(new V2(-2, 2),0 );
Thanks #divillysausages for all the help ...
Regards

How to automatic alignment Fibers, Volume and Mesh use XTK

I think it is a simple question, but it really confuse me...
In the case which I try to show three object together, like Fibers, Volume and Mesh, just as you can see in this demo web.
Demo Web: http://goo.gl/NP2eUo
But there is a problem, the Fibers object can not automatic alignment with Volume and Mesh. Those files are come from the same source (one subject's DICOM file) so it should can be match together in default.
If only show the Fibers object, it can be put in the center of the view. But if show three object together, then Fibers object will be Shift!!!
Is there any possible way can let three object automatic alignment together?
And here is my source code: http://goo.gl/Ttzc84
What if you try to call reset boundingBox on showtime?
...
// .. add the mesh
r.add(mesh);
r.onShowtime = function() {
r.resetBoundingBox();
}
r.render();
...
How did you generate the surface and the trk file? Freesurfer and DTK?
I suspect the trk file does not provide any IJKToRAS transformation.

Surface in box2das3

I'm using box2dflash for as3 and i need to create curvy ground like this.
Facts:
I can't create one solid object as far as I know because box2d support convex objects;
I didn't find any line-based objects.
Question:
Is there any better way than doing this the way shown on image below?
I couldn't say for sure, but I think that is the best way of doing it.
There is some code on this article for doing a similar thing:
Terrain like tiny wings
You will want to look at the "drawHill" function (Line 91). Sorry I can't be of much more help, I have limited experience with box2D.
I've discovered that you actually can create line.
var groundFixtureDef:b2FixtureDef = new b2FixtureDef();
groundFixtureDef.density = 1;
var someShape: b2PolygonShape = new b2PolygonShape();
someShape.SetAsArray( new Array(new b2Vec2(-3,0),new b2Vec2(2,0)), 2);
groundFixtureDef.shape = someShape;
This would create a simple line. But if you add more points, it'll form convex shape.