How to use AssetContainer with AssetManager in babylonJS? - babylonjs

I'm using BabylonJS for some 3D project, While setting up a scene I can load up multiple GLB files using AssetManager, after all the loading tasks has been done, i can find the meshes in the scene, but cannot find the meshes that should be loaded towards the AssetContainer, how can i access the AssetContainer after loading the meshes to AssetContainer using AssetManager.addContainerTask.

After containerTask = assetManager.addContainerTask use:
containerTask.onSuccess = (task) => {
const container = task.loadedContainer;
}

Related

Process to find camera pointer in a game using cheat engine?

I am trying to find out how to get a mouse working inside RPCS3 emulator for a game (Ghost Recon Future Soldier with patch 1.05)
There is a library that supports injecting the mouse but doesn't support the game I am trying to play. After a lot of digging, I found a library that actually implements mouse injection in a few games.
Sample implementation for the KillZone3 game to support mouse injection looks like this in C#
using KAMI.Core.Cameras;
using KAMI.Core.Utilities;
using System;
namespace KAMI.Core.Games
{
public class Killzone2PS3 : Game<HVecVACamera>
{
DerefChain m_hor;
DerefChain m_vert;
public Killzone2PS3(IntPtr ipc, string version) : base(ipc)
{
uint baseAddress = version switch
{
"01.01" => 0x117e740 + 0x234,
"01.29" => 0x11B0540 + 0x234,
_ => throw new NotImplementedException($"{nameof(Killzone2PS3)} [v'{version}'] is not implemented"),
};
var baseChain = DerefChain.CreateDerefChain(ipc, baseAddress, 0x0);
m_vert = baseChain.Chain(0x80).Chain(0x5c).Chain(0x11c).Chain(0x78);
m_hor = baseChain.Chain(0x78).Chain(0x0).Chain(0x68).Chain(0xc).Chain(0x90);
}
public override void UpdateCamera(int diffX, int diffY)
{
if (DerefChain.VerifyChains(m_hor, m_vert))
{
m_camera.HorY = IPCUtils.ReadFloat(m_ipc, (uint)m_hor.Value);
m_camera.HorX = IPCUtils.ReadFloat(m_ipc, (uint)(m_hor.Value + 4));
m_camera.Vert = IPCUtils.ReadFloat(m_ipc, (uint)m_vert.Value);
m_camera.Update(diffX * SensModifier, -diffY * SensModifier);
IPCUtils.WriteFloat(m_ipc, (uint)m_hor.Value, m_camera.HorY);
IPCUtils.WriteFloat(m_ipc, (uint)(m_hor.Value + 4), m_camera.HorX);
IPCUtils.WriteFloat(m_ipc, (uint)m_vert.Value, m_camera.Vert);
}
}
}
}
Main lines in the above program are those addresses which I believe are associated with the camera pointer stored in memory obtained mostly with Cheat Engine.
What is the process required to find these pointers for my game. I am aware that is may be different for each game but I could really use some direction here. Where do I start? How do I narrow down till I arrive at this pointer
What a coincidence, I am also doing the exact same thing on RPCS3 right now. After digging around I've found some videos that discuss into how to use Cheat Engine to find where a player's position and camera would be stored. It involves making a lot of separate scans in Cheat Engine to search for unknown values that are increasing/decreasing.
This video seems to be the closest thing to what you are looking for:
https://www.youtube.com/watch?v=yAl_6qg6ZnA
You should also make sure you set up Cheat Engine so it works with RPCS3 correctly as shown here:
https://exvsfbce.home.blog/2019/08/24/basic-cheat-engine-setup-on-rpcs3/
After you've found the correct pointer for the camera it should be fairly easy to implement it into the library by making your own class in the Games folder.

Best way to force textures upload to GPU at scene load time?

