Mirror in lite-c with A8 PRO

Posted By: slacer

Mirror in lite-c with A8 PRO - 10/09/21 15:18

Hi all,

I installed my old A8 Pro again after a very long time and just wanted to create a simple scene with a real mirror in it.
This snippet from the manual does not even compile for me.
Code
// Code to emulate a horizontal mirror by generating a vertically flipped camera view
view mirror { }
function init_mirror_z()
{
  camera.portal = mirror;
 	mirror.noshadow = on; // suppress shadows in the mirror
 	mirror.portalclip = on;
 	while (1)
 	{
	  proc_late();   // place it at the end of the function list - the camera must be moved before
 	  mirror.genius = camera.genius;
 	  mirror.aspect = -camera.aspect;    // flip the image upside down
 	  mirror.arc = camera.arc;
 	  mirror.fog = camera.fog;
 	  mirror.x = camera.x;
 	  mirror.y = camera.y;
 	  mirror.z = 2*camera.portal_z-camera.z; //move the camera downwards by twice the portal distance
    mirror.pan = camera.pan;
 	  mirror.tilt = -camera.tilt; // flip the vertical camera angle
 	  mirror.roll = -camera.roll;
 	  wait(1);
  }
} 


The error message is:
Quote

A8 Egine - Pro Edition V8.47.1 - Mar 9 2016

Error in line 18:
'view' undeclared identifier
<view mirror {}>
Error E355: Startup Failure - any key to abort


Any ideas or a working sample?

I use the simple template with these header files:
Code
////////////////////////////////////////////////////////////////////////
// Template main script:
// Created by WED.
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
// entry: Start Level
// entry_help: Name of the level loaded at start
char* t_levelname = "sample.wmb";

////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
#include <atypes.h>
#include "t_player.h"


Kind regards
Michael
Posted By: slacer

Re: Mirror in lite-c with A8 PRO - 10/10/21 12:08

Seems I confused C-Script with Lite-C as this code is in the A6 manual in the C-Script section as well. frown But I still don't know how to do it in A8 PRO.
Posted By: 3run

Re: Mirror in lite-c with A8 PRO - 10/10/21 12:44

Hey!

There is a mirror shader in the mtlFX.c, check it out!
You can see how it works from the shaderTest.c (which can be found in GStudio8\projects\shadertest).

Greets.
Posted By: slacer

Re: Mirror in lite-c with A8 PRO - 10/10/21 13:41

Great!
Thank you.
© 2024 lite-C Forums