Ogre::SceneManager::setAmbientLight doese not work - directx

i am building the wiki Advanced Ogre Framework,
then i find that the Ogre::SceneManager::setAmbientLight() does not work at all.
i find nothing useful after google, anyone can give me some idea?
the code is like this:
m_pSceneMgr = OgreFramework::getSingletonPtr()->m_pRoot->createSceneManager(ST_GENERIC, "GameSceneMgr");
m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.7f, 0.7f, 0.7f));

finally i figure it out bymyslef,
in the framework, i call setAmbientLight() before these code:
DotSceneLoader* pDotSceneLoader = new DotSceneLoader();
pDotSceneLoader->parseDotScene("CubeScene.xml", "General", m_pSceneMgr, m_pSceneMgr->getRootSceneNode());
delete pDotSceneLoader;
there is a node in the CubeScene.xml set the ambient color again, which is (0,0,0), so my call can not work then.

Related

Avalonia: How to display PNG as image?

I haven't seen an F# example of accomplishing this, or any examples similar enough to what I am trying to do, so hopefully a solution here will be helpful to others.
I am using Avalonia with F# to build a simple UI. I want to include images in my UI, but have spent hours looking at documentation and examples and everything I've seen looks to be overcomplicated (maybe it really is just that complicated?).
I am creating an image like:
let b = (Avalonia.Media.Imaging.Bitmap #"C:\Images\icon.png")
Image.create [
Image.source b
]
This just displays nothing. What am I missing here?
To add more detail to my comment above, here's what works for me:
let view =
Component(fun ctx ->
let b = new Avalonia.Media.Imaging.Bitmap("Small.png")
Image.create [
Image.source b
]
)
Result is:

Possible to make a composite symbol?

When editing a vertex I would like to substitute the vertex symbol with SimpleMarkerSymbol and a TextSymbol but that appears to be impossible. Any suggestions on how I could do this? I want the appearance of dragging something like this (text + circle):
After taking some time to look at the API I've come to the conclusion it is impossible. Here is my workaround:
editor.on("vertex-move", args => {
let map = this.options.map;
let g = <Graphic>args.vertexinfo.graphic;
let startPoint = <Point>g.geometry;
let tx = args.transform;
let endPoint = map.toMap(map.toScreen(startPoint).offset(tx.dx, tx.dy));
// draw a 'cursor' as a hack to render text over the active vertex
if (!cursor) {
cursor = new Graphic(endPoint, new TextSymbol({text: "foo"}));
this.layer.add(cursor);
} else {
cursor.setGeometry(endPoint);
cursor.draw();
}
})
You could use a TextSymbol to create a point with font type having numbers inside the circle. Here is one place where you can find such font. http://www.fontspace.com/the-fontsite/combinumerals
Wont be exactly as shown in the image but close enough. Also some limitation it wont work with IE9 or lower (this is as per esri documentation, as I am using halo to get the white border).
Here is the working Jsbin : http://jsbin.com/hayirebiga/edit?html,output use point of multipoint
PS: I have converted the ttf to otf and then added the font as base64, which is optional. I did it as I could not add the ttf or otf to jsbin.
Well, Achieve this seems impossible so far however ArcGIS JS API provides a new Application/platform where you can generate single symbol online for your applications.
We can simply create all kind of symbols(Provide by ESRI) online and it gives you on the fly code which you just need to paste in your application.
This will help us to try different type of suitable symbols for the applications.
Application URL: https://developers.arcgis.com/javascript/3/samples/playground/index.html
Hoping this will help you :)

Maxscript Material/Slate editor?

Hey guys is there a way to access "Material Editor: Manual Update Toggle" for both Slate editor and compact in maxscript?? was looking through the docs but cant seem to find much. any help is appreciated, thanks!!
Doesn't updating materials happen automatically? or do you maybe mean "update preview"?
I know that when you do a loop for all your materials, you can via code update the loop and all of its functions by deciding when to trigger the function.
You can acces those materials + all of its functions with something like:
(libile can be external file of internal from your editor)
local tempLib = loadTempMaterialLibrary libFile
for m in tempLib do (
global materialName = #(m)
)
local materialcount = templib.count
for iterations = 1 to materialcount do
(
-- whatever you like to do
)

nsIFind has aWordBreaker functionality

