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
path: root/source
diff options
context:
space:
mode:
authorDiego Borghetti <bdiego@gmail.com>2008-06-19 00:18:37 +0400
committerDiego Borghetti <bdiego@gmail.com>2008-06-19 00:18:37 +0400
commit2bb628ba4b7e4924cbe2c75c815e29f76c42b913 (patch)
tree1c9c2c609c1a8bfccfd276a8c5957a6f881f8011 /source
parent90bb9885e2188b0807c951c8365744e00d41b74b (diff)
branches/blender-2.47
Merge from trunk: Revision: 15239 Revision: 15240 Revision: 15242 Revision: 15247 Revision: 15256 Revision: 15262
Diffstat (limited to 'source')
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.c45
-rw-r--r--source/blender/src/transform_constraints.c16
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp6
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.cpp7
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h3
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp13
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.h10
-rw-r--r--source/gameengine/Ketsji/KX_RayCast.cpp2
10 files changed, 99 insertions, 17 deletions
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index a81e632a797..500c09ba265 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -441,10 +441,15 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) {
default: break;
}
}
- dpx->bitsPerPixel = 10;
- /* dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel; */
- dpx->imageOffset = ntohl(header.fileInfo.offset);
+ /* dpx->bitsPerPixel = 10; */
+ dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel;
+ if (dpx->bitsPerPixel != 10) {
+ if (verbose) d_printf("Don't support depth: %d\n", dpx->bitsPerPixel);
+ dpxClose(dpx);
+ return 0;
+ }
+ dpx->imageOffset = ntohl(header.fileInfo.offset);
dpx->lineBufferLength = pixelsToLongs(dpx->width * dpx->depth);
dpx->lineBuffer = malloc(dpx->lineBufferLength * 4);
if (dpx->lineBuffer == 0) {
@@ -471,6 +476,26 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) {
dpx->fileYPos = 0;
logImageGetByteConversionDefaults(&dpx->params);
+ /* The SMPTE define this code:
+ * 2 - Linear
+ * 3 - Logarithmic
+ *
+ * Note that transfer_characteristics is U8, don't need
+ * check the byte order.
+ */
+ switch (header.imageInfo.channel[0].transfer_characteristics) {
+ case 2:
+ dpx->params.doLogarithm= 0;
+ break;
+ case 3:
+ dpx->params.doLogarithm= 1;
+ break;
+ default:
+ if (verbose) d_printf("Un-supported Transfer Characteristics: %d\n", header.imageInfo.channel[0].transfer_characteristics);
+ dpxClose(dpx);
+ return 0;
+ break;
+ }
setupLut(dpx);
dpx->getRow = &dpxGetRowBytes;
@@ -563,6 +588,18 @@ dpxCreate(const char* filename, int width, int height, int depth) {
++shortFilename;
}
initDpxMainHeader(dpx, &header, shortFilename);
+ logImageGetByteConversionDefaults(&dpx->params);
+ /* Need set the file type before write the header!
+ * 2 - Linear
+ * 3 - Logarithmic
+ *
+ * Note that transfer characteristics is U8, don't need
+ * check the byte order.
+ */
+ if (dpx->params.doLogarithm == 0)
+ header.imageInfo.channel[0].transfer_characteristics= 2;
+ else
+ header.imageInfo.channel[0].transfer_characteristics= 3;
if (fwrite(&header, sizeof(header), 1, dpx->file) == 0) {
if (verbose) d_printf("Couldn't write image header\n");
@@ -570,8 +607,6 @@ dpxCreate(const char* filename, int width, int height, int depth) {
return 0;
}
dpx->fileYPos = 0;
-
- logImageGetByteConversionDefaults(&dpx->params);
setupLut(dpx);
dpx->getRow = 0;
diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c
index 769ebd2ea97..2d01c2303fc 100644
--- a/source/blender/src/transform_constraints.c
+++ b/source/blender/src/transform_constraints.c
@@ -550,6 +550,10 @@ void setUserConstraint(TransInfo *t, int mode, const char ftext[]) {
void BIF_setLocalLockConstraint(char axis, char *text) {
TransInfo *t = BIF_GetTransInfo();
+ if (t->total == 0) {
+ return;
+ }
+
switch (axis) {
case 'x':
setLocalConstraint(t, (CON_AXIS1|CON_AXIS2), text);
@@ -566,6 +570,10 @@ void BIF_setLocalLockConstraint(char axis, char *text) {
void BIF_setLocalAxisConstraint(char axis, char *text) {
TransInfo *t = BIF_GetTransInfo();
+ if (t->total == 0) {
+ return;
+ }
+
switch (axis) {
case 'X':
setLocalConstraint(t, CON_AXIS0, text);
@@ -584,6 +592,10 @@ void BIF_setSingleAxisConstraint(float vec[3], char *text) {
TransInfo *t = BIF_GetTransInfo();
float space[3][3], v[3];
+ if (t->total == 0) {
+ return;
+ }
+
VECCOPY(space[0], vec);
v[0] = vec[2];
@@ -622,6 +634,10 @@ void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text) {
TransInfo *t = BIF_GetTransInfo();
float space[3][3];
+ if (t->total == 0) {
+ return;
+ }
+
VECCOPY(space[0], vec1);
VECCOPY(space[1], vec2);
Crossf(space[2], space[0], space[1]);
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index fa8409b123e..eb575c70ad7 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -372,6 +372,12 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
// start the engine
ketsjiengine->StartEngine(true);
+
+ // Set the animation playback rate for ipo's and actions
+ // the framerate below should patch with FPS macro defined in blendef.h
+ // Could be in StartEngine set the framerate, we need the scene to do this
+ ketsjiengine->SetAnimFrameRate( (((double) blscene->r.frs_sec) / blscene->r.frs_sec_base) );
+
// the mainloop
while (!exitrequested)
{
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
index 7c9dbcdaab2..2a5cc14018f 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
@@ -133,7 +133,12 @@ void BL_RenderText(int mode,const char* textstr,int textlen,struct MTFace* tface
characters = 0;
}
- if(!col) glColor3f(1.0f, 1.0f, 1.0f);
+ /* When OBCOL flag is on the color is set in IndexPrimitives_3DText */
+ if (tface->mode & TF_OBCOL) { /* Color has been set */
+ col= NULL;
+ } else {
+ if(!col) glColor3f(1.0f, 1.0f, 1.0f);
+ }
glPushMatrix();
for (index = 0; index < characters; index++) {
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index 1055c8771ef..ad126ebf123 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -134,14 +134,14 @@ void BL_ActionActuator::SetStartTime(float curtime)
float direction = m_startframe < m_endframe ? 1.0 : -1.0;
if (!(m_flag & ACT_FLAG_REVERSE))
- m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_FIXED_FRAME_PER_SEC;
+ m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate();
else
- m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_FIXED_FRAME_PER_SEC;
+ m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate();
}
void BL_ActionActuator::SetLocalTime(float curtime)
{
- float delta_time = (curtime - m_starttime)*KX_FIXED_FRAME_PER_SEC;
+ float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate();
if (m_endframe < m_startframe)
delta_time = -delta_time;
@@ -385,7 +385,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
blend_poses(m_pose, m_blendpose, 1.0 - newweight, ACTSTRIPMODE_BLEND);
/* Increment current blending percentage */
- m_blendframe = (curtime - m_blendstart)*KX_FIXED_FRAME_PER_SEC;
+ m_blendframe = (curtime - m_blendstart)*KX_KetsjiEngine::GetAnimFrameRate();
if (m_blendframe>m_blendin)
m_blendframe = m_blendin;
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 5dae59d1d63..57be41c0358 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -45,9 +45,8 @@
#include "GEN_Map.h"
#include "GEN_HashedPtr.h"
#include "KX_Scene.h"
+#include "KX_KetsjiEngine.h" /* for m_anim_framerate */
-#define KX_FIXED_FRAME_PER_SEC 25.0f
-#define KX_FIXED_SEC_PER_FRAME (1.0f / KX_FIXED_FRAME_PER_SEC)
#define KX_OB_DYNAMIC 1
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index 0f9caa456d9..cf246342cf9 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -164,14 +164,14 @@ void KX_IpoActuator::SetStartTime(float curtime)
curtime = curtime - KX_KetsjiEngine::GetSuspendedDelta();
if (m_direction > 0)
- m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_FIXED_FRAME_PER_SEC;
+ m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate();
else
- m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_FIXED_FRAME_PER_SEC;
+ m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate();
}
void KX_IpoActuator::SetLocalTime(float curtime)
{
- float delta_time = ((curtime - m_starttime) - KX_KetsjiEngine::GetSuspendedDelta())*KX_FIXED_FRAME_PER_SEC;
+ float delta_time = ((curtime - m_starttime) - KX_KetsjiEngine::GetSuspendedDelta())*KX_KetsjiEngine::GetAnimFrameRate();
// negative delta_time is caused by floating point inaccuracy
// perhaps the inaccuracy could be reduced a bit
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 1e3393d59a8..56a06786679 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -71,6 +71,7 @@
#include "KX_TimeCategoryLogger.h"
#include "RAS_FramingManager.h"
+#include "stdio.h"
// If define: little test for Nzc: guarded drawing. If the canvas is
// not valid, skip rendering this frame.
@@ -91,7 +92,7 @@ const char KX_KetsjiEngine::m_profileLabels[tc_numCategories][15] = {
};
double KX_KetsjiEngine::m_ticrate = DEFAULT_LOGIC_TIC_RATE;
-
+double KX_KetsjiEngine::m_anim_framerate = 25.0;
double KX_KetsjiEngine::m_suspendedtime = 0.0;
double KX_KetsjiEngine::m_suspendeddelta = 0.0;
@@ -1383,6 +1384,16 @@ void KX_KetsjiEngine::SetTicRate(double ticrate)
m_ticrate = ticrate;
}
+double KX_KetsjiEngine::GetAnimFrameRate()
+{
+ return m_anim_framerate;
+}
+
+void KX_KetsjiEngine::SetAnimFrameRate(double framerate)
+{
+ m_anim_framerate = framerate;
+}
+
void KX_KetsjiEngine::SetTimingDisplay(bool frameRate, bool profile, bool properties)
{
m_show_framerate = frameRate;
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index bc2e3864be8..4c09bc3fcd5 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -103,6 +103,7 @@ private:
double m_remainingTime;
static double m_ticrate;
+ static double m_anim_framerate; /* for animation playback only - ipo and action */
static double m_suspendedtime;
static double m_suspendeddelta;
@@ -261,6 +262,15 @@ public:
static void SetTicRate(double ticrate);
/**
+ * Gets the framerate for playing animations. (actions and ipos)
+ */
+ static double GetAnimFrameRate();
+ /**
+ * Sets the framerate for playing animations. (actions and ipos)
+ */
+ static void SetAnimFrameRate(double framerate);
+
+ /**
* Activates or deactivates timing information display.
* @param frameRate Display for frame rate on or off.
* @param profile Display for individual components on or off.
diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp
index b88741625b6..89e2d645d54 100644
--- a/source/gameengine/Ketsji/KX_RayCast.cpp
+++ b/source/gameengine/Ketsji/KX_RayCast.cpp
@@ -49,7 +49,7 @@ bool KX_RayCast::RayTest(KX_IPhysicsController* ignore_controller, PHY_IPhysicsE
//
// returns true if an object was found, false if not.
MT_Point3 frompoint(_frompoint);
- const MT_Vector3 todir( (topoint - frompoint).normalized() );
+ const MT_Vector3 todir( (topoint - frompoint).safe_normalized() );
PHY_IPhysicsController* hit_controller;
PHY__Vector3 phy_pos;