Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#19 Freeform shadow casting improve

closed
nobody
None
5
2010-11-16
2010-11-16
Sandor Domokos
No

Hi
I using GlShadowVolume for shadow cast.
And if visible=false some meshobject of freeform, it's not affected to the shadow.
But if make a little bit change (check each mesh visiblity, and make connectivity only if MO visible) shadow cast working fine.

See code below (GLBaseMeshSilhouette.pas).

procedure TGLBaseMeshConnectivity.SetGLBaseMesh(const Value: TGLBaseMesh);
var
i : integer;
MO : TMeshObject;
Connectivity : TFaceGroupConnectivity;
begin
Clear(False);

FGLBaseMesh := Value;

// Only precompute normals if the basemesh isn't an actor (because they change)
FPrecomputeFaceNormal := not (Value is TGLActor);
FGLBaseMesh := Value;

for i := 0 to Value.MeshObjects.Count-1 do
begin
MO := Value.MeshObjects[i];

if MO.Visible then begin
Connectivity := TFaceGroupConnectivity.CreateFromMesh(MO, FPrecomputeFaceNormal);

FFaceGroupConnectivityList.Add(Connectivity);
end;
end;
end;

Discussion

  • YarUnderoaker
    YarUnderoaker
    2010-11-16

    Done. Thaks.

     
  • YarUnderoaker
    YarUnderoaker
    2010-11-16

    • status: open --> closed