I'm trying to use the nsIFind function and on opening it in MXR I see that it has something called aWordBreaker.
I'm looking for help on how to set aWordBreaker and learn how it behaves.
http://mxr.mozilla.org/mozilla-release/source/embedding/components/find/src/nsFind.cpp#543
I'm trying to learn about this and how to use it, but need some help.
If I do this:
let finder = Cc["#mozilla.org/embedcomp/rangefind;1"]
.createInstance()
.QueryInterface(Ci.nsIFind);
console.log('finder',finder);
I find that finder has this:
Find: function
QueryInterface: Function
caseSensitive: false
findBackwards: false
So I can set finder.caseSensitive but I can't set finder.aWordBreaker.
So in summary: I'm looking for help on how to set aWordBreaker and learn how it behaves.
Useful sources on MXR:
http://mxr.mozilla.org/mozilla-release/source/intl/lwbrk/public/nsIWordBreaker.h
http://mxr.mozilla.org/mozilla-release/source/intl/lwbrk/src/nsSampleWordBreaker.cpp
Example usage here:
http://mxr.mozilla.org/mozilla-release/source/editor/txtsvc/src/nsTextServicesDocument.cpp#3646
3645 nsIWordBreaker* wordBreaker = nsContentUtils::WordBreaker();
3646 nsWordRange res = wordBreaker->FindWord(str, strLen, strOffset);
Does anyone know how to get access to nsContentUtils with javascript?

apply new layer to a slice of a volume webgl

i have two volumes (.nrrd) of different qualities. the user can browse through the layers. if a key is pressed
i want to load the slice of the volume with better quality.
my volume is similar to this one: lesson 10 xtk
i've found:
volume.children[2].children[0].children[0].texture.file = "http://path/to/file.ext";
but if i apply some kind of file (.jpg, .dcm) nothing happens.
is this the right approach to change the slice to go inside the children and change the texture?
or shall i load the selected slice seperate as an object and apply it to the "lower-quality-volume" somehow?
edit:
this is what i tried so far (i get errors with dcms but not with jpgs):
if (event.keyCode == 83) { // "s"-button
volume.children[2].children[0].children[0].texture.file = "http://localhost:3000/112.jpg";
volume.children[2].children[0].children[0].modified();
r.render();
}
edit2: this is whats in my r.onShowtime = function() {}
volume.children[2].children[0].texture.file = 'http://localhost:3000/112.jpg';
volume.children[2].children[0].visible = true; // to activate the first layer
volume.children[2].children[0].modified();
console.log(volume.children[2].children[0].visible +" "+ volume.children[2].children[0].texture.file);
it outputs "true hostname/112.jpg"
when i inspect the .jpg in firebug the header is ok but the answer is "null"
when i inspect console.log(volume.children[2].children[0]); with firebug
.texture.file is set to hostname/112.jpg
when i go to "network" the .jpg has been transfered successfully
please notice that 112.jpg and level.jpg are the same. the first one is getting loaded in r.onShowtime and the other one is loaded at a keypressed event.
EDIT 3: volume.children[2].children[0] is of the type "X.slice", isn't it?
here is my approach: jsFiddle
and this is my actual issue and still not working: jsFiddle
Mhh..
I think a call to object.modified() is missing in the file setter (and in others setters from inject classes). Let's see when Haehn will come if he wants to change something internaly, but for the moment could you try to call it by yourself ?
You can try to add after the modification of texture :
volume.children[2].children[0].children[0].modified();
And if it doesn't work, in addition :
renderer.render();
Edit :
It's strange, I did a similar code and it did something. Can you please try something like that with opening your javascript console (Firefox, Chrome,... has one) and tell me the error you get ?
renderer.onShowtime = {
for (var i=0 ; i< volume.children[2].children.length ; i++) {
volume.children[2].children[i].texture.file="myimage.jpeg";
volume.children[2].children[i].modified();
}
}
It is important you call it in the onShowtime, because before the volume is not loaded, and so slicesX, slicesY... don't exist.
Edit2 :
Hey,
Thanks to the informations you added I think I've got the point ! In the render() method of our renderer3D there is a test on texture._dirty flag, that you cannot change from outside the framework. In addition the 1st rendering with a texture make that flag false, and loading a new texture doesn't seem to set that flag back to true in the current XTK. So, I think, we have to add it in the loader.load(texture, object) method. I'll make an issue on Github and see what Haehn thinks of it !

Resources