OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

PHYSFS / VFS - How to make a custom osgDB:: function ?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Steal
User


Joined: 26 Jan 2017
Posts: 60

PostPosted: Mon Jul 10, 2017 1:28 pm    Post subject:
PHYSFS / VFS - How to make a custom osgDB:: function ?
Reply with quote

Hi,

More keywords would be: How to reimplement or override the osgDB namespace functions? They have
Code:
__declspec(dllimport)
and it seems the osgPlugins are hardcoded to use this.

From the osgrecipes I've got a small, effective and somewhat working ReaderWriterPhysFS. It reads my model.obj.physfs properly, however, osgdb_obj looks for the existence of the mtllib file using
Code:
osgDB::findDataFile


What are my options to make subloads like textures work, because right now it says

Code:
Obj unable to find mtllib 'bla.mtl'


Thank you!

Cheers,
Johny
Back to top
View user's profile Send private message
Steal
User


Joined: 26 Jan 2017
Posts: 60

PostPosted: Mon Jul 10, 2017 1:31 pm    Post subject:
Reply with quote

Hi,

Alternatively, I could write the obj and mtl to a temporary location on disk, like in %APPDATA%/.osg

Then I turn that into a node, and hope that the physfs readerwriter accounts for the textures. I'll have to experiment with this, I suppose?

Thank you!

Cheers,
Johny
Back to top
View user's profile Send private message
Steal
User


Joined: 26 Jan 2017
Posts: 60

PostPosted: Mon Jul 10, 2017 3:10 pm    Post subject:
Reply with quote

Hi,

I have fixed the kind of broke osgRecipes vfs and submitted an issue to fix it.

https://github.com/xarray/osgRecipes/issues/19

Here is the code with some additions to make it work for my scenario.

You'll have to edit it a bit to make it work, and it definitely has bugs beyond what is already obviously broke.

Thank you!

Cheers,
Johny
Back to top
View user's profile Send private message
Voerman, L.
Guest





PostPosted: Mon Jul 10, 2017 3:28 pm    Post subject:
PHYSFS / VFS - How to make a custom osgDB:: function ?
Reply with quote

Hi Johny,you can't reimplement or override the osgDB::findDataFile(), but with osgDB::setFindFileCallback() you can make it do whatever you want.


Regards, Laurens.


On Mon, Jul 10, 2017 at 3:28 PM, Johny Canes < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

More keywords would be: How to reimplement or override the osgDB namespace functions? They have
Code:
__declspec(dllimport)

 and it seems the osgPlugins are hardcoded to use this.

Quote:
From the osgrecipes I've got a small, effective and somewhat working ReaderWriterPhysFS. It reads my model.obj.physfs properly, however, osgdb_obj looks for the existence of the mtllib file using
Code:
osgDB::findDataFile



What are my options to make subloads like textures work, because right now it says


Code:
Obj unable to find mtllib 'bla.mtl'



Thank you!

Cheers,
Johny

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71143#71143





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
Steal
User


Joined: 26 Jan 2017
Posts: 60

PostPosted: Mon Jul 10, 2017 7:12 pm    Post subject:
Reply with quote

Hi,

Thanks, my custom callback gave problems though, even relying on the findDataFileImplementation fallback.

My simple workaround so far is to put the .obj and .mtl into a temporary, physical location, and then turn that into an .osg.

My osgDB::FindFileCallback::findDataFile reportedly tried finding the .mtl, but even if adding supportsExtension to my readerwriter and all of that, it never made sense.

However, as I said, writing c.Obj and c.Mtl to a /tmp folder, and readNodeFile takes both files, then proceeds to use the physfs readerwriter to pull in all of the textures.

So the problem is the findDataFile not delegating to my physfs readerwriter, I suppose.

The temp is a working solution, and consequently, the converted .osg mesh is read with no problem from the vfs, including the texture loads after that.

Thank you!

Cheers,
Johny
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts osgDB::ImagePaged don't have "Pa... tang General 0 Mon Nov 13, 2017 2:51 am View latest post
No new posts Make ObjOptionsStruct in obj plugin a... Ralf Habacker Submission 1 Fri Oct 20, 2017 8:31 am View latest post
No new posts custom file GeekOwl Plugins [osgPlugins] 1 Thu Oct 12, 2017 12:32 pm View latest post
No new posts Problem compiling OSG 3.4.1 osgDB 64 bit tonyor Build system [build] 0 Thu Sep 21, 2017 12:41 am View latest post
No new posts Passing input to viewer/camera (using... antiro42 General 2 Sat Sep 16, 2017 11:07 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP