Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-11-01 00:06:48 +0300
committerBenoit Bolsee <benoit.bolsee@online.be>2008-11-01 00:06:48 +0300
commit77b4c66cc3de461fdd0074e46a3a77de1fd83447 (patch)
treea88c94c61ef781b39770d7dd761e97fb7c2614de
parent858581369342466b557019b5530d4c0e389fe707 (diff)
Preparation to VideoTexture: everything but the VideoTexture module itself.
Rename PHY_GetActiveScene() to KX_GetActiveScene(): more logical name Add KX_GetActiveEngine() new KX_KetsjiEngine::GetClockTime(void) to return current render frame time: if the CPU does not keep up with the frame rate, up to 5 consecutive logic frames are processed between each render frame, so that the logic system stays accurate even if the graphic system is slow. For the video texture module, it is important to stay in sync with the render frame: no need to update the texture for logic frame. BL_Texture::swapTexture(): texture id manipulation BL_Texture::getTex() : return material texture Enable video support in ffmpeg for Linux.
-rw-r--r--projectfiles_vc7/blender/blender.vcproj2
-rw-r--r--source/blender/imbuf/intern/util.c2
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp1
-rw-r--r--source/gameengine/Ketsji/BL_Texture.h8
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.h3
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp9
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.h5
-rw-r--r--source/gameengine/Ketsji/KX_ParentActuator.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp9
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.h9
12 files changed, 47 insertions, 13 deletions
diff --git a/projectfiles_vc7/blender/blender.vcproj b/projectfiles_vc7/blender/blender.vcproj
index 26cb3fb79e1..ef6900b7b75 100644
--- a/projectfiles_vc7/blender/blender.vcproj
+++ b/projectfiles_vc7/blender/blender.vcproj
@@ -124,7 +124,7 @@ ECHO Done
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386
"
- AdditionalDependencies="SDL.lib freetype2ST.lib ftgl_static.lib gnu_gettext.lib qtmlClient.lib openal_static.lib libsoundsystem.lib libopenalsoundsystem.lib libdummysoundsystem.lib libguardedalloc.lib libbsp.lib libbmfont.lib libghost.lib libstring.lib ws2_32.lib dxguid.lib opengl32.lib libjpeg.lib glu32.lib vfw32.lib winmm.lib libdecimation.lib libiksolver.lib libpng_st.lib zlib.lib libmoto.lib solid.lib qhull.lib libopennl.lib Bullet.lib python25_d.lib libelbeem.lib libboolop.lib pthreadVSE2.lib pthreadVC2.lib libtiff.lib broad.lib complex.lib convex.lib memutil.lib verse.lib Half.lib Iex.lib Imath.lib IlmImf.lib IlmThread.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib glew.lib"
+ AdditionalDependencies="SDL.lib freetype2ST.lib ftgl_static.lib gnu_gettext.lib qtmlClient.lib openal_static.lib libsoundsystem.lib libopenalsoundsystem.lib libdummysoundsystem.lib libguardedalloc.lib libbsp.lib libbmfont.lib libghost.lib libstring.lib ws2_32.lib dxguid.lib opengl32.lib libjpeg.lib glu32.lib vfw32.lib winmm.lib libdecimation.lib libiksolver.lib libpng_st.lib zlib.lib libmoto.lib solid.lib qhull.lib libopennl.lib Bullet.lib python25_d.lib libelbeem.lib libboolop.lib pthreadVSE2.lib pthreadVC2.lib libtiff.lib broad.lib complex.lib convex.lib memutil.lib verse.lib Half.lib Iex.lib Imath.lib IlmImf.lib IlmThread.lib avcodec-51.lib avformat-52.lib avdevice-52.lib avutil-49.lib swscale-0.lib glew.lib"
ShowProgress="0"
OutputFile="..\..\bin\debug\blender.exe"
LinkIncremental="2"
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index 4f6730db1f1..70a02d72b01 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -64,6 +64,7 @@
#ifdef WITH_FFMPEG
#include <ffmpeg/avcodec.h>
#include <ffmpeg/avformat.h>
+#include <ffmpeg/avdevice.h>
#if LIBAVFORMAT_VERSION_INT < (49 << 16)
#define FFMPEG_OLD_FRAME_RATE 1
@@ -236,6 +237,7 @@ void do_init_ffmpeg()
if (!ffmpeg_init) {
ffmpeg_init = 1;
av_register_all();
+ avdevice_register_all();
}
}
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 9fbdc3fa1c9..2b3ef1b31e3 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -364,6 +364,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
initGameKeys();
initPythonConstraintBinding();
initMathutils();
+ //initVideoTexture();
if (sceneconverter)
{
diff --git a/source/gameengine/Ketsji/BL_Texture.h b/source/gameengine/Ketsji/BL_Texture.h
index 0d0c7a277f2..830ffceb0f7 100644
--- a/source/gameengine/Ketsji/BL_Texture.h
+++ b/source/gameengine/Ketsji/BL_Texture.h
@@ -59,6 +59,14 @@ public:
void SetMapping(int mode);
void DisableUnit();
void setTexEnv(BL_Material *mat, bool modulate=false);
+ unsigned int swapTexture (unsigned int newTex) {
+ // swap texture codes
+ unsigned int tmp = mTexture;
+ mTexture = newTex;
+ // return original texture code
+ return tmp;
+ }
+
};
#endif//__BL_TEXTURE_H__
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index 4ddf5a924df..b858fa3754c 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -67,6 +67,9 @@ public:
MTFace* GetMTFace(void) const;
unsigned int* GetMCol(void) const;
+ BL_Texture * getTex (unsigned int idx) {
+ return (idx < MAXTEX) ? mTextures + idx : NULL;
+ }
// for ipos
void UpdateIPO(
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 3830d422138..53b3e348a36 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -793,7 +793,7 @@ KX_PYMETHODDEF_DOC(KX_Camera, setOnTop,
{
class KX_Scene* scene;
- scene = PHY_GetActiveScene();
+ scene = KX_GetActiveScene();
MT_assert(scene);
scene->SetCameraOnTop(this);
Py_Return;
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 739c122a5ef..a168beb9a70 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1027,7 +1027,7 @@ bool KX_GameObject::ConvertPythonVectorArgs(PyObject* args,
PyObject* KX_GameObject::PyReplaceMesh(PyObject* self, PyObject* value)
{
- KX_Scene *scene = PHY_GetActiveScene();
+ KX_Scene *scene = KX_GetActiveScene();
char* meshname;
void* mesh_pt;
@@ -1050,7 +1050,7 @@ PyObject* KX_GameObject::PyReplaceMesh(PyObject* self, PyObject* value)
PyObject* KX_GameObject::PyEndObject(PyObject* self)
{
- KX_Scene *scene = PHY_GetActiveScene();
+ KX_Scene *scene = KX_GetActiveScene();
scene->DelayedRemoveObject(this);
Py_RETURN_NONE;
@@ -1447,7 +1447,7 @@ PyObject* KX_GameObject::PySetParent(PyObject* self, PyObject* value)
// The object we want to set as parent
CValue *m_ob = (CValue*)value;
KX_GameObject *obj = ((KX_GameObject*)m_ob);
- KX_Scene *scene = PHY_GetActiveScene();
+ KX_Scene *scene = KX_GetActiveScene();
this->SetParent(scene, obj);
@@ -1456,7 +1456,7 @@ PyObject* KX_GameObject::PySetParent(PyObject* self, PyObject* value)
PyObject* KX_GameObject::PyRemoveParent(PyObject* self)
{
- KX_Scene *scene = PHY_GetActiveScene();
+ KX_Scene *scene = KX_GetActiveScene();
this->RemoveParent(scene);
Py_RETURN_NONE;
}
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index b1ab8e3e7de..8bcda4479e1 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -470,7 +470,7 @@ else
m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true);
// set Python hooks for each scene
PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment());
- PHY_SetActiveScene(scene);
+ KX_SetActiveScene(scene);
scene->GetPhysicsEnvironment()->endFrame();
@@ -568,7 +568,7 @@ else
// set Python hooks for each scene
PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment());
- PHY_SetActiveScene(scene);
+ KX_SetActiveScene(scene);
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
scene->UpdateParents(m_clockTime);
@@ -1540,6 +1540,11 @@ double KX_KetsjiEngine::GetAnimFrameRate()
return m_anim_framerate;
}
+double KX_KetsjiEngine::GetClockTime(void) const
+{
+ return m_clockTime;
+}
+
void KX_KetsjiEngine::SetAnimFrameRate(double framerate)
{
m_anim_framerate = framerate;
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index 1aa067a9962..4184202c518 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -254,6 +254,11 @@ public:
bool GetUseFixedTime(void) const;
/**
+ * Returns current render frame clock time
+ */
+ double GetClockTime(void) const;
+
+ /**
* Returns the difference between the local time of the scene (when it
* was running and not suspended) and the "curtime"
*/
diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp
index eb56e8de679..89549ca6b57 100644
--- a/source/gameengine/Ketsji/KX_ParentActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ParentActuator.cpp
@@ -119,7 +119,7 @@ bool KX_ParentActuator::Update()
return false; // do nothing on negative events
KX_GameObject *obj = (KX_GameObject*) GetParent();
- KX_Scene *scene = PHY_GetActiveScene();
+ KX_Scene *scene = KX_GetActiveScene();
switch (m_mode) {
case KX_PARENT_SET:
if (m_ob)
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index a30d9f4022d..0032d83c2ff 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1461,16 +1461,21 @@ PyObject* initMathutils()
return Mathutils_Init("Mathutils"); // Use as a top level module in BGE
}
-void PHY_SetActiveScene(class KX_Scene* scene)
+void KX_SetActiveScene(class KX_Scene* scene)
{
gp_KetsjiScene = scene;
}
-class KX_Scene* PHY_GetActiveScene()
+class KX_Scene* KX_GetActiveScene()
{
return gp_KetsjiScene;
}
+class KX_KetsjiEngine* KX_GetActiveEngine()
+{
+ return gp_KetsjiEngine;
+}
+
// utility function for loading and saving the globalDict
int saveGamePythonConfig( char **marshal_buffer)
{
diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h
index 36e3db6ec35..57ee0be9400 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.h
+++ b/source/gameengine/Ketsji/KX_PythonInit.h
@@ -45,6 +45,7 @@ PyObject* initGameKeys();
PyObject* initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* canvas);
PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level);
PyObject* initMathutils();
+PyObject* initVideoTexture(void);
void exitGamePlayerPythonScripting();
PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level);
void exitGamePythonScripting();
@@ -54,8 +55,12 @@ void pathGamePythonConfig( char *path );
int saveGamePythonConfig( char **marshal_buffer);
int loadGamePythonConfig(char *marshal_buffer, int marshal_length);
-void PHY_SetActiveScene(class KX_Scene* scene);
-class KX_Scene* PHY_GetActiveScene();
+class KX_KetsjiEngine;
+class KX_Scene;
+
+void KX_SetActiveScene(class KX_Scene* scene);
+class KX_Scene* KX_GetActiveScene();
+class KX_KetsjiEngine* KX_GetActiveEngine();
#include "MT_Vector3.h"
void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color);