GithubHelp home page GithubHelp logo

cedricpinson / osgjs Goto Github PK

View Code? Open in Web Editor NEW
783.0 783.0 201.0 157.98 MB

Javascript Implementation of OpenSceneGraph [DISCONTINUED] Website archived https://cedricpinson.github.io/osgjs-website/

License: MIT License

HTML 0.30% JavaScript 98.87% GLSL 0.71% CSS 0.06% Shell 0.06%

osgjs's Introduction

Status - DISCONTINUED

Join the chat at https://gitter.im/cedricpinson/osgjs Build Status Coverity Status OSG.JS WebGL framework

OSGJS is a WebGL framework based on OpenSceneGraph concepts. It allows an individual to use an “OpenSceneGraph-like” toolbox to interact with WebGL via JavaScript, and provides facilities for exporting various assets to the osgjs format. The API is kept as similar to OpenSceneGraph as possible, providing a familiar environment to veterans of the library and introducing newcomers to a popular and heavily-scrutinzed set of interfaces

The mailing list is available here: http://groups.google.com/group/osgjs

If you are interested in contributing, contact us on the osgjs gitter channel ( https://gitter.im/cedricpinson/osgjs ) or on the IRC channel #osgjs on Freenode. Follow @trigrou on twitter to get news and updates.

Examples / Tutorials

How to build your own osgjs

First, clone a copy of the main git repo by running:

git clone git://github.com/cedricpinson/osgjs.git
cd osgjs

Install required node dependencies:

# if you dont have grunt-cli installed, use sudo on linux
# npm install -g grunt-cli
npm install

Compile:

grunt build

Compile whenever watched files change:

grunt watch

The built version of osgjs will be put in the build/ subdirectory.

Running the examples

Download the osgjs-data submodule repository. It will be added to the examples/media folder:

grunt sync

Then simply type in the command-line:

grunt serve

You can now test some real examples http://localhost:9000/examples http://localhost:9000/tutorial

Executing unitary tests

Launch:

grunt test

Convert file to osgjs

You can easily convert 3D file with osgconv tool. To do that you can get the docker image here https://hub.docker.com/r/trigrou/osg/ and use it to convert a 3d file into osgjs file format. There is more infos on wiki

osgjs's People

Contributors

arcanis avatar arthurjamain avatar aurl avatar cedricpinson avatar gfaucill avatar gitter-badger avatar gvergnaud avatar hishamabdelrahman avatar jtorresfabra avatar keheliya avatar kuranes avatar nehon avatar pierreant-p avatar rtortajada avatar sbouafif avatar stephomi avatar sylvinus avatar teybeo avatar utopiad avatar zqsd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osgjs's Issues

FrustumCulling: Multiple Camera

Actual Code has culling tied to the main Camera only and can only work if user set option at starts.*

Camera RTT does not always keep the desired viewport

screen shot 2014-07-05 at 14 07 23

When using Composer, the viewport used is overriden by another viewport from the upper camera.
When we draw here the callStack:

RenderStage.Draw
     - applyCamera
     - applyViewport
     - RenderBin.drawImplementation
               - drawLeafs
                      - leaf.parent.moveStateGraph( state, undefined, leaf.parent.parent )
                      this function apply the graph stateSet from the top node, and if there is a viewport in will be used instead of the one set in the camera.
  • the camera should use a stateset to reference its viewport
  • or some other low level in osgjs use stateSet to reference attribute and it should not
  • the rtt should not apply to the top stateSet

It looks to be something not accurate in stateGraph manipulation, need to make a minimal test case to produces the problem.

Vertex Shader Graph

Current vertex shader Compiler is concat based whereas node system would make it more robust and allow easier flexibility and better decoupling

TextureAttribute: StateAttributeMode override / protect non standard behaviour

If a node inherits from above texture but you want to disable it on your node.
you have to set your Texture object defaultType to true;
Should work but doesn't

myNode.getOrCreateStateSet().setTextureAttributeAndModes( 0, new osg.Texture(), osg.StateAttribute.OFF | osg.StateAttribute.OVERRIDE );

actual Workaround is

var tex = new osg.Texture();
tex.defaultType = true;
myNode.getOrCreateStateSet().setTextureAttributeAndModes( 0, tex, osg.StateAttribute.OFF | osg.StateAttribute.OVERRIDE );

Transparent material does not work

It seems that with the light fixes, transparent materials don't work anymore. Maybe is related to the new Shader system, I haven't had the time to investigate it further.

Build error: failed to create symbolic link ‘build/active’

Hi,

I just did a clone following the installation steps at http://osgjs.org - creating the symbolic link gives me an error because the `build' directory does not exist within the cloned files yet.

Therefore these steps:

git clone git://github.com/cedricpinson/osgjs.git
cd osgjs && ln -s build/dist build/active
npm install -g grunt-cli
npm install
grunt

gives me this on Ubuntu:

ln: failed to create symbolic link ‘build/active’: No such file or directory

Thanks!

Matrix.makeRotate is wrong

Just for information Matrix.makeRotate rotates in the wrong direction (Quat.makeRotate is correct).
(@jtorresfabra)

osg.Matrix.makeRotateFromQuat(osg.Quat.makeRotate(Math.PI/2,1,0,0,[]),[])
>[1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1]
osg.Matrix.makeRotate(Math.PI/2,1,0,0,[])
>[1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1]

can't build JSON plugin, 'osgUtil/ShaderGen' missing

Hello

I'm running openscenegraph with visual studio 2008 and I'd like to convert osg model files to JSON for osg.js.

I got an error compiling OSG, as the include file osgUtil/ShaderGen in ReaderWriterJSON.cpp is missing.

Where can I get it ?

Build Log Rebuild started: Project: Plugins json, Configuration: Release|Win32
Command Lines Creating temporary file "c:\Program Files (x86)\OSG\OpenSceneGraph\src\osgPlugins\json\osgdb_json.dir\Release\BAT0000C245524368.bat" with contents
[
@echo off

"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" "-HC:/Program Files (x86)/OSG/OpenSceneGraph" "-BC:/Program Files (x86)/OSG/OpenSceneGraph" --check-stamp-file "C:\Program Files (x86)\OSG\OpenSceneGraph\src\osgPlugins\json\CMakeFiles\generate.stamp"

if errorlevel 1 goto VCReportError

if errorlevel 1 goto VCReportError

goto VCEnd

:VCReportError

echo Project : error PRJ0019: A tool returned an error code from "Building Custom Rule C:/Program Files (x86)/OSG/OpenSceneGraph/src/osgPlugins/json/CMakeLists.txt"

exit 1

:VCEnd
]
Creating command line """c:\Program Files (x86)\OSG\OpenSceneGraph\src\osgPlugins\json\osgdb_json.dir\Release\BAT0000C245524368.bat"""
Creating temporary file "c:\Program Files (x86)\OSG\OpenSceneGraph\src\osgPlugins\json\osgdb_json.dir\Release\RSP0000C345524368.rsp" with contents
[
/O2 /Ob2 /I "C:\Program Files (x86)\OSG\OpenSceneGraph\include" /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_SCL_SECURE_NO_WARNINGS" /D "_CRT_SECURE_NO_DEPRECATE" /D "OSG_DEBUG_POSTFIX=d" /D "CMAKE_INTDIR="Release"" /D "osgdb_json_EXPORTS" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MD /Fo"osgdb_json.dir\Release" /Fd"C:\Program Files (x86)\OSG\OpenSceneGraph\bin\Release/../osgPlugins-2.8.2/osgdb_json.pdb" /W4 /c /TP /wd4706 /wd4127 /wd4100 /Zm1000

".\JSON_Objects.cpp"

".\ReaderWriterJSON.cpp"
]
Creating command line "cl.exe @"c:\Program Files (x86)\OSG\OpenSceneGraph\src\osgPlugins\json\osgdb_json.dir\Release\RSP0000C345524368.rsp" /nologo /errorReport:prompt"
Output Window Building Custom Rule C:/Program Files (x86)/OSG/OpenSceneGraph/src/osgPlugins/json/CMakeLists.txt
CMake does not need to re-run because C:\Program Files (x86)\OSG\OpenSceneGraph\src\osgPlugins\json\CMakeFiles\generate.stamp is up-to-date.
Compiling...
JSON_Objects.cpp
c:\program files (x86)\osg\openscenegraph\src\osgplugins\json\JSON_Objects(32) : warning C4099: 'JSONArray' : type name first seen using 'class' now seen using 'struct'
c:\program files (x86)\osg\openscenegraph\src\osgplugins\json\JSON_Objects(20) : see declaration of 'JSONArray'
ReaderWriterJSON.cpp
.\ReaderWriterJSON.cpp(11) : fatal error C1083: Cannot open include file: 'osgUtil/ShaderGen': No such file or directory
Generating Code...
Results Build log was saved at "file://c:\Program Files (x86)\OSG\OpenSceneGraph\src\osgPlugins\json\osgdb_json.dir\Release\BuildLog.htm"
Plugins json - 1 error(s), 1 warning(s)

TriangleFunctor

There is not yet a triangle functor. The main problem is that osgjs does not use Vec3Array but only BufferArray to type vertex array. Also this type is used for rendering.
Maybe we should add a typed array like Vec3Array ... and used BufferArray only for rendering stuff.

Examples seems blank

Hi,

in my download i can't see the working example in the examples folder, it seems me a blank, why this is happen to me??

osg.js file in folder /build is missing

In folder /build current version (0.1.0) of osg.js library / file is missing, so the examples don't work. I tried to include all files from /build/includes.js file, the scene worked but everything was black.

Can't built osgjs plugin: no member named ‘setForceReIndex’

Hi,
I am using osgjs plugin 3.1.0 and osg 3.0.1 according to this entry http://osgjs.org/2011/02/working-with-openscenegraph/
cmake . && make

OpenSceneGraph-3.0.1/src/osgPlugins/osgjs/GeometryOperation.cpp: In member function ‘osg::Geometry* GeometryIndexSplitVisitor::doSplit(osg::Geometry&, unsigned int)’:
OpenSceneGraph-3.0.1/src/osgPlugins/osgjs/GeometryOperation.cpp:598:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
OpenSceneGraph-3.0.1/src/osgPlugins/osgjs/GeometryOperation.cpp: In member function ‘virtual void OpenGLESGeometryOptimizerVisitor::apply(osg::Geode&)’:
OpenSceneGraph-3.0.1/src/osgPlugins/osgjs/GeometryOperation.cpp:877:25: error: ‘class osgUtil::IndexMeshVisitor’ has no member named ‘setForceReIndex’
make[2]: *** [src/osgPlugins/osgjs/CMakeFiles/osgdb_osgjs.dir/GeometryOperation.o] Error 1
make[1]: *** [src/osgPlugins/osgjs/CMakeFiles/osgdb_osgjs.dir/all] Error 2
make: *** [all] Error 2

Thanks for help

build issues: osgjs converter

We built the converter with osg version 3.1.0 (obtained from repository (rev 12847)).

The converter does not give errors (apart from missing textures) but the resulting files are not rendered at all when included in a html file with a loader and showwebgl.com gives a processing error.
Did we build the plugin with the correct osg - version?
We think our loader works fine, because we can load other osgjs files.

We believe that the generated osgjs files might be corrupt. Has anyone successfully built the osgjs converter and converted osg files?

Texture::setType and Texture::getType are not working on same data

Texture::setType set intenalformat Type for webgl texture computational type (ubyte, float, etc)
Texture::getType returns attribute type osg utility info rtti c++ equivalent

We need
Texture::setintenatFormatType
Texture::getintenalFormatType
// perhaps even add a commented
// Texture::setType beware thingy

Frustum culling issue

When we zoom out a lot, the model disappears completely and it's impossible to display it back.
The issue occurs on alsmot every examples (e.g: pageLod, picking, pockerscene,..)

GL object tagging "to release"

When without the "state" (outside of draw) it's not possible to release GL Objects as we don't have gl context.
But we can tag the GL ressource "toRelease", and its ressource manager will handle that release asynchronously.

Picking example does not show text

It seems there is a missing div (id= picking) in index.html, but adding it does not seem to resolve the issue. It occurs also in the version of the osgjs.org website.

Web app broken since using older version of osgjs in osgViewer.Viewer, and more

I'm trying to fix a web app that uses an older version of osgjs. It uses version
osg-debug-0.0.5.js

I've found a few (potential) bugs in osg-debug-0.0.7 that look like they may have just been forgotten, but correct me if I'm wrong.

    1. In getTrans, line 511, missing is:

    if(result === undefined){ result = []; }

    1. In makeRotateFromQuat, line 1442, missing is:

    if(result === undefined){ result = []; }

    1. In osg.Quat.init, line 3893, missing is:

    if(element === undefined){ element= []; }

These are sections that resulted in broken code and app crashing upon updating to osg-debug-0.0.7. If those were meant to be removed because result and element should not be undefined, please let me know because in this web app, they are, and adding those lines causes it to move past the error (with no further errors regarding those elements, yet)

Finally, I am having an issue because this web app uses old code when trying to create an osgViewer.Viewer

In the old code, osgViewer.Viewer had a property called osgViewer.Viewer.view

The code looked like this:

osgViewer.Viewer.prototype = { getScene: function() { return this.scene; }, setScene: function(scene) { this.root.removeChildren(); this.root.addChild( scene ); this.scene = scene; }, init: function() { this._done = false; this.root = new osg.Node(); this.state = new osg.State(); this.view = new osg.View(); this.view.addChild(this.root);

The web app references osgViewer.Viewer.view in several places, but in the newer version 0.0.7, that property no longer exists. What replaced this, and what should I do to change my code regarding that missing property?

Any help is greatly appreciated! Thanks!

Build failing in Windows with symlinks

I'm having this error when building in Win with a fresh clone:

Running "symlink:Hammer" (symlink) task

Error: EPERM, operation not permitted 'Hammer-1.0.5.js'
Warning: Failed to create symlink: (file) examples/vendors/Hammer.js -> Hammer-1.0.5.js. Use --force to continue.
Aborted due to warnings.

[GC] Generalize Stacks for all Visitors

Whenever a visitor traverse a graph repeatedly, it will need a stack of matrix,mask or any value that cannot be attached to node (as they can have multiple parent and therefore multiple value) and you don't want to pollute anyway.
So as stack is, array + currentIndex + realLength, ought to make it a convenient reusable class with generalizeable usage

(search for "Stack.length - 1 ]" in code for all those cases in osgjs case)

Mobile support

IMO OSGjs could be an excellent framework for mobile 3D. With webgl support arriving on mobile (iAds, Firefox, SE Xperias) it seems like a good time to start targeting these platforms.

Singleton and gl object not handled correctly

Singleton and gl object does not handle to instantiate multiple viewer on the same page. The idea is to attach singletong / gl object to the viewer

  • Options should not be singleton in case we instantiate different viewer
  • ShaderGeneratorProxy should not be a singleton too for the same reason
  • TextureManager needs also to be linked to State
  • GUI performance needs also to be instanciate by viewer ( html id issue )

One way could be to add State as parameters and map uniforms in osg.State

Materials not applied to Lines

It seems that materials are not applied to Line primitiveSets. Some time ago it used to work ok. So it's something 'new'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.