26

(7 replies, posted in Scripting)

Maybe the functions are not in the right place. Just to be sure:

- all the code above must be put outside of onSceneUpdate()
- inside onSceneUpdate() call the Animate(obj) function

27

(7 replies, posted in Scripting)

This should do the trick :

walk_animation = 0
transition_animation = 1
idle_animation = 2
speed = .3
btn = "W"

function Walk(obj)
    changeAnimation(obj,walk_animation)
end

function Transition(obj)
    changeAnimation(obj,transition_animation)
    if isAnimationOver(obj) then
        transitioning = false
    end
end

function BeIdle(obj)
    changeAnimation(obj,idle_animation)
end

function Animate(obj)
    if isKeyPressed(btn) then
        Walk(obj)
        setAnimationSpeed(obj,speed)
        walking =true
        transitioning = true -- get ready for transition
    end
    
    if onKeyUp(btn) then
        if transitioning then Transition(obj)
        else BeIdle(obj) end
    end
end

28

(7 replies, posted in Scripting)

Currently your animation 2 is only played 1 frame (just after animation 1 is over), then on the next scene update you loop back to animation 1 because onKeyUp condition is satisfied.

You could do something like :

if isAnimationOver(anim_object) then anim3=true end

and add:

elseif anim3 then
        changeAnimation(anim_object,2)
        setAnimationSpeed(anim_object,.3)
end

Image format matters either.

For example, the torch in Jules demo is a png file (with alpha transparency).

If we convert into jpg (for filesize matters for example) and tweak the Blendmode, the black background becomes transparent, although jpg format doesn't handle transparency.

And don't forget to set the appropriate Maratis BlendMode (just below material Transparency)

31

(56 replies, posted in Editor)

The 3 additional external scripts (freeimage, freetype & glfw) are not modified (as they require no linking). They are located in the 'Projects' folder.

So you can test now without hesitation !

32

(56 replies, posted in Editor)

We are all learning a lot in this community ! big_smile

33

(56 replies, posted in Editor)

A few tests:

LINUX
- build using make & GCC 4.6.3 tongue
- build using Code::Blocks 12.11 & GCC 4.6.3 tongue

- binaries on Ubuntu Precise: tongue
- binaries on Slackware 14: tongue

WINDOWS
- build using vs2010 : cf above sad
- build using minGW : cf above sad

34

(56 replies, posted in Editor)