I was wondering the best way to force textures upload to GPU at scene load? I’ve read GPU Texture Preloading section within Best Practices, but I’m not quite sure if that’s something that needs to be done texture by texture and element by element.
There's an old thread talking about it here, but it doesn't seem to have a happy ending so far :(
Would it make sense to make a traverse from the sceneEl, before the scene has loaded, obtain every texture and call document.querySelector('a-scene').renderer.setTexture2D(eachTexture, 0)?
Thanks
setTexture2D no longer exists as of r103. You can use something like this instead
const forceTextureInitialization = function() {
const material = new THREE.MeshBasicMaterial();
const geometry = new THREE.PlaneBufferGeometry();
const scene = new THREE.Scene();
scene.add(new THREE.Mesh(geometry, material));
const camera = new THREE.Camera();
return function forceTextureInitialization(texture) {
material.map = texture;
renderer.render(scene, camera);
};
}();
Yes, that makes sense to do.
Just call sceneEl.renderer.setTexture2D(texture, i), passing in the three.js texture. And I think it's better to cycle i to a different value each call between 1 and 8.

How to make temporary un-hit-testable paths in paper.js?

I need to make temporary paths (which will get removed once some operation is completed) using paper.js but I do not want them to be available in the HitResult.
I can achieve this by adding a flag to such paths, have a wrapper function over HitTest api which removes such paths from the result.
But I do not think this is a good design. HitTest calculations can be sped up if such paths are ignored at initial stages.
Is there any other option to achieve this?
You can set the item as locked to skip it in the hitTest calculations.
var path = new Path.Circle(new Point(100, 70), 50);
path.fillColor = 'black';
path.locked = true;
function onMouseDown(e) {
console.log(e.item);
}
And a Sketch here
Quoting this thread:
For now it only affects Item#hitTest(). Any item that is locked is skipped there.

to paint image in standard NPAPI plugin with QT

I need to create a NPAPI browser plugin to show a picture.
Till now, I have create that and draw a picture in plugin with GDK successfully, I catch the event in "NPP_HandleEvent()" function and get a GdkDrawable object with method "gdk_pixmap_lookup", just like the following codes:
int16_t NPP_HandleEvent(NPP instance, void* event) {
XGraphicsExposeEvent *expose = &nativeEvent->xgraphicsexpose;
instanceData->window.window = (void*)(expose->drawable);
GdkNativeWindow nativeWinId = (XID)(instanceData->window.window);
GdkDrawable* gdkWindow = GDK_DRAWABLE(gdk_pixmap_lookup(xid));
NPSetWindowCallbackStruct *ws_info = (NPSetWindowCallbackStruct*)(instanceData->window.ws_info);
GdkVisual* gdkVisual = gdkx_visual_get(ws_info->visual ? XVisualIDFromVisual(ws_info->visual) : 0);
GdkColormap* gdkColormap = gdk_x11_colormap_foreign_new(gdkVisual, ws_info->colormap);
gdk_drawable_set_colormap(gdkWindow, gdkColormap);
// another method, to use GdkWindow to draw picture.
drawWindow(instanceData, gdkWindow);
}
so now, I'm wondering how to use QT methods draw a picture in this plugin ? any ways just use QT and X11 releated stubs to implement this ?

Problem with Flex DataVisualization Charting components Rendering Labels on Build Server

I'm having a problem with labels disappearing on Flex's datavisualization.swc charts that are built on our build server via ANT and the Flex 3.3 SDK. I've made sure that our license is applied properly on the build server (hence no water marks), and I've made sure the exact same datavisualization.swc was copied from my dev machine into the Flex3.3SDK/frameworks/libs directory.
Any ideas? Could it be a font problem? (Though we're really only using default fonts.)
Here's the problem, missing axis labels on the build server
alt text http://img687.imageshack.us/img687/5038/chartwithmissingaxislab.png
Here's how it's supposed to look with labels (taken on my local development machine)
alt text http://img683.imageshack.us/img683/1504/chartwithaxislabels.png
I got it working using the helpful information I found at the Flex Coders archive.
Basically, in an initalize event handler, I added the following code:
var ccClassFactory:ContextualClassFactory = new ContextualClassFactory(ChartAxisTextLabel);
ccClassFactory.moduleFactory=this.moduleFactory;
var hAxisRenderer:AxisRenderer = new AxisRenderer();
hAxisRenderer.axis = hAxis;
hAxisRenderer.labelRenderer=ccClassFactory;
var vAxisRenderer:AxisRenderer = new AxisRenderer();
vAxisRenderer.axis = vertAxis;
vAxisRenderer.labelRenderer=ccClassFactory;
lineChart.horizontalAxis=hAxis;
lineChart.verticalAxis=vertAxis;
lineChart.horizontalAxisRenderers = [ hAxisRenderer ];
lineChart.verticalAxisRenderers = [ vAxisRenderer ];
Also, I had to create the class:
public class ChartAxisTextLabel extends Label
{
public function ChartAxisTextLabel()
{
super();
}
override public function set data(value:Object):void
{
super.data = value;
text = value.text;
}
}

Resources