ソースを参照

Several build fix

undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> 11年前
コミット
b5bfa29caf
4個のファイルの変更23行の追加20行の削除
  1. +5
    -2
      src/easymesh/easymesh.cpp
  2. +0
    -0
      test/javascript/empty.html
  3. +17
    -17
      test/meshviewer.cpp
  4. +1
    -1
      test/meshviewer.index.html

+ 5
- 2
src/easymesh/easymesh.cpp ファイルの表示

@@ -134,6 +134,7 @@ void DefaultShaderData::StoreUniformNames()
//-----------------------------------------------------------------------------
void DefaultShaderData::SetupDefaultData(bool with_UV)
{
UNUSED(with_UV);
for (int i = 0; i < m_uniform_names.Count(); i++)
AddUniform(m_uniform_names[i].C());
}
@@ -150,7 +151,6 @@ void DefaultShaderData::SetupShaderDatas(mat4 const &model)
Array<vec4> light_data;
//This is not very nice, but necessary for emscripten WebGL generation.
float f = 0.f;
int i = 0;

/* FIXME: the 4th component of the position can be used for other things */
/* FIXME: GetUniform("blabla") is costly */
@@ -158,6 +158,8 @@ void DefaultShaderData::SetupShaderDatas(mat4 const &model)
light_data << lights[i]->GetPosition() << lights[i]->GetColor();
while (light_data.Count() < 8)
light_data << vec4::zero << vec4::zero;

int i = 0;
m_shader->SetUniform(*GetUniform(m_uniform_names[i++].C()), light_data);

m_shader->SetUniform(*GetUniform(m_uniform_names[i++].C()), modelview);
@@ -2691,7 +2693,8 @@ void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
j, j, j, j, \
j, j, j, j, \
k, j, j, k \
};
}; \
UNUSED(q);
int m[] = { /* The top and bottom faces */
0, 2, 3, 1,
7, 9, 8, 6,


test/empty.html → test/javascript/empty.html ファイルの表示


+ 17
- 17
test/meshviewer.cpp ファイルの表示

@@ -359,7 +359,7 @@ public:
bool is_pos = false;
bool is_fov = false;
bool is_hsc = false;
vec2 tmp = vec2::zero;
vec2 tmpv = vec2::zero;

#if NO_NACL_EM
is_pos = KeyDown(KEY_CAM_POS) || KeyDown(MSE_CAM_POS);
@@ -367,23 +367,23 @@ public:

if (KeyDown(MSE_CAM_ROT) || KeyDown(MSE_CAM_POS) || KeyDown(MSE_CAM_FOV))
{
tmp += vec2(AxisValue(MSEX_CAM_Y), AxisValue(MSEX_CAM_X));
tmpv += vec2(AxisValue(MSEX_CAM_Y), AxisValue(MSEX_CAM_X));
if (KeyDown(MSE_CAM_ROT))
tmp *= 6.f;
tmpv *= 6.f;
if (KeyDown(MSE_CAM_POS))
tmp *= vec2(1.f, -1.f) * 3.f;
tmpv *= vec2(1.f, -1.f) * 3.f;
if (KeyDown(MSE_CAM_FOV))
tmp = vec2(tmp.y * 4.f, tmp.x * 6.f);
tmpv = vec2(tmpv.y * 4.f, tmpv.x * 6.f);
}

tmp += vec2((float)KeyDown(KEY_CAM_UP ) - (float)KeyDown(KEY_CAM_DOWN),
(float)KeyDown(KEY_CAM_RIGHT) - (float)KeyDown(KEY_CAM_LEFT));
tmpv += vec2((float)KeyDown(KEY_CAM_UP ) - (float)KeyDown(KEY_CAM_DOWN),
(float)KeyDown(KEY_CAM_RIGHT) - (float)KeyDown(KEY_CAM_LEFT));
#endif //NO_NACL_EM

//Base data
vec2 rot = (!is_pos && !is_fov)?(tmp):(vec2(.0f)); rot = vec2(rot.x, rot.y);
vec2 pos = ( is_pos && !is_fov)?(tmp):(vec2(.0f)); pos = -vec2(pos.y, pos.x);
vec2 fov = (!is_pos && is_fov )?(tmp):(vec2(.0f)); fov = vec2(-fov.x, fov.y);
vec2 rot = (!is_pos && !is_fov)?(tmpv):(vec2(.0f)); rot = vec2(rot.x, rot.y);
vec2 pos = ( is_pos && !is_fov)?(tmpv):(vec2(.0f)); pos = -vec2(pos.y, pos.x);
vec2 fov = (!is_pos && is_fov )?(tmpv):(vec2(.0f)); fov = vec2(-fov.x, fov.y);
vec2 hsc = (is_hsc)?(vec2(0.f)):(vec2(0.f));

//speed
@@ -536,11 +536,11 @@ public:
for (int i = 0; i < m_ssetup->m_lights.Count(); ++i)
{
//Store local dst in current m_ld
LightData tmp = LightData(m_ssetup->m_lights[i]->GetPosition().xyz, m_ssetup->m_lights[i]->GetColor());
LightData ltmp = LightData(m_ssetup->m_lights[i]->GetPosition().xyz, m_ssetup->m_lights[i]->GetColor());
if (i < m_light_datas.Count())
m_light_datas[i] = tmp;
m_light_datas[i] = ltmp;
else
m_light_datas << tmp;
m_light_datas << ltmp;

vec3 loc = vec3::zero;
vec4 col = vec4::zero;
@@ -732,14 +732,14 @@ public:
{
for (int k = 0; k < m_ssetup->m_lights.Count(); ++k)
{
Light* tmp = m_ssetup->m_lights[k];
mat4 world = mat4::translate(tmp->GetPosition().xyz);
Light* ltmp = m_ssetup->m_lights[k];
mat4 world = mat4::translate(ltmp->GetPosition().xyz);
mat4 local = mat4::translate((inverse(m_mat) * world).v3.xyz);
//dir light
if (tmp->GetPosition().w == 0.f)
if (ltmp->GetPosition().w == 0.f)
{
m_gizmos[GZ_LightPos]->Render(m_mat * inverse(local));
m_gizmos[GZ_LightDir]->Render(inverse(world) * inverse(mat4::lookat(vec3::zero, -tmp->GetPosition().xyz, vec3::axis_y)));
m_gizmos[GZ_LightDir]->Render(inverse(world) * inverse(mat4::lookat(vec3::zero, -ltmp->GetPosition().xyz, vec3::axis_y)));
}
else //point light
{


+ 1
- 1
test/meshviewer.index.html ファイルの表示

@@ -282,7 +282,7 @@ function machinchose() { return 'test machin '; }
<div id="id_div_progress_status">....</div>&nbsp;
</div>
<div id="id_div_frame_embed">
<iframe onload="Init();" id="id_frame_embed" src="empty.html" width=770 height=200 frameborder=0 scrolling=no></iframe>
<iframe onload="Init();" id="id_frame_embed" src="../javascript/empty.html" width=770 height=200 frameborder=0 scrolling=no></iframe>
</div>
</div>
</div>


読み込み中…
キャンセル
保存