updated test codes.
This commit is contained in:
parent
b9f5c69f85
commit
7f744d1207
@ -1 +1 @@
|
|||||||
Subproject commit 4d5558b3d0240caa2076f59aab1e023147546bf9
|
Subproject commit f610497a6d403001303e15f474f9fa2a5bc0cc23
|
@ -59,25 +59,21 @@ Output
|
|||||||
|
|
||||||
Code
|
Code
|
||||||
{
|
{
|
||||||
|
#define HAVE_SPECULAR
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
MaterialInstance mi=GetMI();
|
MaterialInstance mi=GetMI();
|
||||||
|
|
||||||
//将法线归一化
|
|
||||||
// vec3 world_normal =normalize(Input.Normal);
|
|
||||||
|
|
||||||
//对世界坐标下的灯光方法归一化
|
|
||||||
// vec3 world_light_direction =normalize(sun.direction.xyz);
|
|
||||||
|
|
||||||
//点乘法线和光照
|
//点乘法线和光照
|
||||||
float intensity=0.5*max(dot(Input.Normal,sun.direction.xyz),0.0)+0.5;
|
float intensity=0.5*max(dot(Input.Normal,sun.direction.xyz),0.0)+0.5;
|
||||||
|
|
||||||
//直接光颜色
|
//直接光颜色
|
||||||
vec3 direct_color =intensity*sun.color.rgb*mi.Color.rgb;
|
vec3 direct_color =intensity*sun.color.rgb*mi.Color.rgb;
|
||||||
|
|
||||||
// #ifndef HAVE_SPECULAR
|
#ifndef HAVE_SPECULAR
|
||||||
// FragColor=vec4(direct_color,1.0);
|
FragColor=vec4(direct_color,1.0);
|
||||||
// #else
|
#else
|
||||||
|
|
||||||
vec3 spec_color=vec3(0.0);
|
vec3 spec_color=vec3(0.0);
|
||||||
|
|
||||||
@ -91,6 +87,6 @@ Code
|
|||||||
}
|
}
|
||||||
|
|
||||||
FragColor=vec4(direct_color+spec_color,1.0);
|
FragColor=vec4(direct_color+spec_color,1.0);
|
||||||
// #endif//HAVE_SPECULAR
|
#endif//HAVE_SPECULAR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ private:
|
|||||||
{
|
{
|
||||||
Add(material_instance,scale(PLANE_SIZE,PLANE_SIZE,1));
|
Add(material_instance,scale(PLANE_SIZE,PLANE_SIZE,1));
|
||||||
|
|
||||||
camera->pos=Vector3f(PLANE_SIZE/2,PLANE_SIZE/2,PLANE_SIZE/2);
|
camera->pos=Vector3f(PLANE_SIZE/2,PLANE_SIZE/4,PLANE_SIZE/2);
|
||||||
camera_control->SetTarget(Vector3f(0,0,0));
|
camera_control->SetTarget(Vector3f(0,0,0));
|
||||||
camera_control->Refresh();
|
camera_control->Refresh();
|
||||||
|
|
||||||
|
@ -122,18 +122,18 @@ private:
|
|||||||
{
|
{
|
||||||
using namespace inline_geometry;
|
using namespace inline_geometry;
|
||||||
|
|
||||||
////Plane Grid
|
//Plane Grid
|
||||||
//{
|
{
|
||||||
// struct PlaneGridCreateInfo pgci;
|
struct PlaneGridCreateInfo pgci;
|
||||||
|
|
||||||
// pgci.grid_size.Set(32,32);
|
pgci.grid_size.Set(32,32);
|
||||||
// pgci.sub_count.Set(8,8);
|
pgci.sub_count.Set(8,8);
|
||||||
|
|
||||||
// pgci.lum=0.5;
|
pgci.lum=0.5;
|
||||||
// pgci.sub_lum=0.75;
|
pgci.sub_lum=0.75;
|
||||||
|
|
||||||
// prim_plane_grid=CreatePlaneGrid(db,mtl_vertex_lum->GetDefaultVIL(),&pgci);
|
prim_plane_grid=CreatePlaneGrid(db,mtl_vertex_lum->GetDefaultVIL(),&pgci);
|
||||||
//}
|
}
|
||||||
|
|
||||||
//Sphere
|
//Sphere
|
||||||
{
|
{
|
||||||
@ -145,7 +145,7 @@ private:
|
|||||||
|
|
||||||
bool InitScene()
|
bool InitScene()
|
||||||
{
|
{
|
||||||
//Add(prim_plane_grid,mi_plane_grid,p_line);
|
Add(prim_plane_grid,mi_plane_grid,p_line);
|
||||||
Add(prim_sphere,mi_sphere,p_sphere);
|
Add(prim_sphere,mi_sphere,p_sphere);
|
||||||
|
|
||||||
camera->pos=Vector3f(32,32,32);
|
camera->pos=Vector3f(32,32,32);
|
||||||
@ -165,8 +165,8 @@ public:
|
|||||||
if(!SceneAppFramework::Init(w,h))
|
if(!SceneAppFramework::Init(w,h))
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
//if(!InitVertexLumMP())
|
if(!InitVertexLumMP())
|
||||||
// return(false);
|
return(false);
|
||||||
|
|
||||||
if(!CreateBlinnPhongUBO())
|
if(!CreateBlinnPhongUBO())
|
||||||
return(false);
|
return(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user