Skip to content
This repository has been archived by the owner on Dec 6, 2018. It is now read-only.

Commit

Permalink
Version 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dushan-google committed Sep 8, 2017
1 parent 3316983 commit 3cce7f9
Show file tree
Hide file tree
Showing 1,010 changed files with 4,864 additions and 120,192 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//Copyright 2017 Google Inc.
//
//Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,6 +19,7 @@
using System.Collections.Generic;
using System;
using UnityEngine.SceneManagement;
using System.IO;
#if UNITY_EDITOR
using UnityEditor;
#endif
Expand All @@ -29,7 +30,10 @@ namespace daydreamrenderer
public class DaydreamVertexLighting : MonoBehaviour
{
const int kMaxVerts = (1 << 16)-1;
public string m_sourceMeshPath;
public Mesh m_sourceMesh;
public Mesh m_untessellatedMesh;
public bool m_wasTessellated = false;
public BakeSets m_bakeSets;
public MeshContainer m_currentContainer;
public Mesh m_originalMesh;
Expand All @@ -56,11 +60,27 @@ public Mesh VertexLighting {
m_lightingMeshName = value.name;
}
}

public Mesh GetSourcMesh()
{
return GetComponent<MeshFilter>().sharedMesh;
}

public Mesh GetUntessellatedMesh()
{
if(m_untessellatedMesh != null && m_untessellatedMesh.vertexCount > 0)
{
return m_untessellatedMesh;
}
return GetComponent<MeshFilter>().sharedMesh;
}


public void Awake()
{
m_meshRenderer = GetComponent<MeshRenderer>();
#if UNITY_EDITOR
m_sourceMesh = GetComponent<MeshFilter>().sharedMesh;
m_sourceMesh = GetSourcMesh();
#endif
LoadLightingMesh();

Expand All @@ -82,9 +102,7 @@ public void Update()
&& (m_meshRenderer == null || m_meshRenderer.additionalVertexStreams == null)
&& m_currentContainer != null)
{
m_meshRenderer = GetComponent<MeshRenderer>();
MeshFilter meshFilter = GetComponent<MeshFilter>();
m_sourceMesh = meshFilter.sharedMesh;
m_sourceMesh = GetSourcMesh();

LoadLightingMesh();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,32 @@ void OnPostprocessModel(GameObject model)
{
if(m.shader.name.ToLower().Contains("daydream"))
{
DaydreamMeshRenderer dmr = r.gameObject.GetComponent<DaydreamMeshRenderer>();
if (dmr != null)
{
GameObject.DestroyImmediate(dmr, true);
}
r.gameObject.AddComponent<DaydreamMeshRenderer>();

break;
}
}
}
}

void OnPreprocessModel()
{
Debug.Log(assetPath);
}

static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
List<string> assetNames = new List<string>(importedAssets);

// Filter down to just model data
assetNames.RemoveAll(delegate (string assetName)
{
return !(assetName.EndsWith("fbx") || assetName.EndsWith("ma") || assetName.EndsWith("mb"));
return !(assetName.ToLower().EndsWith("fbx") || assetName.ToLower().EndsWith("ma") || assetName.ToLower().EndsWith("mb"));
});

// pull out statically lit objects in the scene
Expand Down
Loading

0 comments on commit 3cce7f9

Please sign in to comment.