And here is the latest version (I'll submit it in the tracker soon as Windows test will be complete):

-----------------------------------------------------------------------------------------------------------------------------
-- Test premake build
-----------------------------------------------------------------------------------------------------------------------------

rootDir = "../../"
sourcesDir = rootDir .. "Sources/"
thirdPartyDir = rootDir .. "3rdparty/"

-- Get arguments passed to the command line
for i=1, #_ARGS do
    if _ARGS[i] == "cygwin" then cygwin = true print("*****  BUILD USING CYGWIN  *****") end
    if _ARGS[i] == "minGW" then minGW = true print("*****  BUILD USING MINGW  *****") end
end


solution "Test"

    configurations { "Debug", "Release" }
    platforms { "x32", "x64" }

    if os.is("windows") then
        defines { "_WIN32", "WIN32" }
        if minGW then defines { "__MINGW32__" } end
        if cygwin then defines { "__CYGWIN__" } end
    elseif os.is("macosx") then defines { "__APPLE__", "MACOSX" }
    elseif os.is("linux") then defines { "LINUX", "linux" }
    end

-- INCLUDES
    includedirs { 
        thirdPartyDir .. "tinycthread/source",
        thirdPartyDir .. "glee",
        thirdPartyDir .. "glfw/include",
        thirdPartyDir .. "freeimage/Source",
        thirdPartyDir .. "freetype/include",
        thirdPartyDir .. "tinyutf8",
        sourcesDir .. "MSDK/MCore/Includes",
        sourcesDir .. "MSDK/MEngine/Includes",
        sourcesDir .. "MSDK/MGui/Includes",
        sourcesDir .. "Common"
    }

    if os.is("windows") then
        includedirs { thirdPartyDir .. "windirent/include" }
    end

    configuration "Debug"
        defines { "DEBUG" }
        flags { "Symbols" }

    configuration "Release"
        defines { "NDEBUG" }
        flags { "Optimize" }


    -- freeimage
    include ( rootDir .. "Projects/3rdparty/freeimage" )

    -- freetype
    include ( rootDir .. "Projects/3rdparty/freetype" )

    -- tinycthread
    project "tinycthread"
        kind "StaticLib"
        language "C++"
        files { thirdPartyDir .. "tinycthread/**.h", 
                thirdPartyDir .. "tinycthread/**.c" }

    -- Glee
    project "glee"
        kind "StaticLib"
        language "C++"
        files { thirdPartyDir .. "glee/**.h", 
                thirdPartyDir .. "glee/**.c" }
                
    -- glfw
    include ( rootDir .. "Projects/3rdparty/glfw" )

    -- MCore
    project "mcore"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MCore/**" }
        defines { "MCORE_STATIC" }


    -- MEngine
    project "mengine"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MEngine/**" }
        defines { "MENGINE_STATIC" }
    --    links { "mcore" } -- for SharedLib only


    -- MGui
    project "mgui"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "MSDK/MGui/**" }
        defines { "MGUI_STATIC" }
    --    links { "mengine", "mcore" } -- for SharedLib only


    -- MCommon
    project "mcommon"
        kind "StaticLib"
        language "C++"
        files { sourcesDir .. "Common/Contexts/GL/**" }
        files { sourcesDir .. "Common/Loaders/FreeImage/**" }
        files { sourcesDir .. "Common/Loaders/Freetype/**" }
        files { sourcesDir .. "Common/Renderers/**" }
        files { sourcesDir .. "Common/GUI/**" }
        --links { "mgui", "mengine", "mcore", "glfw", "glee", "freeimage", "freetype", "tinycthread" } -- for SharedLib only


    -- Test
    project "Test"
        kind "ConsoleApp"
        language "C++"

        files { "*.cpp" }
        links {
            "mcommon", "mgui", "mengine", "mcore", 
            "glfw", "glee", "freeimage", "freetype", "tinycthread"
        }

        if os.is("macosx") then
            links {
                "Cocoa.framework", "OpenGL.framework", "CoreServices.framework",
                "Foundation.framework", "IOKit.framework"
            }

        elseif os.is("windows") then
            links { "Opengl32", "Winmm" }

        elseif os.is("linux") then
            links { "X11", "Xxf86vm", "Xrandr", "Xi", "GL", "dl", "pthread", "rt" }
            linkoptions { "-Wl,-rpath=." }
        end

35

(56 replies, posted in Editor)

Yes Zester,

I've pushed a linux fix to the premake template for experimental branch in the issue tracker.
See issue #20 here, you can download the file. big_smile

36

(56 replies, posted in Editor)

With visual studio, these errors remain:

freeimage:
c:\...\branches\experimental\3rdparty\freeimage\source\zlib\zconf.h(447): fatal error C1083: Impossible d'ouvrir le fichier include : 'unistd.h' : No such file or directory

Windows complains not finding a POSIX header!
MinGW has its own version of this header, that's why I didn't get this error previously.

mcommon:
..\..\Sources\Common\Loaders\FreeImage\MFreeImageLoader.cpp(81): error C2440: '=' : impossible de convertir de 'unsigned int (__cdecl *)(void *,unsigned int,unsigned int,fi_handle)' en 'FI_ReadProc'
          Cette conversion requiert reinterpret_cast, un cast de style C ou un cast de style fonction

Test:
I have to include <windows.h> to resolve sleep issue

37

(4 replies, posted in Editor)

anael wrote:

try this blender exporter update : http://www.maratis3d.org/download/blend … 66(v2).zip

someone noticed a code issue and published it in the bug tracker.

Seems this is a happy synchronicity big_smile

38

(56 replies, posted in Editor)

Anaël,

Scons is passing 'sse2' to the compiler for all platforms.
Should we incorporate this either in the premake template?

39

(56 replies, posted in Editor)

Perfect ! All casting errors have been blasted. big_smile

NB: tested with minGW.

40

(56 replies, posted in Editor)

Thanks for references.

The casting issues are only relevant to Windows, they don't occur with POSIX.
Waiting for Anaël directives.

41

(56 replies, posted in Editor)

Many thanks 255, big_smile

Passing '-fpermissive' to minGW "resolves" the casting errors.
Didn't noticed it but this fix was suggested by minGW at the end of each error report. This is a very cool feature.

Can we pass warnings settings to vs2010 projects so that we can fix the premake template for visual studio ?

42

(56 replies, posted in Editor)

Tried with minGW:

glfw:
For building GLFW we need to upgrade to latest version (3.0.3).

freeimage:
no error

mcommon:
..\..\Sources\Common\Loaders\FreeImage\MFreeImageLoader.cpp(81): error C2440: '=' : impossible de convertir de 'unsigned int (__cdecl *)(void *,unsigned int,unsigned int,fi_handle)' en 'FI_ReadProc'
          Cette conversion requiert reinterpret_cast, un cast de style C ou un cast de style fonction

Test:
I have to include <windows.h> to resolve sleep issue

43

(9 replies, posted in Scripting)

If you don't put it in the if statement, the rayHit will be performed at every sceneUpdate (60 times per second!).
If you put it inside, it will be performed only when you click.

It depends on your needs: do you need to perform it all the time or at demand? The choice is yours. big_smile

44

(1 replies, posted in Scripting)

"point" returns the 3D coordinates of the location where the collision happen between the ray and an object with physics..
If you want to use it as a boolean, just check "if point then ..."

"object" returns the actual object hit by the ray, so yes it detects the specific object being hit.
You can get the position of this object using "if object then getPosition(object) end".
You can get its name using getName(object) function.

NB: object is returned even if you didn't declare it previously with the getObject() function.

45

(13 replies, posted in General)

I'm using Firefox and sometimes IE, both cause trouble.

46

(1 replies, posted in Plugins)

LINUX
- build using make & GCC 4.6.3 tongue
- build using Code::Blocks 12.11 & GCC 4.6.3 tongue

- tested on Ubuntu Precise tongue
- tested on Slackware 14 tongue


WINDOWS
- build using vs2010 tongue
- build using minGW tongue (requires building Maratis with minGW)

- vs2010 build tested using Wine tongue
- minGW build test using Wine tongue (requires a minGW build of Maratis)


IMPORTANT
- plugin & Maratis must be built using the same compiler/linker.
- for linux users, don't forget to rename your generated plugin as 'Game.so' (instead of 'libGame.so').
- for Windows users, please note that when using absolute path you can't build in debug mode (obviously a bug in Premake4 that strips the path).

TODO: cygwin tests soon as assimp for cygwin gets fixed

47

(1 replies, posted in Plugins)

-----------------------------------------------------------------------------------------------------------------------------
-- Maratis plugin premake template
-----------------------------------------------------------------------------------------------------------------------------

    -- Setup the path to MSDK
    msdk = "MSDK/"

    -- Setup the name of your plugin's folder
    sources_folder = "PluginSources"

-- Setup the solution
solution "Game"

    configurations { "Debug", "Release" }
    platforms { "x32", "x64" }

    if os.is("windows") then defines { "_WIN32", "WIN32" }
    elseif os.is("macosx") then defines { "__APPLE__", "MACOSX" }
    elseif os.is("linux") then defines { "LINUX", "linux" } end

    configuration "Debug"
        defines { "DEBUG" }
        flags { "Symbols" }

    configuration "Release"
        defines { "NDEBUG" }
        flags { "OptimizeSpeed" }

    -- Includes directories
    includedirs { msdk .. "MCore/Includes", msdk .. "MEngine/Includes" }

    -- External libraries
    if os.is("windows") then libdirs { sources_folder } end -- set path to MCore & MEngine (dll for minGW, lib for visual studio)

    -- Build plugin from sources ~ NB: do not rename it here, but strip "lib" from "libGame.so"
    project "Game"
        kind "SharedLib"
        language "C++"
        files { sources_folder .. "/**" }
        if os.is("windows") then links { "MEngine", "MCore" } end

NB: you must edit this script to match the location of Maratis SDK libs and of your plugin sources.
This script must be saved as 'premake4.lua' in your project folder.

48

(56 replies, posted in Editor)

Thanks for your help 255.

Yes, we are talking of the experimental branch.

I'm totally noob with visual studio and I changed nothing to "factory" settings.
I'm doing "Generate solution" in release32 mode on Windows XP. Is it OK ?
I'll try to alter the settings as you recommended.

By the way, did you upgrade to latest revision ?

49

(56 replies, posted in Editor)

Here are the errors that I get when buiding with vs2010:

Freeimage:
c:\...\branches\experimental\3rdparty\freeimage\source\zlib\zconf.h(447): fatal error C1083: Impossible d'ouvrir le fichier include : 'unistd.h' : No such file or directory

Test
main.cpp(161): error C3861: 'Sleep' : identificateur introuvable

Hey Zester,

Did you check the Proton SDK ?